[Twisted-Python] Two main loops

Nitro nitro at dr-code.org
Mon Nov 12 14:08:29 EST 2007


Am 12.11.2007, 19:47 Uhr, schrieb Jasper <jasper at peak.org>:

> To get to the point, I actually do feel that the fault lies with  
> Twisted, or more specifically PB.  Code using PB wants to be as unaware  
> of the details of network transmission as possible.  It certainly  
> doesn't want to slice things into a bazillion chunks for individual  
> transmission, and then puzzle them back together on the other end.
>
> IMHO it makes more sense for PB to understand it shouldn't block, and to  
> chunk and schedule its serialization (and unserialization) in the same  
> manner as the TCP packets sent underneath.  I'm guessing this would make  
> for cleaner separation, and more general usefulness.

I think this is a) not possible and b) not desirable. It's not possible  
because pb sends a single large chunk of data over tcp. The OS is  
responsible to break everything down into individual tcp packets and  
puzzle them together at the other end. The whole packet thing is not  
visible to pb. So if you want pb to split your data, then do splitted  
callRemotes.
It's not desirable because you don't want your program to be stalled at  
uncontrollable times when the OS decides to send 20 tcp packets at once.  
You want to spread the load as evenly as possible and you'll have to do  
this manually.
Which kind of game are you working on and how many connections/bandwidth  
does it have? I haven't encountered the problems you mention in my project.

-Matthias




More information about the Twisted-Python mailing list