Passing file descriptors in Python?
Skip Montanaro
skip at mojam.com
Sat Oct 2 00:27:48 EDT 1999
Neil> On Sat, Oct 02, 1999 at 02:12:28AM +0000, Dan wrote:
>> Has anyone attempted to pass file descriptors from one process to
>> another under using Python on Linux? I want to build a little web
>> server that accepts connections and hands them off to child processes
>> exactly like Apache does.
Neil> I don't know too much about how apache works but fork works just
Neil> fine with Python:
Unfortunately, that's not what Apache does. Apache pre-forks a bunch of
children. The parent then (through some clever magic supported on a number
of Unix variants which I don't understand) passes the open file descriptor
to an already forked process. You can set a limit on the number of requests
a child will handle before exiting. Set it high enough and (practically
speaking) you won't notice any fork overhead.
Skip Montanaro | http://www.mojam.com/
skip at mojam.com | http://www.musi-cal.com/
847-971-7098 | Python: Programming the way Guido indented...
More information about the Python-list
mailing list