[Twisted-Python] Fwd: Slow data transfer with Twisted + socat + Windows

Michael Thompson michaelnt at gmail.com
Wed Mar 9 02:02:58 EST 2011

---------- Forwarded message ----------
From: Michael Thompson <michaelnt at gmail.com>
Date: 9 March 2011 07:02
Subject: Re: [Twisted-Python] Slow data transfer with Twisted + socat + Windows
To: Jason Heeris <jason.heeris at gmail.com>

On 9 March 2011 01:47, Jason Heeris <jason.heeris at gmail.com> wrote:
> On 9 March 2011 03:49, Michael Thompson <michaelnt at gmail.com> wrote:
>> Does you program just write via TCP to this serial device, it doesn't
>> do anything else that could block?
> Both the "bare bones" script and the real app writes and reads from
> the device, so I wouldn't expect full speed communications. But I
> can't see anything else in my script that might actually block.
>> Have you tried running this under different reactors?
> Yep — no difference under Linux, but the GTK reactor is slower than
> the select reactor under Windows (see original email for times).
>> Running the windows program against the Linux socat device might help
>> to reduce the number of variables.
> Aha! Didn't think of that, but interesting results...
> socat on Linux, socat_test.py on Windows VM:
>  - select reactor: 4s
>  - win32reactor: 4s
>  - gtk reactor: 220s
> socat on Windows VM, socat_test.py on Linux:
>  - select reactor: 30s
>  - gtk reactor: 30s
> Interesting, but not exactly clarifying...

And from your first email

socat on Windows, socat_test.py on Windows VM

select 30s
gtk reactor 220s

My read of these results is that socat on windows limits the
performance to 30s and in addition the gtkreactor on windows has
performance problems.

The gtkreactor on windows has a different implementation which seems
to be missing any way for the GTK loop to notify the reactor of IO.
You could try changing the timeout from 0.1 to something smaller, but
that will probably hammer the CPU when idle.

pyserial includes an example that makes a serial port accessible of
TCP you could see if that is any faster than socat.

Perhaps you can write a serial to TCP adaptor that encapsulates the
serial logic so reduce the IO between this application and the GTK app
to a message like start_sync, stop_sync.


More information about the Twisted-Python mailing list