This is the correct cause.  Reproducing your test gives 38-45ms in each of
10 runs.  If you run a profiler against it, you can see that the time is
entirely spent blocking on receive in TStreamTransport.Read.

Your test can be modified with the following line:
coreTransport.TcpClient.NoDelay = true;

After disabling Nagle's each test runs in < 1ms.

Michael

On Fri, Sep 17, 2010 at 9:57 AM, Peter Schuller <peter.schul...@infidyne.com
> wrote:

> > The latency is about 200 ms on every request when I'm connected to
> another
>
> My first thought here was that maybe you're seeing the effects of
> nagle[1] + delayed acks on the other side. On Unix, normally something
> like a thrift client would set TCP_NODELAY on its socket to avoid the
> problem. I'm not sure whether or not this is a reasonable hypothesis
> with C# + Thrift on Windows. Sorry, I don't know what the easy fix is
> either but perhaps it might help dig further.
>
> [1] http://en.wikipedia.org/wiki/Nagle's_algorithm
>
> --
> / Peter Schuller
>

Reply via email to