It’s not easy to install ZurmoCRM and that’s why I encourage to Test your ZurmoCRM with VirtualBox. You need to manually edit configuration files before setup on Synology DSM.
This post will be updated when I found more optimization in the future.
DSM 4.3
It provides Alternative PHP Cache which may accelerate LAMP by caching and optimizing PHP intermediate code and Memcached which is an interface to memcached. memcached will cache database result and lower database loading in LAMP.
ZurmoCRM default uses Memcache not Memcached. You need to edit configuration to enable support for Memcached.
- Increase memory_limit in php.ini to 256.
- Increase max_execution_time in php.ini to 2000.
- In [Control Panel]→[Web Services]→[PHP Settings] tab, Enable PHP cache and select to enable following PHP extensions: mcrypt, memcached, and optional ldap.
- Increase apc.shm_size in apc.ini to 64M with 1GB and 128M with 2GB installed.
- Execute or create a shell script to load memcached automatically during startup. Use -m 128 for 1GB and -m 256 for 2GB installed. Then follow Enable Memcahed after Installation to manually enable Memcached.
memcached -u root -l 127.0.0.1 -P 11211 -m 128 -d
Use ps | grep memcached to confirmed it has been loaded into memory.
Enable Alternative PHP Cache after Installation
It is default on. There is no need to change after you enable Alternative PHP Cache.
If you are not comfortable with the performance, check the [where you installed ZurmoCRM]/app/protected/config/debug.php file and look for $phpLevelCaching. It should be true by default.
Unless you need to disable Alternative PHP Cache during debug, please keep it true.
Enable Memcahed after Installation
Edit the [where you installed ZurmoCRM]/app/protected/config/perInstance.php file and fill in memcached information. It should match to parameters to launch memcached.
$memcacheServers = array( // An empty array means memcache is not used. array( 'host' => '127.0.0.1', 'port' => 11211, // This is the default memcached port. 'weight' => 100, ), );
Edit the [where you installed ZurmoCRM]/app/protected/config/debug.php file and change $memcacheLevelCaching to true to enable.
Edit the [where you installed ZurmoCRM]/app/protected/modules/zurmo/components/BeginRequestBehavior.php file and change public function handleApplicationCache($event) as highlighted by bold.
public function handleApplicationCache($event) { if (MEMCACHE_ON) { //Yii::import('application.core.components.ZurmoMemCache'); $memcacheServiceHelper = new MemcacheServiceHelper(); // if ($memcacheServiceHelper->runCheckAndGetIfSuccessful()) { $cacheComponent = Yii::createComponent(array( 'class' => 'CMemCache', 'keyPrefix' => ZURMO_TOKEN, 'useMemcached'=>true, 'servers' => Yii::app()->params['memcacheServers'])); Yii::app()->setComponent('cache', $cacheComponent); } // todo: Find better way to append this prefix for tests. // We can't put this code only in BeginRequestTestBehavior, because for API tests we are using if (defined('IS_TEST')) { ZurmoCache::setAdditionalStringForCachePrefix('Test'); } } }
The $memcacheServiceHelper->runCheckAndGetIfSuccessful() calls runCheckAndGetIfSuccessful() in [where you installed ZurmoCRM]/app/protected/modules/install/serviceHelpers/MemcacheServiceHelper.php to check if Memcache has been load.
If you don’t want to skip checking and preferred Memcached, change the following code marked bold in [where you installed ZurmoCRM]/app/protected/modules/install/serviceHelpers/MemcacheServiceHelper.php to force checking for “memcached” instead of “memcache”.
if (extension_loaded('memcached'))
You may use the System Diagnostics in [Administration]→[Developer Tools] to test if it may pass the check for Memcache. I plan to commit extra codes to simplified the use of Memcached in 2014 March.
On my DS214SE, it takes 34 seconds to display one contact in detail without Memcached and shrinks to 10 seconds if you enable the support.
Don’t forget to load memcached before use.
Notes
- Size for apc.shm_size and memcached may vary depends on systems environments and usage scenario.
- If you use less than 900 in max_execution_time, you might fail to install demo data. You may set it to a smaller number than 2000 after installation.
- If you are looking for files, please read Synology DSM Configuration and Executable Files.
Reference
- ZurmoCRM
- Test your ZurmoCRM with VirtualBox
- Synology: DSM for Business
- PHP: PHP Manual: Appendices: php.ini directives
- PHP: PHP Manual: Appendices: php.ini directives: memory_limit
- PHP: PHP Manual: Appendices: php.ini directives: post_max_size
- PHP: PHP Manual: Appendices: php.ini directives: upload_max_filesize
- PHP: PHP Manual: Appendices: php.ini directives: max_execution_time
- PHP: PHP Manual: Function Reference: Date and Time Related Extensions: Date/Time: Installing/Configuring: Runtime Configuration: date.timezone
- PHP: Alternative PHP Cache
- Wiki: LAMP (software bundle)
- PHP: PHP Manual: Function Reference: Affecting PHP’s Behavior: APC: Installing/Configuring: Runtime Configuration
- PHP: PHP Manual: Function Reference: Affecting PHP’s Behavior: APC: Installing/Configuring: Runtime Configuration: apc.shm_size
- PHP: PHP Manual: Function Reference: Other Services: Memcache
- PHP: PHP Manual: Function Reference: Other Services: Memcached
- memcached
- Oracle: Docs: 15.6.2 Using memcached
- Web Developer Juice: 10 baby steps to install Memcached Server and access it with PHP
- Asustor ADM Configuration and Executable Files
- Synology DSM Configuration and Executable Files
- Zurmo: Forums: Enable Memcache after install
- Zurmo: Zurmo Cache System Explained
- Synology: DS214SE