So you’re writing a large web application, with multiple web servers on the front-end waiting to serve your users. First thing you do is start to think about a Load Balancing solution, be it a hardware solution such as a Coyote Point Systems box, or even a ‘software’ solution, such as Round Robin DNS. Now, with the advent of ‘Web 2.0’, we’re slowly seeing another ‘solution’ starting to gain some traction; Client Side Load Balancing.
To put it simply, we let each ‘client’ decide which server to connect to. Each client has a list of all available servers, and randomly selects one and attempts to exchange data. If the client receives a message indicating the server is busy, or no response at all within a set period of time, it moves to another server on the list until it can complete its transaction. Lei Zhu, a contributor at Digital Web, has this to say about the advantages of such a solution:
- Distribute loads among a cluster of application servers. Since the client randomly selects the server it connects to, the loads should be distributed evenly among the servers.
- Handle failover of an application server gracefully. The client has the ability to failover to another server when the chosen server does not respond within a preset period of time. The application server connection seamlessly fails over to another server.
- Ensure the cluster of servers appears to the end user as a single server. In the example, the user simply points a browser to http://www.myloadbalancedwebsite.com/. The actual server used is transparent to the user.
A big advantage to such a solution is that you don’t need to spend money on a hardware device, at least in the short-term. You can have some code on your back-end that monitors the web servers and removes any unavailable servers from the server list sent to each client.
Another advantage that Lei points out is that the web servers can be distributed anywhere geographically. Sure, this can be done with a load balancer, but it’s a far trickier and complicated setup then just having to change a server entry in a file sent to each client.
Lei’s article also includes a short write-up of an application, Voxlite, using such a design.
Overall, while I still have some doubts regarding the scalability of such a solution, it’s an interesting use of Web 2.0.