Zurmo Cache System Explained

Zurmo doesn’t require any cache systems in order to work, although performance can be drastically improved if cache is used.

Memcache PHP library is used to cache data with a memcached server. There is some confusion among programmers between the Memcache and Memcached PHP libraries and the memcached caching system (usually written in lowercase which is actually a daemon process that runs in the background and executes commands that are provided via its API). Memcached PHP is a newer library, has more functions, and is faster. However, we found it to be a bit buggy, so we decided to stick with the older and more stable Memcache library. The storage for cache is abstracted, so if you decide to used Memcached instead, you can easily switch to it.

To make the caching system work, you first need to install memcached. memcached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up dynamic web applications by alleviating database load.

Next, the Memcache PHP library must be installed, so PHP programs can communicate with the memcached daemon, store data to memcached, get data, delete data in memcached and so on.

During the installation of Zurmo CRM, you can enter settings for the memcached server, or you can configure it after installation is complete, in the app/protected/config/perInstance.php file. If you have multiple memcache servers, you can add them after installation is completed, in app/protected/config/perInstance.php. As an example, the server configuration might look like:

$memcacheServers  = array(
    array(
        'host'   => '127.0.0.1',
        'port'   => 11211,  // This is the default memcached port.
        'weight' => 100,
    ),
    array(
        'host'   => '192.168.1.10',
        'port'   => 11211,  // This is the default memcached port.
        'weight' => 110,
    ),
);

If you want to disable memcache, you need to provide an empty array:

$memcacheServers  = array();

and in file app/protected/config/debug.php set:

$memcacheLevelCaching = false;

In addition to memcache caching, Zurmo uses PHP cache (static property) to store data. This option can be disabled by setting $phpLevelCaching = false in the app/protected/config/debug.php file.

If you need to explicitly clear all cache data, you can do so by appending the string ?clearCache=1 to your webserver url (for example, if Zurmo is installed under http://www.zurmo.org/app, you would append it to look like: http://www.zurmo.org/app/index.php?clearCache=1).

Leave a Comment

  • http://amigotechnotes.wordpress.com/ Amigo Chan

    On Synology DSM, it support Memcached and memcached but no Memcache. Therefore, I dig into the source code and modify to enable ZurmoCRM to use Memcached to communicate with memcached.

    The key is to remove
    $memcacheServiceHelper->runCheckAndGetIfSuccessful() and add
    ‘useMemcached’=>true in [where you installed
    ZurmoCRM]/app/protected/modules/zurmo/components/BeginRequestBehavior.php
    file.

    You may read [b][url=http://amigotechnotes.wordpress.com/2014/02/28/optimize-synology-dsm-for-zurmocrm/]Optimize Synology DSM for ZurmoCRM[/url][/b] to know how to enable and modify them for detail.

    A simple test result:

    [b] Using DS-214SE ARMADA 370 at 700Hz with 256MB RAM with Alternative PHP Cache to open a contact in detail taks 33 seconds. If enable Memcached support, it shrinks to 10 seconds on a cached contact. Running the same test on QNAP TS-119PII Marvell 88F6281 at 2.0GHz with 512MB RAM without Alternative PHP Cache nor Memcached takes 15 seconds.[/b]

  • http://amigotechnotes.wordpress.com/ Amigo Chan

    On Synology DSM, it support Memcached and memcached but no Memcache. Therefore, I dig into the source code and modify to enable ZurmoCRM to use Memcached to communicate with memcached.

    The key is to remove $memcacheServiceHelper->runCheckAndGetIfSuccessful() and add
    ‘useMemcached’=>true in [where you installed ZurmoCRM]/app/protected/modules/zurmo/components/BeginRequestBehavior.php file.

    You may read Optimize Synology DSM for ZurmoCRM to know how to enable and modify
    them for detail.

    http://amigotechnotes.wordpress.com/2014/02/28/optimize-synology-dsm-for-zurmocrm/

    A simple test result:

    Using DS-214SE ARMADA 370 at 700Hz with 256MB RAM with Alternative PHP Cache to open a contact in detail taks 33 seconds. If enable Memcached support, it shrinks to 10 seconds on a cached contact. Running the same test on QNAP TS-119PII Marvell 88F6281 at 2.0GHz with 512MB RAM without Alternative PHP Cache nor Memcached takes 15 seconds.

  • Alejandro

    I installed Zurmo for one of my domains using Softaculous on my CPanel server
    so I want to make sure it is running memcache as expected.

    Can you please check this URL http://www.bicicletaselectricas.pe/test/phpinfo.php
    and tell me if what you see is what is expected?