CARP

CARP is an algorithm and not a protocol per se. It was designed to address a particular problem: how to achieve efficient and scalable load balancing while maximizing hit ratios and minimizing latency. It is useful in situations where a proxy caching service consists of a number of machines tightly clustered together. For example, a large ISP may need five web caches to handle all the traffic from their customers. Given a cache cluster or array, how can we distribute the load among the members?

One technique is known as DNS round-robin. Each cache has its own IP address, but all are listed under a single hostname. For example:

$ORIGIN us.ircache.net.
bo                      IN      A       192.52.106.30
                        IN      A       192.52.106.31

A DNS server, such as BIND, cycles the order of the addresses for every lookup. When one client asks for bo.us.ircache.net, it receives the answer (192.52.106.30, 192.52.106.31). The next client that asks gets the same addresses in a different order: (192.52.106.31, 192.52.106.30).[31] Clients normally try the first IP address in the list. They’ll try the next address only if there is a failure with the first. With this technique, each cache should receive about half of the the requests.

The drawback to this approach is that client requests are randomly assigned among the member caches. One client may request http://www.web-cache.com from cache A, while another requests the same URL from cache B, thereby missing the opportunity for a cache hit. Of course, the caches can use ICP among themselves ...

Get Web Caching now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.