Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between pub-sub and push-pull pattern in zeroMq

This two images are from http://zguide.zeromq.org/page:all.

What is the difference between this two pattern if we ignore sink in push-pull pattern ? Is there a difference in how a message gets transfer, if yes what is the difference ?

like image 842
Bhuvan Avatar asked Jul 23 '13 15:07

Bhuvan


1 Answers

The difference is that a PUB socket sends the same message to all subscribers, whereas PUSH does a round-robin amongst all its connected PULL sockets.

In your example, if you send just a single message from the root, then all the subscribers will receive it (barring slow subscribers, etc.) but only 1 worker.

The pub/sub pattern is used for wide message distribution according to topics. The push/pull pattern is really a pipelining mechanism. Your push/pull example seems to be attempting to do load-balancing, which is fine, but req/rep might be better suited to that due to other issues.

It looks like the "issues" here are described in the same part of the 0MQ guide you got the image from : push/pull ventilator example

like image 135
SteveLove Avatar answered Sep 19 '22 09:09

SteveLove