Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Varnish already support load balancing HTTP 1.1 and Web Socket requests, e.g. https://www.varnish-cache.org/trac/wiki/LoadBalancing

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
1  
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
add comment

1 Answer

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
2  
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
add comment

Your Answer

 
discard

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.