Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Is it possible to have a high availability setup, in this example going to 2 webservers, and allow it to fail over without dropping connections?

I have two webservers that are using comet, an HTTP technique where you have long-lived HTTP connections. I have two loadbalancers in front running heartbeat with a shared IP. If one of these front-end servers go down, all connections are lost.

I've heard there is a technique, perhaps with HAProxy, where the two servers keep track of the state of connections and if one of the servers fails, the other takes over, without dropping connections. I can't seem to find out how this is done.

share|improve this question
    
I've skimmed it and didn't see what I was looking for, I'm going through it again now. Care to point me to the right chapter? –  John Smith Jun 1 '11 at 13:50

4 Answers 4

I've also researched how to load balance long-lived telnet connections. Even the big expensive load balancers like F5 don't seem to support "migrating" an open tcp connection from a dead server to another server. I considered capturing the handshake and connection packets from telnet on our load balancer, then replaying those if it had to reconnect to another server. The issue is that every application (telnet, comet, ssh, etc) has a different set of rules for initiating the connection and logging in. Without coding for each application, I don't know of a load balancer that can do such a thing.

In the end, I gave up and invested the time reconfiguring the client application to reconnect to the service in a way that was transparent to the user.

For comet, I suggest you configure the web service to reconnect when it detects a disconnect. This article about HTTP Streaming on ajaxpatterns.org has a code snippet for detecting a disconnect.

Once comet can reconnect, then your current load balancer setup should function as expected.

share|improve this answer

You can't do it through HAProxy, because that is on the wrong OSI layer - at the HTTP level, instead of at the TCP level. Some of the lower layer load balancers have a feature that may be able to accomplish what you are talking about, at least for many connections, by passing information back and forth from the active node to the passive node. Look at the Linux Virtual Server (LVS) combined with a service level daemon like ldirectord to accomplish what you are looking for.

share|improve this answer
    
HAProxy does support balancing at the TCP level. Not saying that HAProxy can do what the OP asked, but it can TCP balance. –  Richard Benson Jun 29 '11 at 11:52

This isn't really possible. It would be a much better idea to program the client to tolerate server failure and automatically reconnect. This would allow for single server failure, and potentially site failover as well (if a whole site failed).

Hypothetical land: It may be possible to create a client-server dynamic where the intermediate load balancer or proxy could automatically establish a new connection to the failover server, and forward any new traffic to/from the client to that new server. The server would have to be somehow aware of the client's session information, perhaps by storing the session information in shared storage. Alternately the client could be programmed as such to tolerate a server that does not have its prior session information (at long as we're modifying the client we might as well do paragraph 1 and make it simply reconnect to the new failover server). Such a configuration would almost certainly be more complicated and error prone than it's worth.

share|improve this answer

Using vmwares fault tolerance on esx/esxi can achieve this, but there are a lot of limitations to it as well.

Sorry for not linking, on my phone in the car on my way home :-).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.