[zeromq-dev] Pub Sub last message takes much more time to arrive than the previous ones

Omer Bacharach omer at toot-trading.com
Wed Oct 12 09:30:52 CEST 2011


Hi Martin,
Thanks for your response.
The problem is reproducible.
Attaching the pub code and the sub code, and the batch file which
operates both (attached as pubsub.txt, please rename to pubsub.bat).

please call "pubsub.bat 10 1000"

This will generated one publisher which sends 1000 messages to 10 subscribers.
When each subscriber gets the whole 1000 messages it will dump the
results to a file (<subscriber_number>.tda).
The left most column is the qpc of the message when was sent , and the
one to the right is the qpc when was received.
The difference between them is how time did it take the message to
arrive. you can see that the difference (on every tda file) in the
last message (1000th) is ~20 times bigger than the rest.

Thanks,
Omer.





On Wed, Oct 12, 2011 at 8:57 AM, Martin Sustrik <sustrik at 250bpm.com> wrote:
> Hi Omer,
>
>> I'm testing a scenario in which I have one publisher sending messages
>> to multiple subscribers.
>> In the message the publisher sends I'm sending the value of
>> QueryPerformanceCounter and when the subscriber gets a message it
>> calculates the difference between the current QueryPerformanceCounter
>> to the one stored in the message.
>>
>> It seems that for 1000 messages sent from the publisher to the
>> subscribers, the last one takes around 20 times than the average time
>> it takes for the previous ones to arrive.
>> Seems as the last one is "stuck" and in some queue and is released
>> probably after a timeout.
>
> There's no flush timeout in 0MQ code, so the delay is either a bug in 0MQ or
> a side effect of how latency is measured.
>
> Is the problem reproducible? If so, can you provide the test program?
>
> Martin
>



-- 
Omer Bacharach
Director of Software Development
Toot Trading Ltd.
omer at toot-trading.com
Mobile +972-544-317959
Office +972-3-7449466
-------------- next part --------------
@Set Counter=1

:loop
@IF %Counter% LEQ %1 goto sub

:pub
@start pub.exe %2
@goto END

:sub
@start "Subscriber %Counter%" sub.exe %2
@Set /A Counter+=1

@goto loop

:END
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sub.cpp
Type: text/x-c++src
Size: 3112 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20111012/0c66a4b6/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pub.cpp
Type: text/x-c++src
Size: 1924 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20111012/0c66a4b6/attachment-0001.cpp>


More information about the zeromq-dev mailing list