Magento Shopping Cart on Litespeed - Smoking Apache
Does MagentoCommerce’s performance keep you up at night? Are slow page loads and high server usage tainting your online presence. Drop Apache!
My recent interest in the open source e-commerce solution MagentoCommerce has led me down some interesting paths. Magento is a very large e-commerce solution. Its excellent design makes Magento the most flexible shopping solution I have ever used. Did I mention its also free! Mmmm free beer.
Magento is so large that many shared and dedicated hosting solutions will come to a crawl. PHP is a great language (feel free to flame in the comments section) but when you look at the OOP scheme Magento is built on, most server implementations will choke. Any production Magento store requires every little hack available to a server admin. Magento hits the database server - HARD, hits the php engine - HARD, hits the disk drives - HARD, etc… Every peice of the server powering Magento will get taxed.
Here is a list of some quick optimizations for any server setup looking to run magento (most of these bump up wordpress performance too!)
- Opcode Caching
- XCache
- APC - Alternative PHP Cache
- Zend Optimizer
- eAccelerator
- Turn off all logging
- Use FastCGI if possible
Here is a quick summary of what I have done to maximize performance of my Magento installations.
- Use Litespeed Web Server
- Compile PHP to work through the LiteSpeed API (LSAPI)
- Create memory partition to store high IO Magento folders (”/var/cache” etc…)
- Run XCache
Ballpark performance numbers: System specs: P4 2.4ghz, 512mb ram, Ubuntu 8.04 7200rpm 60GB hdd
Apache2+mod_php5 = >4 seconds average
Apache2+php5 as fastcgi = >2 seconds average
Litespeed+php5 as fastcgi = >1 second average
Litespeed + php5 as lsapi = < .8 second average
Litespeed + php5 as lsapi + xCache + mem disk = < .3 second average
These were run using apache benchmark for 100 requests with concurrency of 3 (it isn’t a server box… give it a break)
Whatever litespeed has done with their lsapi module for php5… they definately did something right! I use Magento’s SOAP API to upload a product catalog of over 200 items. On apache it would take half a workday. With litespeed, the batch can finish in an hour.