nginx git repository

Manlio Perillo manlio_perillo at
Sun Oct 14 18:07:41 MSD 2007

Manlio Perillo ha scritto:
> Adrian Perez ha scritto:
>> Hello,
>> First of all, sorry for the late reply, I have been quite busy lately.
> No problem.
> I have just released the new version of mod_wsgi, and it took me a lot 
> of time!
> Now it should be easy to add support for WSGI 1.0, I hope to release the 
> next version on the next weekend.
>  > [...]
>>> Can you send me the logs?
>>> The log level should be "info";
>> I will re-run the tests with log level set to "info", but I will first
>> update to the latest revision of the mod_wsgi module. 
> Ok, thanks.
>> I am using the
>> following Python snippet to adapt WSGI 1.0 apps to 2.0, they are a set
>> of decorators for WSGI applications, I hope they are ok although I have
>> not read the WSGI standard in depth:

Here is the version of wsgi1to2 that I have used:
class Context(object):
     def __init__(self):
         self.response = None
         self.headers  = ()
         self.buf = []

     def __call__(self, response, headers):
         self.response = response
         self.headers  = headers

         return self.write

     def write(self, buf):
         from warnings import warn

         warn('write callable is deprecated', DeprecationWarning)

def wsgi1to2(application):
     """Converts a 1.0 app into a 2.0 app

     import sys

     # Some applications require argv
     sys.argv = ['wsgi application']

     def wrapper(environ):
         context = Context()
         results = application(environ, context)

         if context.buf:
             buf = context.buf + list(results)
             return context.response, context.headers, ''.join(buf)

         return context.response, context.headers, results

     return wrapper

I have managed to run the Mercurial web application.
It is very slow on mod_wsgi, since it uses the write callable and is CPU 

With Apache Bench (n = 1000, c = 50), I get:
- 27 requests per seconds with the builtin server
- 20 requests per seconds with mod_wsgi (and 2 worker processes)

However with mod_wsgi my system load is above 2, with the builtin server 
it is over 6.

Regards  Manlio Perillo

More information about the nginx mailing list