PUB socket only sends the first 1000 if zmq_sendmsg() is called in a tight-loop.

Description

I ported the old local_thr.cpp/remote_thr.cpp that uses SUB/PUB sockets from 2.1 to work under 3.1. The latest versions in 3.1 uses PUSH/PULL sockets. wireshark show that only the first 1000 messages are sent from the publisher, even if the publisher sleeps after sending 10,000 messages. The attached publisher puts the message number(as text) in each message to help with debuging. If a printf() statement is added to the publishers send loop, then all 10k messages are sent.

Environment

Linux 3.0.4-gentoo. AMD athlon II X2 250 (3Ghz dual core cpu).
libzmq 3.1 from master branch in libzmq repo. git hash(e7d748e812a7259bd40)

Attachments

2

Activity

Show:

Martin Sustrik December 10, 2011 at 10:21 AM

This issue is caused by introducing the default HWM of 1000. First 1000 messages are inserted quickly into the queue, HWM is reached and the rest of the messages are dropped.

The PUB/SUB pattern is inherently unreliable and if you send messages faster than network is able to transfer them, you are going to see some message drop.

Of course, using large buffers (HWM=20000 or so) would postpone the moment when the messages are started to be dropped.

Martin Sustrik December 10, 2011 at 9:54 AM

Reproduced. Thanks!

Won't Fix

Details

Assignee

Reporter

Components

Affects versions

Priority

Created December 5, 2011 at 9:21 PM
Updated December 10, 2011 at 10:23 AM
Resolved December 10, 2011 at 10:21 AM