0

Hello all assuming that we have a pub-sub pattern in zmq with many subscribers, one publisher, and a message of 3GB. My question is does the publisher send n x O(m) where n is the number of subscribers and m is the 3GB size or does it only uploads once the 3 GB and somehow the subscriber download it? so to avoid the n x O(m).

According to zmq docs pub-sub is a multicast pattern

"ZeroMQ’s low-level patterns have their different characters. Pub-sub addresses an old messaging problem, which is multicast or group messaging"

so i expect not n x O(m) but just O(m) am i correct?

Mixalis Navridis
  • 181
  • 2
  • 15
  • Are all the subscribers on a local network managed entire by your or a team at your organization? Or are any of the subscribers on the Internet? – James Risner Feb 02 '23 at 16:15
  • @James Risner yes all the subscribers on a local network managed entire by me – Mixalis Navridis Feb 02 '23 at 16:21
  • I've never used zeromq prior. Can you give a short minimal program using the library to send one message? – James Risner Feb 02 '23 at 19:47
  • But in a general sense, you need UDP enable instead of TCP in zeromq and need to use PUB/SUB (per info I just read). For IP, use something in 239.0.0.0 to 239.255.255.255 – James Risner Feb 02 '23 at 19:49

2 Answers2

2

It all depends on the transport you choose rather than just the zeromq pattern (in this case pub/sub).

If you choose tcp then there will be X copies of the data sent to the subscribers from the host you are running on because tcp has a separate connection to each one. If you choose pgm (reliable multicast) there will be one copy sent from the host and it will end up being fanned out in a router downstream to each subscriber.

There is also a newer radio/dish pattern that supports basic multicast but you lose the publisher side subscription filtering.

James Harvey
  • 912
  • 4
  • 6
  • so if i understand correctly in case of tcp we will have n*o(m) messages where n is the number of subscribers and m the size of message and in case of pgm just o(m)? am i right? – Mixalis Navridis Feb 07 '23 at 12:15
  • 2
    Assuming you are talking about the amount of data that will travel over the network interface then yes. – James Harvey Feb 07 '23 at 14:47
-1

In general you only send once through the pub socket and it gets send to all subscribers.

See docs here: https://zeromq.org/socket-api/#publish-subscribe-pattern

PUB socket

A PUB socket is used by a publisher to distribute data. Messages sent are distributed in a fan out fashion to all connected peers. This socket type is not able to receive any messages.

When a PUB socket enters the mute state due to having reached the high water mark for a subscriber, then any messages that would be sent to the subscriber in question shall instead be dropped until the mute state ends. The send function does never block for this socket type.