I am trying to do long queries using gunicorn and its asynchronous workers, but I cannot find any examples that I can get to work. I used the example here , but configured to add a fake delay (sleep for 5s) before returning the answer:
def app(environ, start_response):
data = "Hello, World!\n"
start_response("200 OK", [
("Content-Type", "text/plain"),
("Content-Length", str(len(data)))
])
time.sleep(5)
return iter([data])
Then I fire the guns like this:
gunicorn -w 4 myapp:app -k gevent
When I open two browser tabs and type http://127.0.0.1:8000/in both of them and send requests almost at the same time, the requests seem to be processed sequentially - one returns after 5 seconds and the other returns after further 5 seconds.
Q. , ? 4 , "", ?