[Web-SIG] Starting Web Servers using socket FDs
tarek at ziade.org
Tue Jun 5 11:30:37 CEST 2012
I am doing this experimentation where the WGSI server is not started
with an host/port or a unix socket, but rather a FD value,
corresponding to a socket already bound by the parent process.
The server would then just accept new connection on the FD, using
socket.fromfd() to get a socket object back,
and forget about all the binding work.
Here's a prototype based on wsgiref :
The goal I have is to be able to just spawn web workers using subprocess
and take care myself of the process
management part. I wrote a blog post on my motivations here :
if you want more background.
Anyways, the idea I wanted to bring here was the following:
most web servers out there support regular host/port or Unix Socket,
which are usually the "unix:" prefix followed by a path on the system.
What if web servers had these two standards *and* a new one which would
be a "fd:" prefix.
For instance, we would start server foo with:
$ foo --fd:12:localhost:8080
Where 12 is the fd number the foo server would use for getting the
socket, and "localhost:8080" would just be there
as an information to be able to fill some WGSI headers that requires it.
From there I could just spawn "foo" and pass to it socket.fileno()
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Web-SIG