Re:Understanding the code inside Tornado, the asynchronous w...
by ankrgyl on Sunday May 08, 2011 @06:54PM
(#2526906)
I don't think of this as a problem. Tornado is just a small and lightweight non-blocking HTTP server with a couple of convenient libraries. There are some pretty awesome, elegant solutions to the problem you point out, and I like to think of these as extensions to the small Tornado framework.
One really cool one is http://thomas.pelletier.im/2010/08/websocket-tornado-redis/, which demonstrates how to use threading to support Redis pub/sub.
For heavy computational tasks that aren't time-critical, you could have an accessory worker thread that chugs queued computations (yay first-class functions) in computational downtime.
Re:Understanding the code inside Tornado, the asynchronous w...
by ntoshev on Sunday May 08, 2011 @02:32AM
(#2525383)
Tornado devs recommend using blocking mysql drivers and disk I/O. These operations have relatively low and predictable latencies. You can run more Tornado processes than the number of cores is if CPU is underutilized.
Languages/frameworks where async IO is an implementation detail (like some web frameworks in haskell) don't have this issue.