I am trying to write an application using a tornado using a weapon that processes workflows. I have created the code shown below, but despite running several employees, it does not pass requests. One worker seems to be processing all requests all the time (not intermittent).
the code:
from tornado.web import RequestHandler, asynchronous, Application
from tornado.ioloop import IOLoop
import time
from datetime import timedelta
import os
class MainHandler(RequestHandler):
def get(self):
print "GET start"
print "pid: "+str(os.getpid())
time.sleep(3)
self.write("Hello, world.<br>pid: "+str(os.getpid()))
print "GET finish"
app = Application([
(r"/", MainHandler)
])
The output is in the console (I updated 3 browser tabs within a 3 second window, but they still use the same process and run sequentially):
2014-04-12 20:57:52 [30465] [INFO] Starting gunicorn 18.0
2014-04-12 20:57:52 [30465] [INFO] Listening at: http://127.0.0.1:8000 (30465)
2014-04-12 20:57:52 [30465] [INFO] Using worker: tornado
2014-04-12 20:57:52 [30474] [INFO] Booting worker with pid: 30474
2014-04-12 20:57:52 [30475] [INFO] Booting worker with pid: 30475
2014-04-12 20:57:52 [30476] [INFO] Booting worker with pid: 30476
2014-04-12 20:57:52 [30477] [INFO] Booting worker with pid: 30477
GET start
pid: 30474
GET finish
GET start
pid: 30474
GET finish
GET start
pid: 30474
GET finish
IOLoop.add_timeout , . , , - , , , , . pastebinned , .
, ?