On many sites, including Stack Overflow, people say that Flask's built-in server (started by app.run()
) only serves requests serially. Many say that if a handler takes a few seconds to respond, then the server would not be able to serve other requests in the meantime. Why am I seeing a totally opposite behavior with Flask 1.0.3?
@app.route('/slow')
def slow():
time.sleep(5)
return 'slow'
@app.route('/hello')
def hello():
return 'hello'
app.run()
While the slow
handler is sleeping, I can successfully fire off requests and receive responses for hello
. Why is that? Can the development server handle multiple requests at a time then? I so, what part of Flask enables that?