[Twisted-Python] How to accept connections faster
exarkun at divmod.com
Wed Mar 16 21:24:21 EST 2005
On Thu, 17 Mar 2005 09:25:58 +0800, "Sinang, Danny" <d.sinang at spitech.com> wrote:
> Thanks for the tip. My code is indeed running faster now.
> However, the reason for the loop was to somehow simulate late responses
> from a remote database server.
> I'm guessing I should put the database query code in the closeInABit
> method you mentioned like this :
> [snip - blocking database code]
> Is this ok ? Or should there be some special Asycn coding technique I
> must also learn ?
Yea, async. Async is nice. Twisted comes with a moduled named "adbapi" that provides a non-blocking layer around standard DB-API 2.0 modules (such as MySQLdb). You can read more about it here at <http://twistedmatrix.com/documents/current/howto/enterprise>.
More information about the Twisted-Python