Perfomance of CherryPy 2.2

3 views
Skip to first unread message

amix

unread,
Jan 26, 2006, 7:36:02 PM1/26/06
to cherrypy-devel
Today I did some testing of CherryPy 2.2 and its speed. It seems like
it has gotten slower (from my observations it's something like ~50%
slower). In the server configuration I turned session_filter on. I
could imagine it could go a lot slower if one used more filters (and
had more complex sites).

I had also made a more complex test with static filter where the req.
pr. sec. got down to 60.

Here are my results. Notice also that the performance on the Mac OS X
is far worse than on Linux (even if the PowerMac has a lot more
resources... look also how bad the poor iBook G4 performs) Is this
performance loss Python or CherryPy specific?

ab settings:
ab -n 1000 http://localhost:8080/
The way I ran server:
nohup python2.4 start_server.py > /dev/null


CherryPy 2.0
=============================================
[Debian Server]:
Requests per second: 424.58 [#/sec] (mean)

[OS X Tiger 10.4 (iBook G4)]:
Requests per second: 42.44 [#/sec] (mean)

[OS X Tiger 10.4 (PowerMac G5)]:
apr_recv: Connection refused (61) - hmm


CherryPy 2.1
============================================
[Debian Server]:
Requests per second: 404.15 [#/sec] (mean)

[OS X Tiger 10.4 (iBook G4)]:
Requests per second: 71.29 [#/sec] (mean)

[OS X Tiger 10.4 (PowerMac G5)]:
apr_recv: Connection refused (61) - hmm


CherryPy 2.2
============================================
[Debian Server]:
Requests per second: 220.83 [#/sec] (mean)

[OS X Tiger 10.4 (iBook G4)]:
Requests per second: 40.97 [#/sec] (mean)

[OS X Tiger 10.4 (PowerMac G5)]:
Requests per second: 162.24 [#/sec] (mean)

CherryPy 2.0 code
============================================
import sys, os
sys.path.insert(0, os.path.abspath("../cherrypy2_0"))
from cherrypy import cpg

class Page:

def index(self):
return "hello"
index.exposed = True

#Server settings
server_settings = {'global': {
'server.environment': 'production',
'server.threadPool': 20,
'server.threading': True,
'sessionFilter.on': True
}
}

cpg.root = Page()
cpg.server.start(configMap=server_settings)

CherryPy 2.1 code
============================================
import sys, os
sys.path.insert(0, os.path.abspath("../cherrypy2_1"))
import cherrypy
from cherrypy import expose

class Page:

def index(self):
return "hello"
index.exposed = True

#Server settings
server_settings = {'global': {
'server.environment': 'production',
'server.threadPool': 20,
'server.threading': True,
'sessionFilter.on': True
}
}

cherrypy.config.update(server_settings)
cherrypy.root = Page()
cherrypy.server.start()

CherryPy 2.2 code
============================================
import sys, os
sys.path.insert(0, os.path.abspath("../cherrypy2_2"))
import cherrypy
from cherrypy import expose

class Page:

def index(self):
return "hello"
index.exposed = True

#Server settings
server_settings = {'global': {
'server.environment': 'production',
'server.thread_pool': 20,
'server.threading': True,
'session_filter.on': True
}
}

cherrypy.config.update(server_settings)
cherrypy.root = Page()
cherrypy.server.start()

Remi Delon

unread,
Jan 27, 2006, 7:25:30 AM1/27/06
to cherryp...@googlegroups.com
> Today I did some testing of CherryPy 2.2 and its speed. It seems like
> it has gotten slower (from my observations it's something like ~50%
> slower).

Good point... I ran some tests as well and got the same results.
After some investigation it turns out that it comes from the fact that
CP-2.2 has to support both the old API and the new API (lowercase), so that
doubles the number of config lookups etc ...

So I added a new switch "cherrypy.lowercase_api" that people can set to True
if they're using the new API (the default is False for backward
compatibility).
If you set it to True then you'll get a similar performance as CP-2.1.
You just need to do this at the top of your program:
import cherrypy
cherrypy.lowercase_api = True

> look also how bad the poor iBook G4 performs) Is this
> performance loss Python or CherryPy specific?

Looks really bad indeed ... I have no idea why that is though ...
Maybe someone with some "python on the mac" experience can comment on this ?


Remi.

amix

unread,
Jan 27, 2006, 8:07:47 AM1/27/06
to cherrypy-devel
Nice job on that fix! ;]

Anyway, I would definitely upgrade to the new name scheme than have a
50% performance loss... And I would encourage others to do the same.

It's great that you guys think of backward compatibility, but sometimes
it's rather expensive :] - - look just at Windows :o

amix

amix

unread,
Jan 27, 2006, 4:04:40 PM1/27/06
to cherrypy-devel
Here are some more tests:
[Debian CherryPy 2.2 beta without cherrypy.lowercase_api]:
Requests per second: 220.98 [#/sec] (mean)

[Debian CherryPy 2.2 beta with cherrypy.lowercase_api = True]:
Requests per second: 329.85 [#/sec] (mean)

It's definitely an improvement.

Reply all
Reply to author
Forward
0 new messages