[zeromq-dev] Big Latencies
aja at ciscor.com
Mon Feb 13 19:01:00 CET 2012
Pieter Hintjens <ph <at> imatix.com> writes:
> Bad latencies are usually due to contention over CPU. Windows
> typically is much worse at this than Linux. Check what's running, try
> killing anything that looks greedy. And you also need to make sure
> your box has enough cores, which is one per 0MQ thread plus one per
> 0MQ context (for the i/o thread).
Okay, that would certainly explain it. The Windows 7 machine has 4
cores, although two of those are from hyperthreading, so really we'll
just say 2 cores. When I have one pinger thread and one echo thread
and zero I/O threads (by using inproc transport) the percentage of
messages with big latencies drops to about 1 in 1000, which seems
pretty reasonable. As I increase the number of threads it gets worse,
as would be expected from your explanation.
Still, one thing seems odd. In the minimal setup I just described,
999/1000 messages have a round-trip latency of a few tens of
microseconds. But that 1 message out of 1000 with the big latency
will be almost exactly 10 milliseconds without variation. Why am I
not seeing latencies across a whole range? Why does it jump all the
way up to exactly 10 milliseconds? Is that just an artifact of
Windows' thread scheduling? Should I not worry about it so much?
More information about the zeromq-dev