Optimize TurnKey Linux for ZurmoCRM


It’s not easy to install ZurmoCRM and that’s why I encourage beginners to Test your ZurmoCRM with VirtualBox. Although it is much faster than start from scratch, it is not perfect. You may need to modify some configurations and install extra package to keep it stable and accelerate performance.

This post will be updated when I found more optimization in the future.

Basic TurnKey ZurmoCRM 13.0 Configurations

If you preferred to keep it simple and don’t want to install any extra packages, you might need to edit following configurations.

  1. Increase memory_limit in php.ini to 256.
  2. Increase post_max_size in php.ini to 20M.
  3. Increase upload_max_filesize in php.ini to 20M.
  4. Increase max_execution_time in php.ini to 2000.

Restart Apache to take effect.

root@zurmo ~# /etc/init.d/apache2 restart

Upgrade to Latest ZurmoCRM

Please refer to “Upgrade ZurmoCRM in TurnKey VM” and following steps to upgrade to the latest version.

Or you may just upload the latest ZurmoCRM to replace the /var/www/zurmo folder. Change the owner of this folder to www-data and config it again.

root@zurmo /var/www# chown www-data:www-data zurmo -R

Install and Enable APC Extension

The original package doesn’t contain Alternative PHP Cache aka APC. It may cache and optimize PHP intermediate code.

You may install APC with apt-get and restart Apache to take effect. During installation, it will ask to remove php5-xcache which is the build-in PHP accelerator in TurnKey Linux.

root@zurmo ~# apt-get update
root@zurmo ~# apt-get install php-apc
root@zurmo ~# /etc/init.d/apache2 restart

To improve stability and performance, please increase apc.shm_size in apc.ini to 96M or higher. With less than 96MB, you might see a page display error message “include(): Unable to allocate memory for pool.” while saving any records. According to a “Twitter by Dan O’Brien ‏@ abend0c4 18 Oct 2012”, it is related apc.shm_size.

More information about APC configuration may be found in “The Perfect APC Configuration” by Greg Rickaby.

Install and Enable Memcache Extension

The original package doesn’t contain Memcache. It is an PHP interface to memcached service which will cache database result and lower database loading.

You may install Memcache with apt-get and restart Apache to take effect.

root@zurmo ~# apt-get update
root@zurmo ~# apt-get install php5-memcache
root@zurmo ~# /etc/init.d/apache2 restart
root@zurmo ~# /etc/init.d/memcached restart

To improve performance, increase cache memory in memcached.conf with -m 128 for 1GB and -m 256 for 2GB installed.

Use ps -aux | grep memcached to confirmed it has been loaded into memory successfully.

Enable APC Extension After Installation

When ZurmoCRM detects APC, it will use automatically. Or you may check if $phpLevelCaching in [where you installed ZurmoCRM]/app/protected/config/debug.php is set to true.

Unless you need to disable APC during debug, please keep it true.

Enable Memcahe Extension After Installation

If you install Memcache after setup configuration, you need to manually edit memcached information in [where you installed ZurmoCRM]/app/protected/config/perInstance.php. It should match to parameters used to launch memcached service.

$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,                             
                        ),                                                         
                    );

Please check if $memcacheLevelCaching in [where you installed ZurmoCRM]/app/protected/config/debug.php is to true, too.

Security Update

It is very important to regular check any security patch for you TurnKey Linux. Run following command to check or add in to cron. You may find more related information at Automatic security updates on TurnKey Linux.

root@zurmo /# install-security-updates

Some patch are not automatically update, you should also pay attention to security leaks sites and news.

Notes

  1. Size for apc.shm_size and memcached may vary depends on systems environments and usage scenario.
  2. If you use less than 900 in max_execution_time, you might fail to install demo data on processor slower than Intel Atom D2700 . You may set it to a smaller number than 2000 after installation.
  3. If you are looking for files, please read TurnKey Linux Configuration and Executable Files.
  4. If you are not sure for package name, use apt-cache search [name] to search for possible match.

Reference

  1. Apache
  2. Asustor ADM
  3. Greg Rickaby: The Perfect APC Configuration
  4. HowtoForge: Install Memcached And PHP5-MemCached Module On Debian 6.0 (Squeeze)
  5. Intel Atom Processor D2700
  6. memcached
  7. Oracle: Docs: 15.6.2 Using memcached
  8. PHP: Alternative PHP Cache
  9. PHP: PHP Manual: Appendices: php.ini directives
  10. PHP: PHP Manual: Appendices: php.ini directives: max_execution_time
  11. PHP: PHP Manual: Appendices: php.ini directives: memory_limit
  12. PHP: PHP Manual: Appendices: php.ini directives: post_max_size
  13. PHP: PHP Manual: Appendices: php.ini directives: upload_max_filesize
  14. PHP: PHP Manual: Function Reference: Affecting PHP’s Behavior: APC: Installing/Configuring: Runtime Configuration
  15. PHP: PHP Manual: Function Reference: Affecting PHP’s Behavior: APC: Installing/Configuring: Runtime Configuration: apc.shm_size
  16. PHP: PHP Manual: Function Reference: Date and Time Related Extensions: Date/Time: Installing/Configuring: Runtime Configuration: date.timezone
  17. PHP: PHP Manual: Function Reference: Other Services: Memcache
  18. Test your ZurmoCRM with VirtualBox
  19. TurnKey Linux
  20. TurnKey Linux Configuration and Executable Files
  21. TurnKey Linux Forums: Support: [Solved] Upgrading Magento (how to?)
  22. TurnKey Linux: Automatic security updates
  23. TurnKey Linux Zurmo
  24. Twitter by Dan O’Brien ‏@ abend0c4 18 Oct 2012
  25. Upgrade ZurmoCRM in TurnKey VM
  26. Web Developer Juice: 10 baby steps to install Memcached Server and access it with PHP
  27. Wiki: LAMP (software bundle)
  28. Wiki: List of PHP accelerators
  29. ZurmoCRM
  30. Zurmo: Forums: Enable Memcache after install
  31. Zurmo: Zurmo Cache System Explained

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.