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

What is an open source load balancer that allows for hash based balancing? I would like to do hash based load balancing of a URL but first remove the user specific arguments from the URL. Basically want to increase Varnish's cache performance by adding URL to node persistence.


Where the hash would be based on:

  • Edited for clarity, bias, and URL modification. *
share|improve this question
Can you re-write this so that it is less subjective? Questions asking for the 'best nnn' tend to get crappy answers. Instead please be more specific about your situation and ask for solutions and request that they support their suggestion with factual detail. – Zoredache Sep 29 '11 at 1:44
Edited, my apologies. – CarpeNoctem Oct 10 '11 at 23:13
up vote 3 down vote accepted

"Best" is in the eye of the beholder, so this answer is only an approximation.

HAProxy is great if:

  • You need the highest possible per-machine load balancer performance.
  • You don't need SSL termination on the load balancer.
  • You value reliability and version stability highly.

nginx is great if:

  • You want more pre- and post-processing of the HTTP stream on the load balancer, such as GZip compression or SSL termination.
  • You value connection buffering, where the load balancer will buffer content between the clients and the backend servers (useful for some 'scripting language' backends which have a high connection overhead).
share|improve this answer
Would either of these allow a hash to be created based on a certain portion of the URL? For example: with the hash based on the url with the "usertoken" arg removed. – CarpeNoctem Oct 10 '11 at 23:10
haproxy worked out beautifully, thanks. – CarpeNoctem Oct 28 '11 at 19:49

HAProxy and nginx are both able to load balance according to a hash of the requested URL.

share|improve this answer
What nginx directive achieves URL-hash based load balancing? I cannot find one, except the third-party module ngx_http_upstream_consistent_hash, which is unmaintained and seems to work only with memcache backends not HTTP – rmalayter Mar 19 '12 at 17:08

Varnish is a capable load balancer. It does HTTP/1.1 against the client and the backend, has health probles, can do target URL hashing. You just turn off the caching if you plan on doing caching in a separate tier.

share|improve this answer

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.