OptimumCache from inside

OptimumCache (beta version currently) is a component which handles duplicate files in the way that they are loaded just once from filesystem cache. By doing that, system bypasses disk IO, significantly improving the speed of reading that files, while lowering load on the hard disk.

OptimumCache can run with ploop or without. Ploop is a disk block device that is mounted as /var/cache/optimumcache image file. Ploop is not available in kernel version under lve 1.2.55, thus OptimumCache can work without ploop on older version kernel. In this case cache files get directly into /var/cache/optimumcache/ .

Ploop image file /var/share/optimumcache/optimumcache.image is mounted in /var/cache/optimumcache/, so the directory structure remains the same. The main advantage of ploop is that you can set it’s size which won’t be exceeded.

Usualy ‘occtl –mark-dir /home –recursive‘ process takes a long time, as the major task is to go through all the files in specified directory and subdirectories, check sha1sum of each of them and set the necessery attribute.

E.g.:

 

3dd4d2639a035a9c311b50bced7b711655360351 /home/cltest3/public_html/i.php

 trusted.pfcache=”3dd4d2639a035a9c311b50bced7b711655360351″

sha1 hash is used here to place file in cache directory, in the example above it will be placed in

/var/cache/optimumcache/3d/d4d2639a035a9c311b50bced7b711655360351

(where the first two symbols mean directory and the next goes file name).

Files with the same content get the same sha1sum:

3dd4d2639a035a9c311b50bced7b711655360351 i.php

<? phpinfo() ?>

3dd4d2639a035a9c311b50bced7b711655360351 m.php

 

which means that finally both will lead to the same cached file:

 <? phpinfo() ?>

In OptimumCache v0.2 the automark is used. Its attribute is set in the directory so as the file is changed or the new file is created, the needed attribute will be automatically assigned to it. To check if automark works in the directory run:

 trusted.pfcache=”auto”

There is a list of directories that do not work with mark/automark, you can check it via occtl –list-skip-mask . These are quote files, cPanel service files, user mail files.

 

How to read optimumcache statistics is explained in this article.

 

2 comments

    1. As of now yes it’s still beta however there were a lot of changes since November and last version (0.2.24) is doing pretty well. The only ‘issue’ is initial mark process which cause a bit increased IO, however there is a method to limit iousage by that process.

Leave a Reply

Your email address will not be published. Required fields are marked *