i’m using tornado for its simplicity, and am using it with Pymongo, so because i hear always about asynchronous calls, to serve lot of clients, then, i was asking, what is really an asynchronous calls to a database, so this code for example:
for example, suppose a page where a user have 4 areas where to search, so the result will be a 4 results.
A = calls the database to search for an element a.
B = calls the database to search for an element b.
C = calls the database to search for an element c.
D = calls the database to search for an element d.
then render a pages where a user will see the results (a,b,c,d)
so, this will be a killer for the server, since he must stay for all the 4 requests to finish, or do it serve the first result and then wait even if the database calls are blocking and make a bucket where he joins all the results to be served to the client? or the split of the 4 operations must be done with asynchronous database library (like Motor or Asyncmongo)?
Every call to PyMongo will block Tornado’s IOLoop and prevent further processing of any client HTTP request until the PyMongo method completes.
http://api.mongodb.org/python/current/faq.html#does-pymongo-support-asynchronous-frameworks-like-gevent-tornado-or-twisted