PHP Caches and Accelerators
From SugarCRM Wiki
PHP accelerators are a great way to get more performance out of your hardware. There are several major components to PHP accelerators. All of them support caching of the parsed PHP files. Sugar uses over 100 files per round trip, so loading parsed files provides a huge performance advantage. Most of them also have some level of external data caching (Sugar has an API to leverage them) and File Transfer Services (Sugar does not leverage this out of the box).
They come in a wide variety of flavors...Here are the top four that Sugar is tracking:
Contents |
APC
- External Cache API integrated from 4.5.0e on.
- Very fast op-code cache
- Open Source and Part of Pear/PECL http://pecl.php.net/apc
- Sample configuration overview: http://devzone.zend.com/manual/view/page/ref.apc.html
- Please note: Sugar uses a lot of source files. The standard 30 MB memory size is too low for running Sugar. Add these lines at the end of php.ini:
- apc.shm_size = 64
- apc.shm_segments = 2
Zend Platform
- Currently used by Sugar On-Demand.
- Very fast op-code cache
- Integration with external cache API as of 4.5.0 http://www.sugarcrm.com/forums/showthread.php?t=15523
- Good clustering support and management
- Zend Download Server for Offloading static content and file transfers
- Commercial Product http://www.zend.com/products/zend_platform
Memcache
- Very Fast External Cache from 5.0 on
- No op-code cache
- May be used in combination with an op-code cache
- Information on installation and configuration can be found at http://us3.php.net/manual/en/memcache.installation.php
eAccelerator
- op-code cache
- not yet supported as an external cache in Sugar.
- Some issues with PHP 5. Cache support is not working well. Acceleration is good.
- Php-eaccelerator on Fedora Core 5, Php 5.1.4, Apache 2.2.2, breaks the Email and EmailTemplate EditViews. (this is a FC5 specific problem). -- thanks to David O'Keefe
- Open Source http://eaccelerator.net/
Zend Optimizer
- Optimizes the generated byte codes
- Not an op-code cache
- executes another 40% to 100% faster than with out any optimizer
- used in Zend Platform above
- Free Product http://www.zend.com/products/zend_optimizer
Disabling External Cache (SugarCRM 5.1.0a +)
Sugar automatically enables external cache support once it detects a supported external cache method. The order of this detection is Zend, Memcache, APC. If you have multiple caches enabled it will utilize the first one detected. If you wish for it to use a different cache you may set the following config settings to disable an external cache.
$GLOBALS['sugar_config']['external_cache_disabled_apc'] = true; //if set to true will disable apc external cache.
$GLOBALS['sugar_config']['external_cache_disabled_memcache'] = true; //if set to true will disable memcache external cache
$GLOBALS['sugar_config']['external_cache_disabled_zend'] =true; //if set to true will disable zend external cache
$GLOBALS['sugar_config']['external_cache_disabled'] = true; //will disable all external caching.
Untested
XCache
- New op-code cache by the people that made Xdebug and lighthttpd
- http://trac.lighttpd.net/xcache/
