Optimize LAMP for SugarCRM


When porting ZurmoCRM onto NAS, I saw many of them provide SugarCRM. You may found it in TurnKey Linux SugarCRM which is easier to setup.

I list a series of questions related to SugarCRM and take my notes here.

What PHP Accelerators does SugarCRM support?

Many. In [your web server root directory]/sugar/include/SugarCache/SugarCache.php, the cleanOpcodes() function lists supported opcode cache:

  1. Alternative PHP Cache
  2. eAccelerator
  3. ionCube PHP Accelerator
  4. WinCache Extension for PHP
  5. XCache

If your hosting service doesn’t provide any of above, you may follow XCache and SugarCRM – Any Advice, about to try it out to modify source code to enable support. Here is the key from Jacob.

It all starts in:
/include/utils/external_cache/SugarCache.php

You need to add extra code to handle the cache in the “discover” function.

You then need to add a file that is similar to “SugarCache_APC.php” but has your name instead of APC and all of the appropriate function calls. There are only 67 lines in the APC implementation and two primary functions.

Specific the PHP Accelerators

For LAMP with more than one PHP Accelerators, you might want to disable others preventing SugarCRM to use them.

Modify config_override.php and use following configuration to disable those you don’t need.

$sugar_config['external_cache_disabled'] = true; // Disables all external caching
$sugar_config['external_cache_disabled_apc'] = true; // Disables APC
$sugar_config['external_cache_disabled_memcache'] = true; // Disables Memcache
$sugar_config['external_cache_disabled_memcached'] = true; // Disables Memcached
$sugar_config['external_cache_disabled_redis'] = true; // Disables Redis
$sugar_config['external_cache_disabled_smash'] = true; // Disables sMash
$sugar_config['external_cache_disabled_wincache'] = true; // Disables Wincache
$sugar_config['external_cache_disabled_zend'] = true; // Disables Zend

The cache manager is in [installed folder]/include/SugarCache/SugarCache.php

More detail may be found in PHP Caching.

Increase PHP Accelerators Cache Size

It is recommend to use APC with SugarCRM. Increase apc.shm_size in apc.ini to 64M with 1GB and 128M with 2GB installed. If you are using QTS from QNAP, you need to manually look for eaccelerator.shm_size in Qthttpd.sh and increase the number. Detail directory can be found in QNAP QTS Configuration and Executable Files.

You may use PHP Accelerators with memcached together for different purpose according to Speeding up Sugar using an external cache.

Enable Support for memcached

You will need enable Memcache or Memcached in PHP to communicate with memcached. Use <?php phpinfo(); ?> to check if one of them is loaded.

To enable in your Linux or NAS, check the following posts:

  1. Optimize TurnKey Linux for ZurmoCRM
  2. Optimize Asustor ADM for ZurmoCRM
  3. Optimize QNAP QTS for ZurmoCRM

Although QNAP supports memcached, you need to compile your own Memcache or Memcached according to Optimize Synology DSM for ZurmoCRM.

Please add memcached information to config.php with following configurations:

$GLOBALS['sugar_config']['external_cache']['memcache']['host'] = '<<memcached server IP>>';
$GLOBALS['sugar_config']['external_cache']['memcache']['port'] = '<<memcached port number>>';

More detail may be found in Speeding up Sugar using an external cache.

Increase memory_limit with Care

It is reported that PHP segmentation fault when using more than 128MJason thinks it might be related to file issue and PHP fail to kill the process when memory_limit is more than 128M.

If you encounter segmentation fault, try to decrease your memory_limit to 128M.

Notes

  1. Size for apc.shm_size and memcached may vary depends on systems environments and usage scenario.
  2. If you are looking for files, for Linux distributions, you may found them in TurnKey Linux Configuration and Executable Files and OpenSuSE Configuration and Executable Files. For NAS, Asustor ADM Configuration and Executable Files, QNAP QTS Configuration and Executable Files, Synology DSM Configuration and Executable Files may help.
  3. You may fine-tune on apache and MySQL in SugarForge.org: How to enhance SugarCRM Performance? (v1.0) and SiteGround: Knowledge Base: How to optimize SugarCRM for better performance?

Reference

  1. ZurmoCRM
  2. SugarCRM
  3. TurnKey Linux SugarCRM
  4. Test your ZurmoCRM with VirtualBox
  5. Wiki: List of PHP accelerators
  6. PHP: Alternative PHP Cache
  7. eAccelerator
  8. ionCube PHP Accelerator
  9. Microsoft: WinCache Extension for PHP
  10. XCache
  11. Wiki: LAMP (software bundle)
  12. SugarCRM: Guides: PHP Caching
  13. SugarCRM Developer Blog: Speeding up Sugar using an external cache
  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. GitHub: eaccelerator: Wiki: Settings: eaccelerator.shm_size
  17. QNAP
  18. QNAP: QTS
  19. QNAP QTS Configuration and Executable Files
  20. PHP: PHP Manual: Function Reference: Other Services: Memcache
  21. PHP: PHP Manual: Function Reference: Other Services: Memcached
  22. memcached
  23. Optimize TurnKey Linux for ZurmoCRM
  24. Optimize Asustor ADM for ZurmoCRM
  25. Optimize QNAP QTS for ZurmoCRM
  26. Optimize Synology DSM for ZurmoCRM
  27. ServerFault: PHP segmentation fault when using more than 128M
  28. ServerFault: Jason
  29. PHP
  30. PHP: PHP Manual: Appendices: php.ini directives: memory_limit
  31. TurnKey Linux Configuration and Executable Files
  32. OpenSuSE Configuration and Executable Files
  33. Asustor ADM Configuration and Executable Files
  34. QNAP QTS Configuration and Executable Files
  35. Synology DSM Configuration and Executable Files
  36. apache
  37. MySQL
  38. SugarCRM: Forum: XCache and SugarCRM – Any Advice, about to try it out
  39. SugarForge.org: How to enhance SugarCRM Performance? (v1.0)
  40. SiteGround: Knowledge Base: How to optimize SugarCRM for better performance?
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s