M3Server Technical Blog FAQ Mechbunny memcache

Mechbunny memcache



Q: What is memcache and what are the performance benefits over filesystem cache?

A: In short, using memcache stores your cache files in RAM intead of disk storage.  This further increases speed since RAM is faster than disk and also reduces the disk IO.

Using the filesystem as a cache is often times faster than querying the same data from a MySQL database or compiling of php scripts and can increase web site response times.  However, care should be taken to ensure a crontab scheduled script is setup to purge this data of stale files.  Otherwise,  system performance will degrade quickly, especially under high traffic loads.  For this reason, we don’t recommend file system cache at all.  If your traffic levels are producing high CPU load, only then should you think of caching.  Memcache keeps the cached objects in RAM memory for faster access, reduced disk IO and the objects expire in 24 hours or by the settings in your php application.

Failure to clean up your filesystem cache on a regular basis will result in millions upon millions of tiny files that can hamper backup systems, file transfers, etc.

In the example below, we illustrate a popular php application that takes advantage of the performance of memcache.

In the In the /admin/config.php file you will have a script that looks similar to the following:

NOTE: With new MechBunny scripts the settings below are found in admin panel under settings tab.



$video_cache_time = 0; //video page cache time
$overall_cache_time = 0; //cache time for all other pages

Zero sets the cache to never expire.
Cache time shouldn’t ever be zero.

You need to change that value to 1 at the very least.

$video_cache_time = 1; //video page cache time
$overall_cache_time = 1; //cache time for all other pages

On low traffic servers, We recommend video be 60 seconds and overall be 30 seconds.

The following is our recommended setting on very very busy sites.

$video_cache_time = 43200; //video page cache time
$overall_cache_time = 3600; //cache time for all other pages

NOTE:  memcache is not installed by default on the M3 Server platforms, however, we will install it free upon request.