[zeromq-dev] Basic questions on ZeroMQ functionality

Charles Remes lists at chuckremes.com
Thu Jan 10 14:42:53 CET 2013

Answers inline.

On Jan 10, 2013, at 7:03 AM, shyam valsan <egorulz at gmail.com> wrote:

> I have few basic questions on ZeroMQ functionality
> -          What is the maximum buffer size for zeroMQ receive socket (ZMQ_SUB). Wanted to know how many messages can be queued up on the receive socket.

You can set your SNDHWM and RCVHWM (high water marks) to be effectively infinite, so then you are only limited by system memory.

> -          What is the max length of messages that can be send on the socket using zmq_send(). If the length exceeds the limit, will it be handled internally by zeroMQ as two different message or will the message get truncated?

You can send a message of length 2^64. Zeromq does not do any internal splitting of messages; this is your responsibility.

>                 After I have opened a socket for listening [ i.e after successful calls to zmq_connect and zmq_setsockopt() with ZMQ_SUBSCRIBE option],all messages  being send on that port (where subscribe socket is listening) will be received by the subscribe socket and queued up in its receive queue. Once zmq_receive() call is made all these messages will be received by application. Is understanding correct.

No, this isn't necessarily correct. Think of a PUB socket as a "radio broadcast" that is sending packets as fast as it can. If there are no listeners (subscribers) then all packets are dropped. If there is a subscriber and it is slow enough that its buffers overflow (high water mark again) then packets will also drop.

I highly recommend reading the guide (zguide.zeromq.org). It explains all of this in detail. Also, look at the man pages and the FAQ.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130110/1da84ebb/attachment.htm>

More information about the zeromq-dev mailing list