views:

236

answers:

2

What happens when Tomcat fails during the upload process. Will it simply throw a 50X error. Is it possible to gracefully handle the server failure and forward the rest of the request to a different server.

+1  A: 

I don't know about tomcat specifically, but this is a TCP connection. If the upload fails, then the TCP connection would drop. The client would cease the upload.

If the client has retry capabilities that allow it to restart an upload at a given position in the file, then it could be restarted with a new server. In general this is not a common capability of web clients, many sites with large file upload have flash clients that integrate upload resumption.

If you want to do this with more transparency, then you can have a web frontend that watches the TCP streams and maintains TCP state. If it observes a failure, it could transfer that state to a new server, and pass the stream to it to continue the upload as if the TCP stream was never broken in the first place.

It isn't trivial though, and does introduce a new point of failure. The main advantage is it'll work with any client, as long as the client doesn't drop the connection (it can only resolve server failures on your side, not resume downloads broken at the client side)

Adam Davis
A: 

It sounds like that you need some kind of a load balancer/failover. Basically, a machine that acts as a front-end to several computers - it listens to traffic from outside, and forwards it to nodes (computes) inside a cluster. If one node fails, it knows how to reroute the traffic to another computer. This would, then, require that all nodes would be in sync with each other, so that such transactions as TCP transmissions can be continued without skipping a beat.

This is most commonly implemented in hardware rather than software. Not very trivial to implement, in any case.

Henrik Paul