in reply to Re: Re: Daemon with Net::Daemon
in thread Daemon with Net::Daemon

I dislike the idea of duplicating the entire process for something simple like printing a response to the socket. Fork is know as a heavyweight process for a reason. (yes, I know that copy-on-demand alleviates this)

I also rather like showing off an example of one of the other ways to do it, which becomes useful in some of the situations where a fork is not.

As ever, there's more than one way to do it. Fork can be effective and simple, but IO::Select allows one some better control over child processes.

I've never actually profiled the code, but I'd imagine that fork works pretty good on Unix, where it's integral to the OS. (Ish, because it becomes a little fuzzier when you're talking about forking perl, and the interpreted code) I'd not be so sure about doing so on Windows.

Has anyone tried a benchmark of the relative methods?