3

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?

  • 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
3

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.

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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