Search This Blog

Wednesday, May 5, 2010

Release It! - 13.3 Load Balancing

Scaling Horizontally involves balancing the load amongst a pool of identically configured servers.  There are multiple load balancing techniques that can be used.

DNS Round-Robin
This technique simply associates several IP addresses with the service name.  Each IP address points to one of the servers in the pool.  Over time, DNS should have "pointed" the clients evenly across the servers in the pool. This technique usually implies that the servers can be directly reachable from the client -- no hiding behind firewalls.  Once the client connects to a server, there is no way to migrate him to another server.  Also, there is no guarantee that the load is evenly spread across the cluster because each client's processing requirement is different.  All we can gurantee with this technique is that the number of connections has evenly been distributed. DNS round-robin load balancing is inappropriate whenever the calling system is another long-running enterprise system. Anything built on Java will cache the first IP address received from DNS, guaranteeing that every future connection targets the same host and completely defeating load balancing. Ouch!
 
Reverse Proxy
A Reverse Proxy, such as Squid, routes each application request to one of the servers in the pool. The web and application servers in the pool need to be reconfigured to generate URLs in terms of the proxy and not the server itself, since the proxy is the gateway into the pool.  You can also configure the proxy to be a cache for static web content.  Since the proxy handles each request into the system, it can quickly become over taxed and become a bottle neck.  The commonly used proxies are not aware of the health of the individual servers and will happily route a request to a sick or down server.  Not good.

Hardware Load Balancer
Hardware load balancers are specialized network devices that serve a similar role to the reverse proxy server. Because they operate closer to the network, hardware load balancers frequently provide better administration and redundancy features. The load balancer removes dead servers from its service pool, directing connections to the healthy ones. The big drawback to these machines is—of course—their price.

No comments:

Post a Comment