[Twisted-Python] Client/Server to stream text logfiles?

Jason Rennie jrennie at gmail.com
Thu Sep 29 11:00:49 MDT 2011


On Thu, Sep 29, 2011 at 10:37 AM, Victor Hooi <victorhooi at yahoo.com> wrote:

> However, what did you mean by it may be "nontrivial to use twisted with
> non-twisted friendly libraries"? What would make a library non-Twisted
> friendly?
>

Most important, I think, is for non-reactor code to not block.  E.g. if
you're using a library to read from a database, the database library code
should release control between the time you make a request and the time the
library delivers the results of that request.  For example, a "nice" request
call might have a callback argument and return immediately, triggering the
callback when results are ready.

Note that if you *must* use a library which is blocking, a possible solution
is to execute the blocking code in a thread.  But, this isn't easy to get
right and the python GIL can cause problems if you need a lot of threads.

Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20110929/6d94d08e/attachment.html>


More information about the Twisted-Python mailing list