#193: Explain why WSGI might be better with LightTPD
-------------------------+--------------------------------------------------
Reporter: Modjoe | Owner: anonymous
Type: enhancement | Status: new
Priority: normal | Milestone: 1.0b1
Component: Docs | Version:
Severity: minor | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Comment (by claudio.martinez):
I have some servers running lighttpd + wsgi.
I did some benchmarks some time ago (I don't have the results now) with
Apache Bench.
There is almost no speed difference between the direct, proxy and wsgi
methods as long as the concurrency is low. When you start raising it
(around 10), wsgi is faster and more stable.
I ran Apache Bench from 2 computers with -c 10 on each one for 30 mins and
the lighttpd+wsgi server didn't drop a single request, zero. The proxy and
direct servers just crashed (at least for me) under this stress test.
Maybe tweaking the thread pools can help, but I didn't care because wsgi
was already faster when the concurrency didn't exceed CherryPy's default
number of threads.
I'm using flup's threading WSGIServer (easy_install flup). The forking one
has some problems with the database connections, just like paste server.
My start script looks like this (there are some commented lines to try the
forking method and paste server, but I already did that and they didn't
work):
{{{
#!/usr/bin/env python
import pkg_resources
pkg_resources.require("TurboGears")
import turbogears
import cherrypy
cherrypy.lowercase_api = True
from os.path import *
import sys
# first look on the command line for a desired config file,
# if it's not on the command line, then
# look for setup.py in this directory. If it's not there, this script is
# probably installed
if len(sys.argv) > 1:
turbogears.update_config(configfile=sys.argv[1],
modulename="gitextranet.config.app")
elif exists(join(dirname(__file__), "setup.py")):
turbogears.update_config(configfile="dev.cfg",
modulename="gitextranet.config.app")
else:
turbogears.update_config(configfile="prod.cfg",
modulename="gitextranet.config.app")
from gitextranet.controllers import Root
from cherrypy._cpwsgi import wsgiApp
#from paste.util.scgiserver import serve_application
from flup.server.scgi import WSGIServer
#from flup.server.scgi_fork import WSGIServer
port = 4000
if len(sys.argv) > 2:
port = int(sys.argv[2])
cherrypy.config.update({
'global': {
'autoreload.on': False,
}})
cherrypy.root = Root()
cherrypy.server.start(initOnly=True, serverClass=None)
#serve_application(application=wsgiApp, prefix='/', port=port)
WSGIServer(application=wsgiApp, bindAddress=('localhost', port)).run()
}}}
You can check how to configure lighttpd
[http://cleverdevil.org/computing/34/deploying-turbogears-with-lighttpd-
and-scgi here]
--
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/193>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Tickets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---