magento's imagine ecommerce conference 2011 - hosting magento: performance and stability

11
Hosting Magento Performance and Stability

Upload: magentoimagine

Post on 28-Nov-2014

1.410 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance and Stability

Hosting Magento

Performance and Stability

Page 2: Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance and Stability

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's Imagine eCommerce Conference 2011 - Hosting Magento: Performance and Stability

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's Imagine eCommerce Conference 2011 - Hosting Magento: Performance and Stability

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's Imagine eCommerce Conference 2011 - Hosting Magento: Performance and Stability

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's Imagine eCommerce Conference 2011 - Hosting Magento: Performance and Stability

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's Imagine eCommerce Conference 2011 - Hosting Magento: Performance and Stability

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's Imagine eCommerce Conference 2011 - Hosting Magento: Performance and Stability

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's Imagine eCommerce Conference 2011 - Hosting Magento: Performance and Stability

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's Imagine eCommerce Conference 2011 - Hosting Magento: Performance and Stability

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's Imagine eCommerce Conference 2011 - Hosting Magento: Performance and Stability

Thank you