magento imagine ecommerce conference february 2011: optimizing magento for performance

Download Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Performance

Post on 02-Nov-2014




3 download

Embed Size (px)


This presentation was the basis for a panel discussion about how to optimize Magento for maximum performance. The panel was part of the Day 1 technical breakout sessions during Magento's Imagine eCommerce Conference, held February 7-9, 2011 in Los Angeles.


  • 1. Hosting Magento Performance and Stability
  • 2. Typical Magento Cluster Web nodes Database servers Load balancers and cache serversSome things to investigate before start:1. Number of users2. Hardware3. Operating systems, hosting company4. Session and cache storages (memcached, apc, etc.)5. Does it make sense to use clouds or virtualization?
  • 3. Web NodesWeb nodes are CPU-bound, I/O is not very importantCode and images needs to be separated. Why NFS is a bad idea.Use PHP accelerator (APC, eaccelerator, xcache)The most important APC settingsApache or nginx + fast CGI?Dedicated image serversDedicated admin nodeSession storage
  • 4. Apache vs Nginx + FastCGIApache nginx + FastCGI+Pretty standard and well tested with + Static files are served very fastMagento + Clean architecture, application server+ .htaccess support is separated from HTTP server Using one fork per connection for + Ability to use built-in load balancing,static and dynamic files (if prefork mpm caching, reverse proxy and SSLis in use) offloading Uses a lot of memory for useless + Nginx now hosts nearly 7.50%functionality (20.5M) of all domains worldwide
  • 5. Web Load Balancing Schemes1. Nginx as HTTP server + for static files + apache as phpbackends (reverse proxy scheme, mod_rpaf)2. Nginx as HTTP server and load balancer + PHP scripsusing FastCGI protocol3. Varnish as load balancer and proxy server for staticimages, apache or nginx+fcgi as application nodes4. Other options (hardware load balancers, ha-proxy,lighthttpd, etc.)
  • 6. PHP FastCGI Process Manager (PHP-FPM) Adaptive process spawning Basic statistics (ala Apaches mod_status) Advanced process management with graceful stop/start Ability to start workers with different uid/gid/chroot Emergency restart in case of accidental opcode cache destruction Support for a slowlog And much more...
  • 7. Session Storage Session handlers (file, memcache, memcached) Best options for single server and cluster Memcache different clients (memcache, libmemcached) Problems with pecl-memcache 2.xx, session locking Other notes (replication)
  • 8. MySQL Server Setup replication Use MySQL 5.1 + INNODB HA Plugin or 5.5 or Percona XtraDB server Use row based based replication (5.1+ only) Use big enough innodb pool Storage different drives for the binary log and data, investigateSolid State Drive (SSD) Do not forget to enable slow query log Setup realtime monitoring tools (mytop, innotop) before server goesdown Configure slave in Magento local.xml Do not use mysqldump on production servers
  • 9. MonitoringIt is very important to setup monitoring before launchingthe web service Nagios and CACTI a perfect open source solution Services to monitor Apache (traffic, availability) MySQL (requests per count, replication, type of the requests, cache statistic, number of active connections, time of the longest reqest) Memcached (eviction count, hit rate) System: interface speed, I/O stat, CPU usage, etc. ATOP powerful SA replacement, very recommended NFS shares if used More sensors...
  • 10. Conclusion Most of the recommendations for Magento are typical forany high-loaded AMP project Web is changing fast. It is recommended to investigate newtechnologies and use modern tools It does make a sense to setup all monitoring tools beforeany problems and do regular system audit Magento is always working to improve the speed andprovide new options for safe and reliable hosting
  • 11. Thank you