Can a (hw) loadbalancer check on HTTP status codes

hardwareload balancing

We're currently developing several websites using 2 web front-end servers (using apache and tomcat/jboss) with a loadbalancer in front of them. Since I'm a programmer, not a sysadmin, I can only guess what a decent hardware loadbalancer is capable of. I was wondering if a hardware loadbalancer can check on HTTP status codes, so the traffic would be redirected to only one server if the other one is down for maintenance (which now sends out a 503 HTTP error code).

Thanks!

Ben

Best Answer

Yes, practically all load balancers will do that. Most load balancers will also go further, and take a dead HTTP server out of service if it:

  • just times out or does not respond to TCP/IP
  • does not respond with valid HTTP within a set timeout, i.e. the TCP socket is connected but no HTTP, or HTTP sends a 200 OK but does not answer to HTTP OPTIONS etc.
  • if a specific status page does not contain a specific pre-set text string / does not match a preset MD5 hash. This is very handy for checking that the connection to the database is up (by programming a simple page which reads some data from the DB and displays it).

Edit: Addtionally, good load balancers have an easy way of setting a server into maintenance mode, i.e. the load balancer will stop sending new requests to that server, and will show in its UI when the server stops having traffic. Then you can freely perform the required maintenance on the server, before putting it back into service.

Additionally, most load balancers have a concept of a emergency server, i.e. if all regular HTTP servers are down, all traffic will be sent to a designated emergency server on your LAN which can then deliver a static "we're down for maintenance, check back later" page.

Coyote Point makes nice low-end load balancer appliances IMHO. There are many other vendors of low-end load balancers; Barracuda is one example. 'Low-end' is not negative in this context, it is just that the market is split into two:

  • 'low-end' vendors, who typically charge at most 20000 USD or so for their top products, and sell both directly and via small resellers.
  • 'enterprise vendors' like F5, Cisco, Foundry etc who may charge much more, and use a premium brand sales model.

If the OP has no sysadmin skills in-house, then purchasing a low-maintenance appliance makes a lot of sense. If you're willing and capable of setting up a Unix server, then take a look at this post. If you're on Microsoft Windows, then Microsoft Application Request Routing version 1 or 2 (beta) could be good solutions (I don't know them so well).