[Twisted-web] performance of web2

Manlio Perillo manlio_perillo at libero.it
Sun Jan 7 11:53:40 CST 2007


Hi.

I have begin to play with twisted.web2.

The first thing I have done is a comparative test against Nevow.

The Nevow code:
class Main(object):
     implements(inevow.IResource)

     def renderHTTP(self, ctx):
         data = "hello world" * 1024
         return data
  	
     def locateChild(self, ctx, segments):
         return self, ()


and twisted.web2 code:
class Main(object):
     implements(iweb.IResource)
  	
     def renderHTTP(self, req):
         data = "hello world" * 1024
         return http.Response(stream=data)

     def locateChild(self, request, segments):
         return self, server.StopTraversal


I have used ab2 from apache2.
With n = 100 and c = 1:
- nevow: 1062 req/sec
- web2:  980 req/sec

With n = 500 and c = 50
- nevow: 1231 req/sec
- web2:  1101 req/sec

(plain twisted.web is a bit faster: 1323 req/seq and 1793 req/seq)

This is not a problem (and maybe the tests are not so accurate), but I 
would like to known if there are still some areas that can be optimized 
in twisted.web2 or the development is stable.



Thanks and regards  Manlio Perillo



More information about the Twisted-web mailing list