3 ms·
For the folks out there using Tornado in production, what database (if any) are you using it with? Are you using an async interface to your database (assuming o
by crcsmnky 15y ago
For the folks out there using Tornado in production, what database (if any) are you using it with? Are you using an async interface to your database (assuming one is available)?
- peterbe 15y agoI use MongoDB and to do that I use MongoKit. Works really well. I also use Redis for the caching (note: not as a database) For both Mongo and Redis I use the sync libraries. So far, I don't have any slow queries that would require me to async them.
- giulivo 15y agoMongoDB with asyncmongo
- jrussbowman 15y agoI use mongodb with bit.ly's asyncmongo. I honestly was a bit frustrated with it from a development standpoint because of all the callbacks. Just felt like spaghetti code. Since I have started applying tornado.gen its been pretty effective. Asyncmongo may not fit all use cases though. As I understand it it can be difficult to deal with paging potentially based off of what I have read in the issues on the github repo. Also last I checked it doesn't support tailable cursors. One thing to note is that with friendfeed they did synchronous requests to MySQL and their thought was you should make sure the requests responses are quick enough that blocking is not an issue. After working hard to do asynchronous requests I'm now of the opinion I should have taken their word for it.
- Maascamp 15y agoFor Postgres there's Momoko http://momoko.61924.nl/ http://momoko.61924.nl/ which is really quite nice. If you're using MySQL you have a few options including patching MySQLdb as explained by chartio (http://chart.io/blog/2011/06/10/making-mysql-queries-asynchronous-in-tornado/ http://chart.io/blog/2011/06/10/making-mysql-queries-asynchr...). I followed the chartio approach and added in some async cursors to fit in better with the tornado database module. Pretty straightforward stuff.
- salem 15y agoBefore the Twisted/Tornado bridge existed, I made a rest-api for my DB in Twisted. There are a bunch of good async DB clients implemented for Twisted Python. It also made for good MVC separation.
- Yaggo 15y agoI benchmarked pymongo vs. asyncmongo and found no performance gain (or even negative gain) with the latter unless making relatively heavy/slow queries. So, the asynch spaghetti is not worth of it in most cases, just like the authors experienced with MySQL.