I would use mod_perl for this. It's well-tested, scales, has all the hard networking stuff already done for you, etc. You can even replace HTTP with a custom protocol if you need to in mod_perl 2, but I wouldn't do that if you can avoid it. To answer your question, if the client disconnects you can detect it, but unless you actively check and stop, execution just continues. This is in the documentation.