Since I got married last year, I haven't had much motivation to blog. The good news is that since the previous year, I've accumulated a list of accomplishments and experiences that i feel are worthwhile sharing.
Recently, my company implemented our first mod_backhand implementation. Mod_backhand is a load-balancing and clustering solution that runs on Apache. Let's say you have 3 web servers that you need to load balance in a cluster. When a server goes down, it will auto-detect that server is down and route subsequent http requests to other servers. You can buy a load-balancing box such as Cisco Redirector, or roll your own package using Linux, Apache 1.3 and mod_backhand.
The mod_backhand load balancer is basically a Linux system with Apache 1.3 (httpds) with the mod_backhand patches installed. The load-balancer also supports redirects and https. Load balancing uses the Apache virtual directory mechanism, so you can configure different load balancing behaviour for different applications on a directory basis.
The nice thing about mod_backhand is that it autodetects servers going up and down in the cluster, with no additional configuration required. All web servers in the cluster need to broadcast that they are alive and available on the cluster at regular intervals. So if you want to add another web server to the cluster, you just need to install the backhand broadcasting service and start it on the server, and the load balancer will pick it up. CPU and load information is also broadcast to the load balancer, so the load balancer can make an intelligent guess as to which web server to pass the http request to.
There are some issues that you need to be aware of:
- No support of https on the internal network. Communications between the web browser and load-balancer can use https but not between load-balancer and web server. So if you have confidential information and you don't trust your internal network, you need to setup another layer of encryption on top of that (e.g. SSH tunnel). That's what we did for our login system.
- The load balancer, like any other system in the network, becomes another point of failure. If you want total redundancy, one method is to have multiple mod_backhand load balancers, and round-robin DNS the load balancers.
- AFAIK, automatic failover to another server of a http request if the 1st web server goes down is not supported.
- There is Windows support (for the web servers in the cluster, not as a load-balancer) thanks to Rob Butler, but you currently need Visual C++ expertise as the binary "NT Backhand Broadcaster" doesn't work out of the box anymore with mod_backhand. There are patches in CVS but no existing binary download. As a service to the community, I have compiled my own: NT Backhand Broadcaster.
- Keep-Alives reduce the availability of the load balancer, as web clients can lock a mod_backhand process for unreasonable amounts of time. You need to change your Keep-Alives on to a low value (eg. 1 second), and if possible, move your static HTML and images to the load balancer (which is just Apache after all).
- Your web page URLs need to be relative URLs of course. The one exception is https, which needs to use the address of the load-balancer.
Additional Windows Notes The Windows Registry settings for Backhand Broadcaster are a bit obscure. Here is a sample config:
HKEY_LOCAL_MACHINE\SOFTWARE\CerebraSoft] [HKEY_LOCAL_MACHINE\SOFTWARE\CerebraSoft\Backhand_Broadcast] "Arriba"=dword:28213950 "numCPU"=dword:00000002 [HKEY_LOCAL_MACHINE\SOFTWARE\CerebraSoft\Backhand_Broadcast\BroadcastParams] "HostName"="Windows Server 1 BHB" "ContactIP"="192.168.0.121" "SendIP"="192.168.0.255" "SendPort"=dword:0000115d "ContactPort"=dword:00000050 "SendTTL"=dword:00000001
The ContactIP is the IP address of my Windows server running BHB: 192.168.0.121 The SendIP is the broadcast IP for the subnet (not the IP address of the load-balancer).
Sometimes the first time you run NT Backhand Broadcaster, it will fail to calculate Arriba (a benchmark measuring the power of your server) and just die. You need to manually enter the Arriba value yourself in the registry. Just use the above example value if you aren't sure what to do.
The load-balancer provides a page to check out the status of all servers in the cluster, typically http://load-balancing-server/backhand/
Lastly, if you still cannot get it working, check out the Windows Event Log (Applications), as errors and status messages are logged there.

