[Twisted-Python] suggestions for improvement in Twisted APIs

Miika Komu mkomu at cs.hut.fi
Sat May 4 09:54:12 MDT 2013


Hi Itamar,

On 05/04/2013 05:00 PM, Itamar Turner-Trauring wrote:
> On 05/04/2013 07:28 AM, Miika Komu wrote:
>> Howdy,
>>
>> we investigated the networking APIs of Twisted (10.2) and published our
>> findings in Ottawa Linux Symposium 2012:
>>
>> http://nw.dreamhosters.com/ols/ols2012/ols2012-komu.pdf
> Thanks for sending us your suggestions for improvement. I'm wondering
> about your choice of version, though: Twisted 10.2 was released in 2010.
> Why did you look at an old version of Twisted for a conference in 2012?

I'll have to check this from my co-author who did the analysis.

>> Suggested improvements (for better end-user or developer experience)
>> --------------------------------------------------------------------
>> * (R1.1): The framework does not support symbolic host names in its
>> APIs, i.e., does not hide the details of hostname-to-address resolution
>> from the application
>> * R1.2: The details of IPv6 are not abstracted away from the application
>> * R2.1: The framework does not implement DNS look ups with
>> getaddrinfo(). This is important for IPv6 source address selection
>> * R2.2: The framework does not support parallel DNS look ups over IPv4
>> and IPv6 to optimize latency
>> * R3.3: The framework does not support parallel connect() over IPv4 and
>> IPv6 to minimize the latency for connection set-up
>>
> I believe pretty much of all of these have been fixed in Twisted over
> the past year, or are written and in the process of addressing review
> comments.

This is good news!

> Except for this:
>
> * (R4.1): TCP and UDP are not easily interchangeable
>
> Which I don't understand at all. UDP and TCP are completely different
> than each other, there's no way to make them interchangeable.

with connected sockets, (almost) the same API calls could be used and 
the details could be possibly abstracted away (some kind of a flag still 
needed to choose between TCP and UDP). A number of applications appear 
to support both TCP and UDP-based connectivity:

4.2.4 A Summary of the Sockets API Findings and Their Implications:

Finding 2 statistics: TCP-UDP hybrids 26.3%

Finding 2. Hybrid applications using both TCP and UDP occur as 
frequently as TCP-only applications. Application developers seem to 
write many application protocols to be run with both transports. While 
it is possible to write almost identical code for the two transports, 
the Sockets API favors different functions for the two. This 
unnecessarily complicates the application code.




More information about the Twisted-Python mailing list