object references/memory access

"Martin v. Löwis" martin at v.loewis.de
Sun Jul 1 17:59:07 CEST 2007

> If this is a Linux server, it might be possible to use the SCM_RIGHTS
> message to pass the socket between processes.

I very much doubt that the OP's problem is what he thinks it is,
i.e. that copying over a local TCP connection is what makes his
application slow.

> That would require a
> patch to Python's socket library which I've never gotten around to
> writing but it's been on my want-to-do list for a long time.  There is
> something similar for Solaris and probably for *BSD.  I've been under
> the impression that this is how preforked Apache distributes requests
> between processes, but I never got around to checking.

No, it doesn't. Instead, it is the operating system itself which
distributes the requests: the parent process opens the server socket,
then forks the actual server processes. They all do accept, and
the operating system selects an arbitrary one for the next request.
That process returns from accept, so for the next incoming
connection, one of the remaining processes will be selected.


More information about the Python-list mailing list