CherryPyWSGIServer multi-threading

Bart Ogryczak b.ogryczak at gmail.com
Wed Oct 13 09:44:30 EDT 2010


I'm trying to create multi-threaded WSGI server. But somehow I'm
getting single threaded. What am I doing wrong?

#start myapp.py
from cherrypy.wsgiserver import CherryPyWSGIServer
def my_app(environ, start_response):
    print "my_app"
    import time
    for i in range(10):
        print i
        time.sleep(1)
    return ""
if __name__ == '__main__':
    httpd = CherryPyWSGIServer(('0.0.0.0', 8000), sikuliSlave_app,
numthreads=10)
    print "Serving on port 8000..."
    httpd.start()
#end myapp.py
I make 2 parallel request to my server and in the logs I see they are
run sequentially, not concurrently:
Serving on port 8000...
my_app
0
1
2
3
4
5
6
7
8
9
my_app
0
1
2
3
4
5
6
7
8
9



More information about the Python-list mailing list