How to arrange web servers with Varnish? [closed]

Posted on

How to arrange web servers with Varnish? [closed] – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about apache-2.2, nginx, web-server, cache, varnish.

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.

Solution :

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 and this Building an SSL server farm

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

Leave a Reply

Your email address will not be published. Required fields are marked *