I have just begun to look at tornado and asynchronous web servers. In many examples for tornado, longer requests are handled by something like:
- make a call to tornado webserver
- tornado makes async web call to an api
- let tornado keep taking requests while callback waits to be called
- handle response in callback. server to user.
So for hypothetical purposes say users are making a request to tornado server at /retrive
. /retrieve
will make a request to an internal api myapi.com/retrieve_posts_for_user_id/
or w/e. the api request could take a second to run while getting requests, then when it finally returns tornado servers up the response. First of all is this flow the 'normal' way to use tornado? Many of the code examples online would suggest so.
Secondly, (this is where my mind is starting to get boggled) assuming that the above flow is the standard flow, should myapi.com
be asyncronous? If its not async and the requests can take seconds apiece wouldn't it create the same bottleneck a blocking server would? Perhaps an example of a normal use case for tornado or any async would help to shed some light on this issue? Thank you.