Hi! I write on behalf of Immobiliare.it, an Italian company leader in the real estate services and advertising market, we are using almost exclusively HAProxy for our load-balancing. In particular, we are using a patched version of HAProxy to balance requests to our cache servers. Long story short, we set up an improved version of the replicated, sharded cache pattern: each server both maintains its cache entries and a subset of entries of the other servers. Doing that, we ensure that a request for an entity can be sent either to its server (the one provided by the HAProxy's consistent hashing algorithm) or to its second server (the next server in the tree after the one chosen by the consistent hashing algorithm), so we can ensure that all the entries are still present if a single server crashes, and when many server crashes, only a little subset of those entries were lost. To do that we created a new consistent hashing algorithm (consistent-2x) that, once found the server that has to serve the request, also looks for another server in the tree (which should reside on different host) and sends the request either to the first or to the second in a random fashion, still considering server's weight.

The whole implementation of the above mentioned algorithm requires the following changes:

the tree we build is not driven by weights but it is static, so if a server crashes HAProxy does not re-balance requests (consistent-2x algorithm does this); weights are used instead to chose one of the two selected servers; servers' IDs should follow a given pattern: servers on the same machine should give the same result when their IDs is divided by 1000; consistent-2x algorithm. We are looking forward to hearing from you. We wish our contribution could be useful for as many people as possible.

Best,

Dario Di Pasquale

Immobiliare.it

Reply via email to