CloudLinux OS Blog - Beta: OptimumCache - de-duplicating file cache for CloudLinux
CloudLinux OS Blog

Beta: OptimumCache - de-duplicating file cache for CloudLinux

Typical shared hosting server runs a number of sites with WordPress, Joomla as well as other popular software. This usually represents as hundreds of duplicate files that are constantly being read into file cache - both wasting precious disk IO operations as well as memory. OptimumCache creates a cache of such duplicate files.

With OptimumCache, if a duplicate of an already loaded file is requested, the file gets loaded from filesystem cache. By doing that, system bypasses disk IO, significantly improving the speed of reading that file, while lowering load on the hard disk. As the file had been read from disk just once, it is cached by filesystem cache just once, minimizing amount of duplicates in filesystem cache, and improving overall cache efficiency. This in turn reduces memory usage, decreases the number of disk operations - all while improving the websites response time.

OptimumCache comes free with CloudLinux. It requires 64 bit version of CloudLinux 6.x, as well as ext4 file system to work.

To install OptimumCache:
$ yum install optimumcache --enablerepo=cloudlinux-updates-testing

To mark user's directories for caching:
$ optimumcache mark --recursive /HOME_DIR

Note, that this operation can take significant amount of time as it will scan all the sub directories. This has to be done once, and all new files/sub directories would be 'marked' for caching automatically.

On cPanel it would usually be:
$ optimumcache mark --recursive /home

On Plesk
$ optimumcache mark --recursive /var/www/vhosts

Cached files will be stored by default at:
/var/cache/optimumcache

You can change that by editing OPTIMUMCACHE_MNT at /etc/sysconfig/optimumcache and running:
$ service optimumcache restart

The cache will be cleaned (shrunk) once partition on which OPTIMUMCACHE_MNT resides has only 20% of free space. You can change that by changing PURGEAHEAD param in /etc/sysconfig/optimumcache, and restarting optimumcache service.

KernelCare - update for CL6 fixes memory leak intr...
KernelCare update for CentOS/RHEL/CL6.x - update t...
 

Comments 27

Guest - kernow on Saturday, 29 March 2014 13:28

1) Is there the ability to clear a users cache if needed?

1) Is there the ability to clear a users cache if needed?
Guest - Igor Seletskiy on Saturday, 29 March 2014 13:37

1. This is file system cache, so any changes to the file are reflected right away.
2. This is not http cache at all. It is all about not reading files with the same content from disk twice. It is not about 'caching' http output.

1. This is file system cache, so any changes to the file are reflected right away. 2. This is not http cache at all. It is all about not reading files with the same content from disk twice. It is not about 'caching' http output.
Guest - kernow on Saturday, 29 March 2014 13:40

Sounds perfect! will try it out.

Sounds perfect! will try it out.
Guest - david majchrzak on Friday, 04 April 2014 17:33

You also need to add these mount options in fstab for the partition you're intending to cache:

[CODE]pfcache_csum,pfcache=/var/cache/optimumcache[/CODE]
Example line in fstab:

[CODE]/dev/mapper/3-home

You also need to add these mount options in fstab for the partition you're intending to cache: [CODE]pfcache_csum,pfcache=/var/cache/optimumcache[/CODE] Example line in fstab: [CODE]/dev/mapper/3-home
Guest - Igor Seletskiy on Saturday, 05 April 2014 02:48

Please, don't add those options to fstab. They should be applied at run time. We are working on automatically doing it in our optimumcache service.

Please, don't add those options to fstab. They should be applied at run time. We are working on automatically doing it in our optimumcache service.
Guest - Elliot Pearse on Tuesday, 08 April 2014 03:35

Hi Igor,

Hi Igor,
Guest - Igor Seletskiy on Tuesday, 08 April 2014 05:30

It doesn't de-duplicate the files on the disk. More than that, an extra copy of duplicate files will be created.
It de-duplicates read operations, and allows not to store duplicates in memory file cache.

It doesn't de-duplicate the files on the disk. More than that, an extra copy of duplicate files will be created. It de-duplicates read operations, and allows not to store duplicates in memory file cache.
Guest - Elliot Pearse on Tuesday, 08 April 2014 05:39

Thanks, i understand. Can you confirm if this is on Hybrid kernels as well?

Thanks, i understand. Can you confirm if this is on Hybrid kernels as well?
Guest - Igor Seletskiy on Tuesday, 08 April 2014 05:46

It is not available yet on Hybrid kernel, but once it is stable, we will make it available.
It will not work on ext3 (limitation of the filesystem)
It will not work on 32bit systems - just too hard to implement right, as it uses a lot of 64bit math to make it fast.

It is not available yet on Hybrid kernel, but once it is stable, we will make it available. It will not work on ext3 (limitation of the filesystem) It will not work on 32bit systems - just too hard to implement right, as it uses a lot of 64bit math to make it fast.
Guest - Elliot Pearse on Tuesday, 08 April 2014 06:46

Thanks, Igor.

Thanks, Igor.
Already Registered? Login Here
Guest
Sunday, 20 October 2019

Captcha Image