CherryPyWSGIServer multi-threading

B

Bart Ogryczak

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), my_app, numt)
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top