curious about async db queries

945 views
Skip to first unread message

elij

unread,
Sep 10, 2009, 7:21:07 PM9/10/09
to Tornado Web Server
The examples in 'demos' that use a database, appear (at first glance)
to all be synchronous/blocking calls.

Are there any examples of async database access (such as one might
need on a long/slow db query -- something like
httpclient.AsyncHTTPClient but for db queries)?

I recall twisted.python.web doing something with threads to spool db
calls, but I haven't looked at that in a while to be honest.

Maybe someone else who has looked at the examples and code a bit more
deeply can provide some insight.

Bret Taylor

unread,
Sep 10, 2009, 8:22:14 PM9/10/09
to Tornado Web Server
We experimented with different async DB approaches, but settled on
synchronous at FriendFeed because generally if our DB queries were
backlogging our requests, our backends couldn't scale to the load
anyway. Things that were slow enough were abstracted to separate
backend services which we fetched asynchronously via the async HTTP
module.

I may open source the async MySQL client I wrote, but I am still
skeptical of the long term value given the code complexity it
introduces.

Bret

jhb

unread,
Sep 13, 2009, 8:12:25 AM9/13/09
to Tornado Web Server
Hi Bret,

first thanks for opensourcing tornado. Quite like the simplicity of
it.

> I may open source theasyncMySQL client I wrote, but I am still
> skeptical of the long term value given the code complexity it
> introduces.

I would be very interested, even if it was just to get my head around
it.
In my use case I would have relatively expensive writes to the db,
while at the
same time I would expect the server to be able to deliver static / non-
db content
at the same time. I think here an async db access would make sense?

Cheers,

Joerg
Reply all
Reply to author
Forward
0 new messages