Is mod_php walking on its road?

Igor Sysoev is at rambler-co.ru
Tue Oct 23 14:06:02 MSD 2007


On Tue, Oct 23, 2007 at 11:46:48AM +0200, Manlio Perillo wrote:

> Igor Sysoev ha scritto:
> >On Tue, Oct 23, 2007 at 05:02:09PM +0800, Steve Chu wrote:
> >
> >>    Does anybody here have a plan or already be writing a nginx
> >>version mod_php that similar with apache's?
> >>    If nobody does, we are try to write one.
> >
> >I do not think that built-in nginx PHP will be better than Apache's one.
> >For example, thttpd has PHP support, but all connections are blocked
> >while PHP processes an request.
> >
> 
> It should be possible to run the PHP code in a separate thread.
> This is what I'm planning to to with mod_wsgi, in order to support 
> "legacy" applications.
> 
> Here is the idea:
> 1) mod_wsgi creates a pipe and register the file descriptor with the
>    event module; it also creates a read event
> 2) mod_wsgi creates a worker thread (only one thread per worker process)
>    where the Python code will be executed
> 3) when the request handler is called, mod_wsgi setups the read event,
>    dispatches the "job" to the worker thread and returns control to
>    Nginx
> 4) when the code execution is terminated, the thread writes a character
>    to the pipe.
>    This will calls an handler in the main thread that will retrieve the
>    "job" result, sending it to the client.
>    The "job" result is protected with a lock (the worker thread will
>    wait until the lock is released by the main thread).

The threads are required thorough programming if you want production
grade server, but not toy.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list