magento imagine ecommerce conference february 2011: optimizing magento for performance

11
Hosting Magento Performance and Stability

Upload: varien

Post on 02-Nov-2014

3.022 views

Category:

Technology


3 download

DESCRIPTION

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.

TRANSCRIPT

Page 1: Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Performance

Hosting Magento

Performance and Stability

Page 2: Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Performance

Typical Magento Cluster

Web nodes Database servers Load balancers and cache servers

Some 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?

Page 3: Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Performance

Web Nodes

Web nodes are CPU-bound, I/O is not very important

Code and images needs to be separated. Why NFS is a bad idea.

Use PHP accelerator (APC, eaccelerator, xcache)

The most important APC settings

Apache or nginx + fast CGI?

Dedicated image servers

Dedicated admin node

Session storage

Page 4: Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Performance

Apache vs Nginx + FastCGI

Apache

+ Pretty standard and well tested with Magento

+ .htaccess support

– Using one fork per connection for static and dynamic files (if prefork mpmis in use)

– Uses a lot of memory for useless functionality

nginx + FastCGI

+ Static files are served very fast

+ Clean architecture, application server is separated from HTTP server

+ Ability to use built-in load balancing, caching, reverse proxy and SSL offloading

+ Nginx now hosts nearly 7.50% (20.5M) of all domains worldwide

Page 5: Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Performance

Web Load Balancing Schemes

1. 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 protocol

3. Varnish as load balancer and proxy server for staticimages, apache or nginx+fcgi as application nodes

4. Other options (hardware load balancers, ha-proxy,lighthttpd, etc.)

Page 6: Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Performance

PHP FastCGI Process Manager (PHP-FPM)

Adaptive process spawning

Basic statistics (ala Apache’s 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...

Page 7: Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Performance

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)

Page 8: Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Performance

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, investigate

Solid State Drive (SSD)

Do not forget to enable slow query log

Setup realtime monitoring tools (mytop, innotop) before server goes

down

Configure slave in Magento local.xml

Do not use mysqldump on production servers

Page 9: Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Performance

Monitoring

It is very important to setup monitoring before launching the 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...

Page 10: Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Performance

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

Page 11: Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Performance

Thank you