Using Multiple Web Servers

Using Multiple Web Servers

Deploying multiple Web servers is a very simple way to handle traffic beyond the capabilities and capacity of a single server.

There are a couple of techniques for load balancing Web servers: DNS load balancing and appliance load balancing.

Using DNS load balancing is easy. Simply assign (through your firewall) a separate external IP address to each Web server on your network and then create an A record pointing to not one address but the pool of addresses you wish to make available.

For example, if you normally have a DNS entry that looks like this:

   $ORIGIN example.com.    www                      IN    A    192.168.111.222 

you could instead specify a pool of addresses for that same record:

   $ORIGIN example.com.    www                      IN    A    192.168.111.222    www                      IN    A    192.168.111.223    www                      IN    A    192.168.111.224 

When clients attempt to resolve the address of your Web server, their computer will be presented with an address at random from the pool of addresses you have specified. Accordingly, different clients will use different Web servers.

The fault with this technique, of course, is that after a Web browser has resolved the address, it doesn't resolve it again or at least, in most operating systems, it won't. It will cache it. This means one session equals one Web server. This isn't bad in itself. It isn't true load balancing, though, in that you could easily end up with a situation in which one Web server has to take the brunt of a truly intensive single session, whereas the other two servers sit there doing nothing.

A better approach is for every single request to be assigned to a different server; either in a round-robin fashion (that is, first server A, then B, then C, then back to A, then B ...)orby using more sophisticated techniques, such as actually analyzing how much traffic each server is handling at any given point.

Unfortunately, the downside of this technique is its further hardware requirement a load balancer. This appliance is responsible for accepting all HTTP requests and, instead of responding to them itself, passing them on by proxy to a Web server of its choosing and relaying the response back to the client on the Web server's behalf.

This works incredibly well and means that the full range of servers will be used on any given session, without the client machine's even being aware of it. Such load balancers are, however, often expensive as much as $20,000 at the time of this writing.

Free alternatives are available, though, and you may wish to experiment with OpenBSD, which can be configured to perform a degree of load balancing in this manner.

If you do deploy multiple Web servers, it's worth adopting a strategy for keeping any disk-based data store they might have in sync. Chapter 24, "Deployment,'' deals with such a strategy in more detail.



Professional PHP5 (Programmer to Programmer Series)
Professional PHP5 (Programmer to Programmer Series)
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 182
BUY ON AMAZON

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net