[erlang-questions] Latency with tcp active mode

Per Hedeland per@REDACTED
Fri Sep 11 00:49:31 CEST 2009

Erik Rigtorp <erik@REDACTED> wrote:
>I'm working on an application where latency is very important. It
>listens to messages on some TCP sockets, processes them and sends them
>out on some TCP sockets. The problem is that I can measure a huge
>round trip latency between sending a message to the application and
>receiving the response. After substracting the network round trip i
>can see insignificant delays to up to 400ms delays. Nagling is of
>course disabled.

Are you really sure about that? 200ms is the traditional Nagle delay,
though it seems most stacks use a lower value these days. When I do a
trivial test with loopback connections (separate send and receive), I
see ~ 100ms round-trip delay with Nagle on (default, of course), 1-2ms
with it off (seems rather high actually).

> Apperently there is some significant delay between
>the NIC and until i receive the message in an erlang process.

How did you determine that - as opposed to a delay between a send and
the NIC? What OS are you running on?

Of course as has been discussed many times here, selective receive and a
long message queue can give very bad results - could this be the case
for you? If you are actually using {active, true} you might want to try
{active, once} instead...

--Per Hedeland

More information about the erlang-questions mailing list