Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Varnish already support load balancing HTTP 1.1 and Web Socket requests, e.g.

Since we already using Varnish for caching purpose, are there any benefit if we add nginx or ha proxy in front of Varnish for load balancing, or should we just use Varnish for load balancing?

Seems this approach is quite rare, and why?

share|improve this question
What problem are you trying to solve, and why do you want to make your setup more complex? – Michael Hampton Oct 9 '12 at 16:10
up vote 3 down vote accepted

Disclaimer : I'm a varnish fanboy.

I'm not aware of people putting nginx in front of varnish : they sometimes do the opposite as nginx is supposed to be a lightweight webserver.

Unless I have a good reason not to do so, I would do the load balancing with varnish.

However using varnish for load balancing can be tricky :

  • You don't want varnish to be single point of failure so you think about 2 servers at least.

  • With active active setup you'll have to deal with cache consistency problem and set url purge in case of update.

  • With active passive setup, you'll have to deal with cache stampeding.

share|improve this answer
The fact that varnish does not do https, while nginx does, is the reason I put nginx in front of varnish sometimes. – arjarj Oct 9 '12 at 18:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.