-1

I am wondering what it the best (most stable with the least memory footprint) arrangment for a busy php+mysql app?

request  > Varnish > Apache
requests > Varnish > Nginx > php5-fpm
requests > Varnish > Nginx  > Apache
requests > Nginx > Varnish  > Apache
something else

I appreciate your hints or references to relevant benchmarks. Thanks

alfish
  • 3,027
  • 15
  • 45
  • 68

1 Answers1

2

Well, I'm not sure how anyone is reliably advising you without knowing ...

  1. Is this going to be for 1 website, or multiple websites (reselling)?
  2. What is the full exact server specification?
  3. What are your targets for traffic (hits, pageviews, bandwidth commitment)?

The advice we give to our customers ...

If you need to re-sell hosting

Nginx > Apache > PHP-FPM

That keeps .htaccess support for your customers, security (chroot/multiple php.inis) from PHP-FPM and static file performance from Nginx.

If it is just for you

Pound > Varnish > Nginx > PHP-FPM

This gives you SSL unwrapping from Pound, static and dynamic (ESI) caching from Varnish, un-cached static content from Nginx and dynamic content from PHP-FPM

If you've got no real experience with Varnish

Apache > PHP-FPM

Our typical architecture is ...

If it helps, for web clusters, we typically use:

lvs (initial ssl load balancing)
    -> pound (ssl-unwrapping) 
    -> varnish (caching) 
    -> haproxy (load balancing) 
    -> nginx (static content) 
    -> php (dynamic content) 
    -> mysql (db)

The truth is that you can do a lot more damage than good with Varnish if you do not set it up properly (cached private sessions, unwanted cookie un-setting). The same applies to Nginx.

Have a read of this http://www.sonassi.com/knowledge-base/magento-kb/mythbusting/why-shouldnt-i-use-nginx-for-magento/ and this Building an SSL server farm

My final advice, consult a professional - its money well spent.

Ben Lessani
  • 5,174
  • 16
  • 37
  • Thanks mate. Really helpful answer. Just not sure why you choose Apache > PHP-FPM instead of nginx > PHP-FPM – alfish Sep 24 '12 at 20:19
  • It just depends on the use. Like I described above, different configs are more suitable for different situations. As a web host, Apache is far more suitable on our shared/Magento PaaS platform - and the performance differences are nil. On our Magento MicroCloud architecture, we used Nginx and PHP-FPM. It all comes down to suitability. Don't get caught up in the hype about which web server to use, read this http://www.sonassi.com/knowledge-base/magento-kb/mythbusting/why-shouldnt-i-use-nginx-for-magento/ – Ben Lessani Sep 24 '12 at 22:09