Asynchronous MongoDB with Python & Tornado Webinar - July 24, 2012
A. Jesse Jiryu Davis will review the state of the art for asynchronous Python and MongoDB, discuss his experimental driver for MongoDB and Tornado, and demonstrate building a real-time web app.
Async’s killer app • Short-‐polling is CPU-‐bound: tradeoff between latency and load • Long-‐polling is memory bound • “C10K problem”: kegel.com/c10k.html • Tornado was invented for this Tuesday, July 24, 12
= handler # _impl is epoll or kqueue or ... self._impl.register(fd, events) def start(self): while True: event_pairs = self._impl.poll() for fd, events in event_pairs: self._handlers[fd](fd, events) Tuesday, July 24, 12
– to the extent they work in Python at all • Tornado works so-‐so – AsyncMongo • No replica sets, only first batch, no SON manipulators, no document classes, … – PyMongo • OK if all your queries are fast • Use extra Tornado processes Tuesday, July 24, 12
be official in a few months • Uses Tornado IOLoop and IOStream • Presents standard Tornado callback API • Stores state internally with greenlets h[p://emptysquare.net/motor Tuesday, July 24, 12