Optimising Magento for Performance
Following our earlier entry about installing Magento Enterprise, we thought it would be appropriate to follow up with some tips for getting more from your Magento installation. One of the major criticisms leveled at Magento is its speed; many complain that it is far too slow. In this article we'll go through some steps you can perform to fine-tune your server to allow Magento to run more smoothly and more quickly in a production environment. Our examples are geared at a Debian-based LAMP stack, but most can be adapted for other platforms.
Check out our tips on:
- Apache KeepAlive
- Alternative session storage
- and a bonus security tip!
Memcached is a distributed memory caching system that stores data retrieved from the database (or other data source) in memory, allowing repeat reads to retrieve the data from memory rather than needing to query the database again, greatly increasing the speed of web applications.
The first thing to do is install the memcache daemon and client libraries:root# apt-get update root# apt-get install memcached php5-memcache
To check if memcache is running, you can use the following command:root# ps -ef | grep memcached
You should ensure that the localhost has been added to the configuration, this can be done using grep as shown here:root# grep 127.0.0.1 /etc/memcached.conf
This should output -l 127.0.0.1 if localhost is included in the configuration. If not, add this line to the configuration and restart memcached:root# echo '-l 127.0.0.1' /etc/memcached.conf root# /etc/init.d/memcached restart root# /etc/init.d/apache2 restart
You need to create a PHP configuration file to include the module, which on a Debian-based system should be in /etc/php5/conf.d/memcache.ini:extension=memcache.so
Magento itself can also be configured to utilise some memcache optimisations built into the software. The following XML should be added to the /var/www/app/etc/local.xml file once it has been generated:...
Truncated by Planet PHP, read more at the original (another 27615 bytes)