SlideShare a Scribd company logo
ØMQ @ NodeJS
ØMQ: Small Pieces for Scalable Software
Fernando D. Alonso
1. Facts about ØMQ
[ ]
Facts about ØMQ
Low level messaging library
○ It is written in C++.
○ A thin layer between application and transport
layers.
○ Message-passing using in-memory queues.
○ Concise API which talks over the ZMTP protocol.
○ Works on top of TCP, IPC, in-memory, and
PGM/EPGM communication protocols.
○ Philosophy: horizontal scalability to reduce points
of failure.
○ Network topology aware. Point to point
communication reduce latencies.
○ Communication is reduced to a few patterns, which
combined are powerful.
○ No need to have a multitenant service.
Facts about ØMQ
A broker is not mandatory
Facts about ØMQ
Messaged oriented communication
○ Messages as first-class citizen. No need to fight
with framing or buffering.
○ You can send multipart messages.
○ Messages are atomic.
○ Asynchronous messaging. A single background I/O
thread does the job for ØMQ sockets.
"A ØMQ message is a discrete unit of data passed between
applications or components of the same application. ØMQ messages
have no internal structure and from the point of view of ØMQ itself
they are considered to be opaque binary data."
Facts about ØMQ
Fast for development
○ Interchangeable transports: e.g, scaling from one
IPC server to a bunch of TCP.
○ Automatic reconnections.
○ Multicore made easy.
○ Provides zmq_poll to read BSD sockets.
○ It doesn't provide message persistence.
○ It doesn't provide data serialization.
○ It doesn't provide data compression.
○ It doesn't provide message encryption.
○ It doesn't provide security mechanisms. Not in the
next version of the ZMTP protocol !
(*) ZTMP 3.0 draft protocol: http://hintjens.com/blog:39
Facts about ØMQ
Aims for simplicity
Facts about ØMQ
Platforms & Languages
○ Bindings for 30+ languages including NodeJS, Ruby,
Python, Java, C, C++, Scala, Erlang, Perl, PHP, .NET.
○ Linux & Windows.
○ Raspberry PI.
○ Android OS.
2. Install
[ , ]
Install
On Linux from source
sudo apt-get install build-essential libtool autoconf automake uuid-dev
wget http://download.zeromq.org/zeromq-3.2.3.tar.gz
tar xvzf zeromq-3.2.3.tar.gz
./configure
make
sudo make install
sudo ldconfig
NOTES:
(*) Check http://download.zeromq.org/ for more versions.
(**) Avoid 3.0.x, 3.1.x, 3.2.0, 3.2.1 versions. They lack backwards
compatibility.
(***) Check ./configure --help for more options on build.
(****) ./configure --with-pgm
Install
On Linux using packages
Libzmq 3.2:
● Debian Sid: sudo apt-get install libzmq3-dev
Libzmq 2.2:
● Debian Wheezy, Jessie, Sid: sudo apt-get install libzmq-dev
● Debian Squeeze backport: http://packages.debian.org/squeeze-
backports/libzmq1
Install
On Mac
brew install zmq
Install
NodeJS bindings
NPM Packages:
● zmq (https://github.com/JustinTulloss/zeromq.node) [RECOMMENDED]
● zmq-stream (https://github.com/Schoonology/zmq-stream)
npm install zmq
node
> var zmq = require('zmq');
Install
Bindings in other languages
Ruby: https://github.com/chuckremes/ffi-rzmq [RECOMMENDED]
Python: https://github.com/zeromq/pyzmq
Erlang: https://github.com/zeromq/erlzmq2
Java JZMQ (uses JNI): https://github.com/zeromq/jzmq
Java JeroMQ: https://github.com/zeromq/jeromq
Scala ZeroMQ: https://github.com/mDialog/scala-zeromq
Scala ZeroMQ (official): https://github.com/valotrading/zeromq-scala-binding
...
3. Sockets
Sockets
Creation
(*) http://api.zeromq.org/3-2:zmq-socket
ØMQ C API
NodeJS ZMQ
req ZMQ_REQ
rep ZMQ_REP
dealer ZMQ_DEALER
router ZMQ_ROUTER
push ZMQ_PUSH
pull ZMQ_PULL
ØMQ C APINodeJS ZMQ
pub ZMQ_PUB
sub ZMQ_SUB
xsub ZMQ_XSUB
xpub ZMQ_XPUB
var sock = zmq.socket
("<SOCKET_TYPE>");
zmq_socket(context, <SOCKET_TYPE>);
Request
Reply
Dealer (async Request)
Router (async Reply)
Push
Pull
Publisher
Subscriber
XSubscriber
XPublisher
Sockets
Bind & Connect
sock.bind("tcp://10.0.0.1:5555",
function(err) {
..
});
sock.connect("tcp://10.0.0.1:5555");
sock.close();
(*) http://api.zeromq.org/3-2:zmq-bind
(**) http://api.zeromq.org/3-2:zmq-connect
(***) http://api.zeromq.org/3-2:zmq-close
ØMQ C API
zmq_bind(socket, "tcp://10.0.0.1:5555");
zmq_connect(socket, "tcp://10.0.0.1:
5555");
zmq_close(socket);
NodeJS ZMQ
Bind
Connect
Close
Sockets
Bind & Connect
sock.bindSync("tcp://10.0.0.1:5555");
// This line gets executed once the socket
// is binded, but it breaks on error.
NodeJS ZMQ
BindSync
Sockets
Transports
TCP
● usage: tcp://<address>:<port>
sock.bind("tcp://192.168.1.100:5555");
sock.bind("tcp://eth0:5555");
// binds to the first eth0 interface
sock.bind("tcp://*:5555");
// binds to all interfaces
(*) http://api.zeromq.org/3-2:zmq-tcp
ØMQ C API
zmq_bind(socket, "tcp://192.168.1.100:
5555");
zmq_bind(socket, "tcp://eth0:5555");
zmq_bind(socket, "tcp://*:5555");
NodeJS ZMQ
Sockets
Transports
Inter-Process Communication (IPC)
● usage: ipc://<address>
● Requires RW permissions on the specified path.
(*) http://api.zeromq.org/3-2:zmq-ipc
sock.bind("ipc:///tmp/mysocket");
ØMQ C API
zmq_bind(socket, "ipc:///tmp/mysocket");
NodeJS ZMQ
Sockets
Transports
In-process Communication (in-memory)
● usage: inproc://<address>
● Requires to bind before connect.
● Max. address name length is 256.
(*) http://api.zeromq.org/3-2:zmq-inproc
(**) Buggy on node-zmq package.
sock.bind("inproc://queue");
ØMQ C API
zmq_bind(socket, "ipc://queue");
NodeJS ZMQ
Sockets
Transports
PGM (multicast)
● usage: pgm://<address>;<multicast_address>:<port>
● Requires sudo privileges to access raw IP sockets.
● Needs ØMQ built with PGM extension (./configure --with-pgm).
(*) http://api.zeromq.org/3-2:zmq-pgm
sock.bind(
"pgm://192.168.1.100;239.192.1.1:3055"
);
ØMQ C API
zmq_bind(socket, "pgm://192.168.1.100;
239.192.1.1:3055");
NodeJS ZMQ
Sockets
Transports
Encapsulated PGM (multicast)
● usage: epgm://<address>;<multicast_address>:<port>
● Needs ØMQ built with PGM extension (./configure --with-pgm).
(*) http://api.zeromq.org/3-2:zmq-pgm
sock.bind(
"epgm://192.168.1.100;239.192.1.1:3055"
);
ØMQ C API
zmq_bind(socket, "epgm://192.168.1.100;
239.192.1.1:3055");
NodeJS ZMQ
Sockets
Send & Receive
Send
sock.send("My message");
sock.on("message", function(msg) {
console.log(msg.toString());
});
(*) http://api.zeromq.org/3-2:zmq-send
(**) http://api.zeromq.org/3-2:zmq-recv
Receive
sock.on("message", function(msg) {
console.log("Received " + msg);
});
// <msg> is a Buffer object.
Sockets
Multipart messages
ØMQ Queue
zmq_send(socket, "Como", 4, ZMQ_SNDMORE);
Messages are atomic
A ØMQ message is composed of 1 or more
message parts.
zmq_send(socket, "andas", 5, 0);
4 ComoPart 1
5 andasPart 2
ØMQ ensures that peers receive either all message parts of a message or
none at all.
The total number of message parts is unlimited except by available memory.
Sockets
Multipart messages
sock.send("First part", zmq.ZMQ_SNDMORE);
sock.send("Second part");
sock.send(["First part", "Second part"]);
Send
var r = sock.send("Como", zmq.
ZMQ_SNDMORE);
console.log(r);
Check the outgoing buffer and socket state:
running this
will output ->
> { type: 'req',
_zmq: { state: 0, onReady:
[Function] },
_outgoing: [ [ <Buffer 43 6f
6d 6f>, 2 ] ],
_shouldFlush: true,
_events: { message: [Function]
} }
Sockets
Multipart messages
sock.on("message", function(first_part, second_part) {
console.log(first_part.toString());
console.log(second_part.toString());
});
sock.on("message", function() {
for(var key in arguments) {
console.log("Part " + key + ": " + arguments[key]);
};
});
Receive
sock.on("message", function() {
var messages = Array.prototype.slice.call(arguments);
messages.forEach(function(msg) {
console.log("Part:" + msg);
});
});
Sockets
Batched messaging
ØMQ Queue
3 Msg
"ØMQ batches messages in opportunistic manner. It sends all the
messages available at the moment in one go. Latency of subsequent
messages will be improved because sending single batch to the card
is faster then sending lot of small messages."
sock.send("Part A",
zmq.ZMQ_SNDMORE);
sock.send("Msg");
sock.send("Part
B");
6 Part A
6 Part B
ØMQ Socket
send
send
send
<write busy>
<write ready>
Client Thread ØMQ I/O Thread
send
batch
<write busy>
Patterns
Plugging multiple transports
Example
var zmq = require('zmq'),
pub = zmq.socket('pub');
pub.bindSync('tcp://127.0.0.1:5555');
pub.bindSync('ipc:///tmp/zmq.sock');
setInterval(function() {
pub.send("I am polyglot!");
}, 1000);
sub = zmq.socket('sub');
sub.connect('ipc:///tmp/zmq.sock');
sub.subscribe('');
sub.on('message', function(msg) {
console.log("Received: " + msg);
});
var zmq = require('zmq'),
sub = zmq.socket(sub');
sub.connect('tcp://127.0.0.1:5555');
sub.subscribe('');
sub.on('message', function(msg) {
console.log(Received: ' + msg);
});
Sockets
Setting Socket Options
(*) http://api.zeromq.org/3-2:zmq-setsockopt
Setsockopt
● usage (NodeJS ZMQ API): sock.setsockopt(<option>, <value>);
or sock.<option> = <value>;
sock.identity = 'monitor-1';
sock.setsockopt('identity', 'monitor-1');
Identity:
// value can be any string up to 255 length.
// identity is required on sockets
// connecting to a Router.
Sockets
Setting Socket Options
Setsockopt
subscriber.subscribe('MUSIC');
subscriber.setsockopt('subscribe',
'MUSIC');
Subscribe:
// sets a message filter for subscriber sockets.
subscriber.unsubscribe('MUSIC');
susbscriber.setsockopt('subscribe',
'POP');
Unsubscribe:
// sets off a message filter for subscriber
sockets.
4. Patterns
[ ]
Patterns
Request / Reply
Synchronous task distribution
Ø REP #1
Ø REP # 2
Ø REQ
< round robin >
...
< synchronous >
Used when each message needs to be matched with a response. Handles
only one message at time. Strict send-recv cycle.
Patterns
Request / Reply
Ø REP #1 Ø REP # 2Ø REQ
send
recv (wait response)
send
recv (dont wait response)
recv (dont wait response)
Patterns
Request / Reply
Ø REP #1 Ø REP # 2Ø REQ
send
recv
recv
send
send
-> REP #1 is down
FAILURE
REQ #1 will not recover !
Patterns
Request / Reply
Basic Request / Reply
var zmq = require('zmq');
reply = zmq.socket('rep');
reply.bind('tcp://127.0.0.1:5555',
function(err) {
if (err) throw err;
}
);
reply.on('message', function(msg) {
console.log('Received: ' + msg);
reply.send('Pong!');
});
var zmq = require('zmq');
request = zmq.socket('req');
request.connect('tcp://127.0.0.1:5555');
request.send('Ping');
request.on('message', function(msg) {
console.log('Response: ' + msg);
});
Patterns
Request / Reply
Dealer socket message delivery
Messages have to be multipart, consisting on: an empty delimiter header,
followed by the content body parts.
sock.send("Body");
Outgoing Queue
0
6 Body
sock.send(new Buffer([]), zmq.
ZMQ_SNDMORE);
send
send
Patterns
Request / Reply
Dealer socket message delivery
Outgoing messages are round-robined among all connected peers.
However, sending depends on the availability of the receiver.
sock.send(
["", "Msg"]);
Outgoing Queue
3 Msg
6 Part A
Peer Socket A Peer Socket B
sock.send(
["", "Bla");
sock.send(
["", "Msg2"]);
send
send
send
To A
To B
To A
send
<write
ready>
<write
busy>
<write
ready>
0
0
4 Msg2
0
Patterns
Request / Reply
Dealer socket message delivery
Reconnections are handled automatically: messages are asynchronously
delivered. Response time does not block sending more messages.
Outgoing Queue Peer Socket A Peer Socket B
send
-> Up again
sock.send(
["", "Msg"]);
3 Msg
sock.send(
["", "Msg2"]);
send
send
To A
To A
0
4 Msg2
0
Patterns
Request / Reply
Ø REP #1 Ø REP # 2Ø DEALER
enqueue < Msg A >
send < Msg B >
-> REP #1 is down
enqueue < Msg C >
send < Msg A, Msg C >
send < Msg D >
Dealer socket handles peer reconnection automatically. It will send
messages that queued for that peer once it has established connection.
Patterns
Request / Reply
> Response from: 5001
> Response from: 5001
> Response from: 5002
> Response from: 5001
> Response from: 5001
> Response from: 5002
> ...
Dealer example
var dealer = zmq.socket('dealer');
dealer.connect('tcp://127.0.0.1:5001');
dealer.connect('tcp://127.0.0.1:5002');
setInterval(function() {
dealer.send(["", "Msg"]);
}, 1000);
dealer.on('message', function(h, msg) {
console.log('Response from: ' + msg);
});
running this
'might' output
->
Patterns
Request / Reply
Router socket messaging
Messages have to be multipart, consisting on: an identity frame, an empty
delimiter frame, followed by the content body parts. This applies to both
incoming and outgoing messages.
sock.send("Body");
Outgoing Queue
0
6 Body
sock.send("", zmq.
ZMQ_SNDMORE);
send
send
sock.send(
"worker-1", zmq.
ZMQ_SNDMORE); 8 worker-1
send
Patterns
Request / Reply
Router is asynchronous
Incoming messages are fair-queued among all connected and available
peers.
Peer Socket A Peer Socket B
ØMQ Router
Incoming Queue
Socketsend
send
send
Patterns
Request / Reply
Router is asynchronous
Receiving depends on the availability of the sender.
Peer Socket A Peer Socket B
ØMQ Router
Incoming Queue
Socketsend
send
Patterns
Push / Pull
Unidirectional data distribution
The Push / Pull pattern fits well on pipelined communication, i.e., when no
response is required for a given message.
Ø
Ø
...
ØØ
Patterns
Push / Pull
Binding the Push socket
Outgoing messages are round-robined among all connected and available
peers.
push.send("Msg");
push.send("Part
B");
Outgoing Queue Peer Socket A Peer Socket B
push.send("Part A",
zmq.ZMQ_SNDMORE);
push.send("Msg2");
3 Msg
6 Part A
6 Part B
4 Msg2
send
send
send
send
Patterns
Push / Pull
Binding the Push socket
Outgoing messages are round-robined among all connected and available
peers.
Outgoing Queue Peer Socket A Peer Socket B
-> Down3 Msg
6 Part A
6 Part B
4 Msg2
send
send
send
push.send("Msg");
push.send("Part
B");
push.send("Part A",
zmq.ZMQ_SNDMORE);
push.send("Msg2");
send
send
send
send
Patterns
Push / Pull
Binding the Push socket
Disconnections and reconnections are handled automatically.
Outgoing Queue Peer Socket A Peer Socket B
4 More
6 Part 1
6 Part 2
5 Other
send
send
send
push.send("More"); send
push.send("Part
2");
push.send("Part 1",
zmq.ZMQ_SNDMORE);
send
send
push.send("Other");
send
Patterns
Push / Pull
Parallel task distribution
Ø PULL #1
Ø PULL # 2
Ø PUSH
< round robin >
...
Patterns
Push / Pull
Passive agents / Monitor
Ø PULLØ PUSH
...
Ø PUSH
Patterns
Push / Pull
Binding the Pull socket
Push's outgoing messages are round-robined among all connected peers.
push.send("Msg");
push.send("Part
B");
Outgoing Queue Peer Socket A Peer Socket B
push.send("Part A",
zmq.ZMQ_SNDMORE);
push.send("Msg2");
send
send
send
send
3 Msg
6 Part A
6 Part B
4 Msg2
To A
To B
To A
Patterns
Push / Pull
Binding the Pull socket
Push's outgoing messages are round-robined among all connected peers.
push.send("Msg");
push.send("Part
B");
Outgoing Queue Peer Socket A Peer Socket B
push.send("Part A",
zmq.ZMQ_SNDMORE);
push.send("Msg2");
send
send
send
send
send
send
send
3 Msg
6 Part A
6 Part B
4 Msg2
To A
To B
To A
Patterns
Push / Pull
Binding the Pull socket
Disconnections and reconnections are handled automatically.
Outgoing Queue Peer Socket A Peer Socket B
send
send
-> Down4 More
6 Part 1
6 Part 2
5 Other
To A
To A
To B
push.send("More"); send
push.send("Part
2");
push.send("Part 1",
zmq.ZMQ_SNDMORE);
send
send
push.send("Other");
send
Patterns
Push / Pull
Binding the Pull socket
Sending is asynchronous, it depends on the availability of the receiver.
Outgoing Queue Peer Socket A Peer Socket B
send
-> Up again
5 OtherTo B
push.send("More"); send
push.send("Part
2");
push.send("Part 1",
zmq.ZMQ_SNDMORE);
send
send
push.send("Other");
send
Patterns
Push / Pull
Ø PULLØ PUSH #1
...
Ø PUSH #2
Active agents / collector pattern
Patterns
Publish / Subscribe
Broadcast data distribution
Ø SUB #1
Ø PUB #1
...
Ø SUB #2
Ø SUB #2
Message distribution
Patterns
Publish / Subscribe
sock.send("Msg");
Outgoing Queue
3 Msg
Subscriber A
Subscriber B
send
send
Outgoing messages are send to each connected and available peers.
Subscriber C
Message distribution
Patterns
Publish / Subscribe
sock.send("Msg");
Outgoing Queue
3 Msg
Subscriber A
Subscriber B
send
send
Outgoing messages are send to each connected and available peers.
Subscriber C
5 Othersock.send("Other");
send
Subscribers can register to a specific topic.
Data filtering
Patterns
Publish / Subscribe
ØMQ Publisher
Subscriber A
Subscriber B
Subscriber C
Outgoing Queue
subscribe AR
subscribe VE
Socket
subscribe VE
Subscribers can register to a specific topic.
Data filtering
Patterns
Publish / Subscribe
ØMQ Publisher
Subscriber A
Subscriber B
Subscriber C
Outgoing Queue
subscribe AR
subscribe VE
Socket
subscribe VE
sock.send("AR
news");
send
7 AR news
send
Subscribers can register to a specific topic.
Data filtering
Patterns
Publish / Subscribe
ØMQ Publisher
Subscriber A
Subscriber B
Subscriber C
Outgoing Queue
subscribe AR
subscribe VE
Socket
subscribe VE
sock.send("VE
news");
send
7 VE news
sendsend
Patterns
Publish / Subscribe
Data filtering example
pub = zmq.socket('pub');
pub.bindSync("tcp://10.0.0.12:3055");
count = 0
setInterval(function() {
pub.send("TEST " + count++);
}, 1000);
sub = zmq.socket('sub');
sub.connect("tcp://10.0.0.12:3055");
sub.subscribe("TEST");
sub.on("message", function(msg) {
console.log("Received: " + msg);
});
// older messages won't be
// received
> TEST 6
> TEST 7
> TEST 8
> TEST 9
> TEST 10
running this
'might'
output ->
Patterns
Publish / Subscribe
Multicast example
var zmq = require('zmq'),
pub = zmq.socket('pub');
pub.bind(
"epgm://10.0.0.12;239.192.1.1:3055",
function(err) {
if(err) throw err;
}
)
setInterval(function() {
pub.send("From pid: " + process.pid);
}, 1000);
var zmq = require('zmq'),
sub = zmq.socket('sub');
sub.connect(
"epgm://10.0.0.13;239.192.1.1:3055"
);
sub.subscribe("");
sub.on('message', function(msg) {
console.log("Received " + msg);
});
(*) See running demo at http://youtu.be/NQrH0SATPk0
"XSUB and XPUB are exactly like SUB and PUB except they expose
subscriptions as special messages."
Data distribution proxy
Patterns
XSUB / XPUB
XSUB/XPUB Proxy
Subscriber A
Subscriber B
Subscriber C
XPUB Socket
XSUB Socket
Publisher A
Publisher B
Publisher C
subscribe
PY
forward
subscription
Messages are forwarded by the proxy to the registered subscribers.
Data distribution proxy
Patterns
XSUB / XPUB
XSUB/XPUB Proxy
Subscriber A
Subscriber B
Subscriber C
XPUB Socket
XSUB Socket
Publisher A
Publisher B
Publisher C
forward
message
send "PY<msg>"
send
5. Useful links
[ ]
Useful Links
Workshop examples
http://github.com/krakatoa/node_zmq_workshop
Useful Links
The Guide
http://zguide.zeromq.org/page:all
Useful Links
Pieter Hintjens personal blog
http://hintjens.com/
Useful Links
API References
http://api.zeromq.org/3-2:zmq-socket
http://api.zeromq.org/3-2:zmq-setsockopt
Preguntas ?
fedario@gmail.com
github.com/krakatoa
Fernando Dario Alonso
Gracias !

More Related Content

What's hot

Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQ
ICS
 
Overview of ZeroMQ
Overview of ZeroMQOverview of ZeroMQ
Overview of ZeroMQ
pieterh
 
Linux Kernel MMC Storage driver Overview
Linux Kernel MMC Storage driver OverviewLinux Kernel MMC Storage driver Overview
Linux Kernel MMC Storage driver Overview
RajKumar Rampelli
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
Thomas Graf
 
High-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uringHigh-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uring
ScyllaDB
 
Android share preferences
Android share preferencesAndroid share preferences
Android share preferences
Ajay Panchal
 
File Format Benchmark - Avro, JSON, ORC and Parquet
File Format Benchmark - Avro, JSON, ORC and ParquetFile Format Benchmark - Avro, JSON, ORC and Parquet
File Format Benchmark - Avro, JSON, ORC and Parquet
DataWorks Summit/Hadoop Summit
 
Sphinx autodoc - automated api documentation - PyCon.KR 2015
Sphinx autodoc - automated api documentation - PyCon.KR 2015Sphinx autodoc - automated api documentation - PyCon.KR 2015
Sphinx autodoc - automated api documentation - PyCon.KR 2015
Takayuki Shimizukawa
 
Introduction to Apache Spark Developer Training
Introduction to Apache Spark Developer TrainingIntroduction to Apache Spark Developer Training
Introduction to Apache Spark Developer Training
Cloudera, Inc.
 
Linux Network Stack
Linux Network StackLinux Network Stack
Linux Network Stack
Adrien Mahieux
 
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Jérôme Petazzoni
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking Explained
Thomas Graf
 
Custom Controls in ASP.net
Custom Controls in ASP.netCustom Controls in ASP.net
Custom Controls in ASP.net
kunj desai
 
Openstack swift - VietOpenStack 6thmeeetup
Openstack swift - VietOpenStack 6thmeeetupOpenstack swift - VietOpenStack 6thmeeetup
Openstack swift - VietOpenStack 6thmeeetup
Vietnam Open Infrastructure User Group
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
Divye Kapoor
 
Demystifying flink memory allocation and tuning - Roshan Naik, Uber
Demystifying flink memory allocation and tuning - Roshan Naik, UberDemystifying flink memory allocation and tuning - Roshan Naik, Uber
Demystifying flink memory allocation and tuning - Roshan Naik, Uber
Flink Forward
 
Building a redundant CloudStack management cluster - Vladimir Melnik
Building a redundant CloudStack management cluster - Vladimir MelnikBuilding a redundant CloudStack management cluster - Vladimir Melnik
Building a redundant CloudStack management cluster - Vladimir Melnik
ShapeBlue
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking Walkthrough
Thomas Graf
 

What's hot (20)

Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQ
 
Overview of ZeroMQ
Overview of ZeroMQOverview of ZeroMQ
Overview of ZeroMQ
 
Linux Kernel MMC Storage driver Overview
Linux Kernel MMC Storage driver OverviewLinux Kernel MMC Storage driver Overview
Linux Kernel MMC Storage driver Overview
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
 
High-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uringHigh-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uring
 
Android share preferences
Android share preferencesAndroid share preferences
Android share preferences
 
CAP Theorem
CAP TheoremCAP Theorem
CAP Theorem
 
File Format Benchmark - Avro, JSON, ORC and Parquet
File Format Benchmark - Avro, JSON, ORC and ParquetFile Format Benchmark - Avro, JSON, ORC and Parquet
File Format Benchmark - Avro, JSON, ORC and Parquet
 
Sphinx autodoc - automated api documentation - PyCon.KR 2015
Sphinx autodoc - automated api documentation - PyCon.KR 2015Sphinx autodoc - automated api documentation - PyCon.KR 2015
Sphinx autodoc - automated api documentation - PyCon.KR 2015
 
Introduction to Apache Spark Developer Training
Introduction to Apache Spark Developer TrainingIntroduction to Apache Spark Developer Training
Introduction to Apache Spark Developer Training
 
Linux Network Stack
Linux Network StackLinux Network Stack
Linux Network Stack
 
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking Explained
 
Custom Controls in ASP.net
Custom Controls in ASP.netCustom Controls in ASP.net
Custom Controls in ASP.net
 
Openstack swift - VietOpenStack 6thmeeetup
Openstack swift - VietOpenStack 6thmeeetupOpenstack swift - VietOpenStack 6thmeeetup
Openstack swift - VietOpenStack 6thmeeetup
 
GNS3
GNS3GNS3
GNS3
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
 
Demystifying flink memory allocation and tuning - Roshan Naik, Uber
Demystifying flink memory allocation and tuning - Roshan Naik, UberDemystifying flink memory allocation and tuning - Roshan Naik, Uber
Demystifying flink memory allocation and tuning - Roshan Naik, Uber
 
Building a redundant CloudStack management cluster - Vladimir Melnik
Building a redundant CloudStack management cluster - Vladimir MelnikBuilding a redundant CloudStack management cluster - Vladimir Melnik
Building a redundant CloudStack management cluster - Vladimir Melnik
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking Walkthrough
 

Viewers also liked

Ten Key Factors that Influence Successful Bilingualism and Multilingualism
Ten Key Factors that Influence Successful Bilingualism and MultilingualismTen Key Factors that Influence Successful Bilingualism and Multilingualism
Ten Key Factors that Influence Successful Bilingualism and Multilingualism
Sjoerd Heeringa
 
On-line book store presentation
On-line book store presentation On-line book store presentation
On-line book store presentation
Smit Patel
 
The Power of Color in Branding
The Power of Color in BrandingThe Power of Color in Branding
The Power of Color in Branding
dezinegirl creative studio
 
Key Passages in Jane Eyre
Key Passages in Jane EyreKey Passages in Jane Eyre
Key Passages in Jane Eyre
J Aragonite
 
5000 Sat Words With Definitions
5000 Sat Words With Definitions5000 Sat Words With Definitions
5000 Sat Words With Definitions
Brent Daigle, Ph.D.
 
4. heredity and evolution
4. heredity and evolution4. heredity and evolution
4. heredity and evolution
Abhay Goyal
 
Internet of Things (IOT) - Technology and Applications
Internet of Things (IOT) - Technology and ApplicationsInternet of Things (IOT) - Technology and Applications
Internet of Things (IOT) - Technology and Applications
Dr. Mazlan Abbas
 
New Time Mgt
New Time MgtNew Time Mgt
New Time Mgt
talcpowder
 
Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...
Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...
Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...
Probir Bidhan
 
Mathematics high school level quiz - Part I
Mathematics high school level quiz - Part IMathematics high school level quiz - Part I
Mathematics high school level quiz - Part I
ITfC-Edu-Team
 
61 Beautiful & Inspirational Timeline Cover on Facebook
61 Beautiful & Inspirational Timeline Cover on Facebook61 Beautiful & Inspirational Timeline Cover on Facebook
61 Beautiful & Inspirational Timeline Cover on FacebookConsonaute
 
Thai tech startup ecosystem report 2017
Thai tech startup ecosystem report 2017Thai tech startup ecosystem report 2017
Thai tech startup ecosystem report 2017
Techsauce Media
 
Mri brain anatomy Dr Muhammad Bin Zulfiqar
Mri brain anatomy Dr Muhammad Bin ZulfiqarMri brain anatomy Dr Muhammad Bin Zulfiqar
Mri brain anatomy Dr Muhammad Bin Zulfiqar
Dr. Muhammad Bin Zulfiqar
 
Lean Manufacturing - Toyota Production System
Lean Manufacturing - Toyota Production SystemLean Manufacturing - Toyota Production System
Lean Manufacturing - Toyota Production System
Mohammed Hamed Ahmed Soliman
 
Engaging Learners with Technology
Engaging Learners with TechnologyEngaging Learners with Technology
Engaging Learners with Technology
Dean Shareski
 
Vernacular Architecture (Case Study- H.P.)
Vernacular Architecture (Case Study- H.P.)Vernacular Architecture (Case Study- H.P.)
Vernacular Architecture (Case Study- H.P.)divya_binu
 
Principles and Practices in Continuous Deployment at Etsy
Principles and Practices in Continuous Deployment at EtsyPrinciples and Practices in Continuous Deployment at Etsy
Principles and Practices in Continuous Deployment at Etsy
Mike Brittain
 

Viewers also liked (20)

Ten Key Factors that Influence Successful Bilingualism and Multilingualism
Ten Key Factors that Influence Successful Bilingualism and MultilingualismTen Key Factors that Influence Successful Bilingualism and Multilingualism
Ten Key Factors that Influence Successful Bilingualism and Multilingualism
 
On-line book store presentation
On-line book store presentation On-line book store presentation
On-line book store presentation
 
The Power of Color in Branding
The Power of Color in BrandingThe Power of Color in Branding
The Power of Color in Branding
 
Key Passages in Jane Eyre
Key Passages in Jane EyreKey Passages in Jane Eyre
Key Passages in Jane Eyre
 
Biofertilizer
BiofertilizerBiofertilizer
Biofertilizer
 
5000 Sat Words With Definitions
5000 Sat Words With Definitions5000 Sat Words With Definitions
5000 Sat Words With Definitions
 
4. heredity and evolution
4. heredity and evolution4. heredity and evolution
4. heredity and evolution
 
Internet of Things (IOT) - Technology and Applications
Internet of Things (IOT) - Technology and ApplicationsInternet of Things (IOT) - Technology and Applications
Internet of Things (IOT) - Technology and Applications
 
New Time Mgt
New Time MgtNew Time Mgt
New Time Mgt
 
BUSINESS QUIZ -Round 1
 BUSINESS QUIZ -Round 1 BUSINESS QUIZ -Round 1
BUSINESS QUIZ -Round 1
 
Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...
Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...
Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...
 
Mathematics high school level quiz - Part I
Mathematics high school level quiz - Part IMathematics high school level quiz - Part I
Mathematics high school level quiz - Part I
 
61 Beautiful & Inspirational Timeline Cover on Facebook
61 Beautiful & Inspirational Timeline Cover on Facebook61 Beautiful & Inspirational Timeline Cover on Facebook
61 Beautiful & Inspirational Timeline Cover on Facebook
 
Thai tech startup ecosystem report 2017
Thai tech startup ecosystem report 2017Thai tech startup ecosystem report 2017
Thai tech startup ecosystem report 2017
 
Mri brain anatomy Dr Muhammad Bin Zulfiqar
Mri brain anatomy Dr Muhammad Bin ZulfiqarMri brain anatomy Dr Muhammad Bin Zulfiqar
Mri brain anatomy Dr Muhammad Bin Zulfiqar
 
Lean Manufacturing - Toyota Production System
Lean Manufacturing - Toyota Production SystemLean Manufacturing - Toyota Production System
Lean Manufacturing - Toyota Production System
 
Engaging Learners with Technology
Engaging Learners with TechnologyEngaging Learners with Technology
Engaging Learners with Technology
 
Vernacular Architecture (Case Study- H.P.)
Vernacular Architecture (Case Study- H.P.)Vernacular Architecture (Case Study- H.P.)
Vernacular Architecture (Case Study- H.P.)
 
Principles and Practices in Continuous Deployment at Etsy
Principles and Practices in Continuous Deployment at EtsyPrinciples and Practices in Continuous Deployment at Etsy
Principles and Practices in Continuous Deployment at Etsy
 
BIOLOGICAL DIVERSITY
BIOLOGICAL DIVERSITYBIOLOGICAL DIVERSITY
BIOLOGICAL DIVERSITY
 

Similar to ZeroMQ with NodeJS

ZeroMQ - Sockets on steroids!
ZeroMQ - Sockets on steroids!ZeroMQ - Sockets on steroids!
ZeroMQ - Sockets on steroids!
Pedro Januário
 
Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)Anil Madhavapeddy
 
MQTT enabling the smallest things
MQTT enabling the smallest thingsMQTT enabling the smallest things
MQTT enabling the smallest things
Ian Craggs
 
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland
 
CurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious CharactersCurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious Characters
pieterh
 
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOSBuilding a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Fernando Luiz Cola
 
Where is My Message
Where is My MessageWhere is My Message
Where is My Message
Matt Leming
 
Zmq in context of openstack
Zmq in context of openstackZmq in context of openstack
Zmq in context of openstack
Yatin Kumbhare
 
NUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osioNUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osio
Hajime Tazaki
 
DCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystem
DCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystemDCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystem
DCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystem
rudndccn
 
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 FinalExploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Finalmasoodnt10
 
Attacks and their mitigations
Attacks and their mitigationsAttacks and their mitigations
Attacks and their mitigations
Mukesh Chaudhari
 
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Jakub Botwicz
 
Bar-BoF session about Simplemux at IETF93, Prague
Bar-BoF session about Simplemux at IETF93, PragueBar-BoF session about Simplemux at IETF93, Prague
Bar-BoF session about Simplemux at IETF93, Prague
Jose Saldana
 
Mom those things v1
Mom those things v1 Mom those things v1
Mom those things v1 von gosling
 
Where is my MQ message on z/OS?
Where is my MQ message on z/OS?Where is my MQ message on z/OS?
Where is my MQ message on z/OS?
Matt Leming
 
øMQ Vortrag
øMQ VortragøMQ Vortrag
øMQ Vortrag
mirosso25
 
IBM Spectrum Scale Network Flows
IBM Spectrum Scale Network FlowsIBM Spectrum Scale Network Flows
IBM Spectrum Scale Network Flows
Tomer Perry
 

Similar to ZeroMQ with NodeJS (20)

ZeroMQ - Sockets on steroids!
ZeroMQ - Sockets on steroids!ZeroMQ - Sockets on steroids!
ZeroMQ - Sockets on steroids!
 
Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)
 
MQTT enabling the smallest things
MQTT enabling the smallest thingsMQTT enabling the smallest things
MQTT enabling the smallest things
 
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
 
CurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious CharactersCurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious Characters
 
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOSBuilding a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
 
Where is My Message
Where is My MessageWhere is My Message
Where is My Message
 
Zmq in context of openstack
Zmq in context of openstackZmq in context of openstack
Zmq in context of openstack
 
NUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osioNUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osio
 
mTCP使ってみた
mTCP使ってみたmTCP使ってみた
mTCP使ってみた
 
Tcpdump
TcpdumpTcpdump
Tcpdump
 
DCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystem
DCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystemDCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystem
DCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystem
 
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 FinalExploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
 
Attacks and their mitigations
Attacks and their mitigationsAttacks and their mitigations
Attacks and their mitigations
 
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
 
Bar-BoF session about Simplemux at IETF93, Prague
Bar-BoF session about Simplemux at IETF93, PragueBar-BoF session about Simplemux at IETF93, Prague
Bar-BoF session about Simplemux at IETF93, Prague
 
Mom those things v1
Mom those things v1 Mom those things v1
Mom those things v1
 
Where is my MQ message on z/OS?
Where is my MQ message on z/OS?Where is my MQ message on z/OS?
Where is my MQ message on z/OS?
 
øMQ Vortrag
øMQ VortragøMQ Vortrag
øMQ Vortrag
 
IBM Spectrum Scale Network Flows
IBM Spectrum Scale Network FlowsIBM Spectrum Scale Network Flows
IBM Spectrum Scale Network Flows
 

Recently uploaded

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 

Recently uploaded (20)

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 

ZeroMQ with NodeJS

  • 1. ØMQ @ NodeJS ØMQ: Small Pieces for Scalable Software Fernando D. Alonso
  • 2. 1. Facts about ØMQ [ ]
  • 3. Facts about ØMQ Low level messaging library ○ It is written in C++. ○ A thin layer between application and transport layers. ○ Message-passing using in-memory queues. ○ Concise API which talks over the ZMTP protocol. ○ Works on top of TCP, IPC, in-memory, and PGM/EPGM communication protocols.
  • 4. ○ Philosophy: horizontal scalability to reduce points of failure. ○ Network topology aware. Point to point communication reduce latencies. ○ Communication is reduced to a few patterns, which combined are powerful. ○ No need to have a multitenant service. Facts about ØMQ A broker is not mandatory
  • 5. Facts about ØMQ Messaged oriented communication ○ Messages as first-class citizen. No need to fight with framing or buffering. ○ You can send multipart messages. ○ Messages are atomic. ○ Asynchronous messaging. A single background I/O thread does the job for ØMQ sockets. "A ØMQ message is a discrete unit of data passed between applications or components of the same application. ØMQ messages have no internal structure and from the point of view of ØMQ itself they are considered to be opaque binary data."
  • 6. Facts about ØMQ Fast for development ○ Interchangeable transports: e.g, scaling from one IPC server to a bunch of TCP. ○ Automatic reconnections. ○ Multicore made easy. ○ Provides zmq_poll to read BSD sockets.
  • 7. ○ It doesn't provide message persistence. ○ It doesn't provide data serialization. ○ It doesn't provide data compression. ○ It doesn't provide message encryption. ○ It doesn't provide security mechanisms. Not in the next version of the ZMTP protocol ! (*) ZTMP 3.0 draft protocol: http://hintjens.com/blog:39 Facts about ØMQ Aims for simplicity
  • 8. Facts about ØMQ Platforms & Languages ○ Bindings for 30+ languages including NodeJS, Ruby, Python, Java, C, C++, Scala, Erlang, Perl, PHP, .NET. ○ Linux & Windows. ○ Raspberry PI. ○ Android OS.
  • 10. Install On Linux from source sudo apt-get install build-essential libtool autoconf automake uuid-dev wget http://download.zeromq.org/zeromq-3.2.3.tar.gz tar xvzf zeromq-3.2.3.tar.gz ./configure make sudo make install sudo ldconfig NOTES: (*) Check http://download.zeromq.org/ for more versions. (**) Avoid 3.0.x, 3.1.x, 3.2.0, 3.2.1 versions. They lack backwards compatibility. (***) Check ./configure --help for more options on build. (****) ./configure --with-pgm
  • 11. Install On Linux using packages Libzmq 3.2: ● Debian Sid: sudo apt-get install libzmq3-dev Libzmq 2.2: ● Debian Wheezy, Jessie, Sid: sudo apt-get install libzmq-dev ● Debian Squeeze backport: http://packages.debian.org/squeeze- backports/libzmq1
  • 13. Install NodeJS bindings NPM Packages: ● zmq (https://github.com/JustinTulloss/zeromq.node) [RECOMMENDED] ● zmq-stream (https://github.com/Schoonology/zmq-stream) npm install zmq node > var zmq = require('zmq');
  • 14. Install Bindings in other languages Ruby: https://github.com/chuckremes/ffi-rzmq [RECOMMENDED] Python: https://github.com/zeromq/pyzmq Erlang: https://github.com/zeromq/erlzmq2 Java JZMQ (uses JNI): https://github.com/zeromq/jzmq Java JeroMQ: https://github.com/zeromq/jeromq Scala ZeroMQ: https://github.com/mDialog/scala-zeromq Scala ZeroMQ (official): https://github.com/valotrading/zeromq-scala-binding ...
  • 16. Sockets Creation (*) http://api.zeromq.org/3-2:zmq-socket ØMQ C API NodeJS ZMQ req ZMQ_REQ rep ZMQ_REP dealer ZMQ_DEALER router ZMQ_ROUTER push ZMQ_PUSH pull ZMQ_PULL ØMQ C APINodeJS ZMQ pub ZMQ_PUB sub ZMQ_SUB xsub ZMQ_XSUB xpub ZMQ_XPUB var sock = zmq.socket ("<SOCKET_TYPE>"); zmq_socket(context, <SOCKET_TYPE>); Request Reply Dealer (async Request) Router (async Reply) Push Pull Publisher Subscriber XSubscriber XPublisher
  • 17. Sockets Bind & Connect sock.bind("tcp://10.0.0.1:5555", function(err) { .. }); sock.connect("tcp://10.0.0.1:5555"); sock.close(); (*) http://api.zeromq.org/3-2:zmq-bind (**) http://api.zeromq.org/3-2:zmq-connect (***) http://api.zeromq.org/3-2:zmq-close ØMQ C API zmq_bind(socket, "tcp://10.0.0.1:5555"); zmq_connect(socket, "tcp://10.0.0.1: 5555"); zmq_close(socket); NodeJS ZMQ Bind Connect Close
  • 18. Sockets Bind & Connect sock.bindSync("tcp://10.0.0.1:5555"); // This line gets executed once the socket // is binded, but it breaks on error. NodeJS ZMQ BindSync
  • 19. Sockets Transports TCP ● usage: tcp://<address>:<port> sock.bind("tcp://192.168.1.100:5555"); sock.bind("tcp://eth0:5555"); // binds to the first eth0 interface sock.bind("tcp://*:5555"); // binds to all interfaces (*) http://api.zeromq.org/3-2:zmq-tcp ØMQ C API zmq_bind(socket, "tcp://192.168.1.100: 5555"); zmq_bind(socket, "tcp://eth0:5555"); zmq_bind(socket, "tcp://*:5555"); NodeJS ZMQ
  • 20. Sockets Transports Inter-Process Communication (IPC) ● usage: ipc://<address> ● Requires RW permissions on the specified path. (*) http://api.zeromq.org/3-2:zmq-ipc sock.bind("ipc:///tmp/mysocket"); ØMQ C API zmq_bind(socket, "ipc:///tmp/mysocket"); NodeJS ZMQ
  • 21. Sockets Transports In-process Communication (in-memory) ● usage: inproc://<address> ● Requires to bind before connect. ● Max. address name length is 256. (*) http://api.zeromq.org/3-2:zmq-inproc (**) Buggy on node-zmq package. sock.bind("inproc://queue"); ØMQ C API zmq_bind(socket, "ipc://queue"); NodeJS ZMQ
  • 22. Sockets Transports PGM (multicast) ● usage: pgm://<address>;<multicast_address>:<port> ● Requires sudo privileges to access raw IP sockets. ● Needs ØMQ built with PGM extension (./configure --with-pgm). (*) http://api.zeromq.org/3-2:zmq-pgm sock.bind( "pgm://192.168.1.100;239.192.1.1:3055" ); ØMQ C API zmq_bind(socket, "pgm://192.168.1.100; 239.192.1.1:3055"); NodeJS ZMQ
  • 23. Sockets Transports Encapsulated PGM (multicast) ● usage: epgm://<address>;<multicast_address>:<port> ● Needs ØMQ built with PGM extension (./configure --with-pgm). (*) http://api.zeromq.org/3-2:zmq-pgm sock.bind( "epgm://192.168.1.100;239.192.1.1:3055" ); ØMQ C API zmq_bind(socket, "epgm://192.168.1.100; 239.192.1.1:3055"); NodeJS ZMQ
  • 24. Sockets Send & Receive Send sock.send("My message"); sock.on("message", function(msg) { console.log(msg.toString()); }); (*) http://api.zeromq.org/3-2:zmq-send (**) http://api.zeromq.org/3-2:zmq-recv Receive sock.on("message", function(msg) { console.log("Received " + msg); }); // <msg> is a Buffer object.
  • 25. Sockets Multipart messages ØMQ Queue zmq_send(socket, "Como", 4, ZMQ_SNDMORE); Messages are atomic A ØMQ message is composed of 1 or more message parts. zmq_send(socket, "andas", 5, 0); 4 ComoPart 1 5 andasPart 2 ØMQ ensures that peers receive either all message parts of a message or none at all. The total number of message parts is unlimited except by available memory.
  • 26. Sockets Multipart messages sock.send("First part", zmq.ZMQ_SNDMORE); sock.send("Second part"); sock.send(["First part", "Second part"]); Send var r = sock.send("Como", zmq. ZMQ_SNDMORE); console.log(r); Check the outgoing buffer and socket state: running this will output -> > { type: 'req', _zmq: { state: 0, onReady: [Function] }, _outgoing: [ [ <Buffer 43 6f 6d 6f>, 2 ] ], _shouldFlush: true, _events: { message: [Function] } }
  • 27. Sockets Multipart messages sock.on("message", function(first_part, second_part) { console.log(first_part.toString()); console.log(second_part.toString()); }); sock.on("message", function() { for(var key in arguments) { console.log("Part " + key + ": " + arguments[key]); }; }); Receive sock.on("message", function() { var messages = Array.prototype.slice.call(arguments); messages.forEach(function(msg) { console.log("Part:" + msg); }); });
  • 28. Sockets Batched messaging ØMQ Queue 3 Msg "ØMQ batches messages in opportunistic manner. It sends all the messages available at the moment in one go. Latency of subsequent messages will be improved because sending single batch to the card is faster then sending lot of small messages." sock.send("Part A", zmq.ZMQ_SNDMORE); sock.send("Msg"); sock.send("Part B"); 6 Part A 6 Part B ØMQ Socket send send send <write busy> <write ready> Client Thread ØMQ I/O Thread send batch <write busy>
  • 29. Patterns Plugging multiple transports Example var zmq = require('zmq'), pub = zmq.socket('pub'); pub.bindSync('tcp://127.0.0.1:5555'); pub.bindSync('ipc:///tmp/zmq.sock'); setInterval(function() { pub.send("I am polyglot!"); }, 1000); sub = zmq.socket('sub'); sub.connect('ipc:///tmp/zmq.sock'); sub.subscribe(''); sub.on('message', function(msg) { console.log("Received: " + msg); }); var zmq = require('zmq'), sub = zmq.socket(sub'); sub.connect('tcp://127.0.0.1:5555'); sub.subscribe(''); sub.on('message', function(msg) { console.log(Received: ' + msg); });
  • 30. Sockets Setting Socket Options (*) http://api.zeromq.org/3-2:zmq-setsockopt Setsockopt ● usage (NodeJS ZMQ API): sock.setsockopt(<option>, <value>); or sock.<option> = <value>; sock.identity = 'monitor-1'; sock.setsockopt('identity', 'monitor-1'); Identity: // value can be any string up to 255 length. // identity is required on sockets // connecting to a Router.
  • 31. Sockets Setting Socket Options Setsockopt subscriber.subscribe('MUSIC'); subscriber.setsockopt('subscribe', 'MUSIC'); Subscribe: // sets a message filter for subscriber sockets. subscriber.unsubscribe('MUSIC'); susbscriber.setsockopt('subscribe', 'POP'); Unsubscribe: // sets off a message filter for subscriber sockets.
  • 33. Patterns Request / Reply Synchronous task distribution Ø REP #1 Ø REP # 2 Ø REQ < round robin > ... < synchronous > Used when each message needs to be matched with a response. Handles only one message at time. Strict send-recv cycle.
  • 34. Patterns Request / Reply Ø REP #1 Ø REP # 2Ø REQ send recv (wait response) send recv (dont wait response) recv (dont wait response)
  • 35. Patterns Request / Reply Ø REP #1 Ø REP # 2Ø REQ send recv recv send send -> REP #1 is down FAILURE REQ #1 will not recover !
  • 36. Patterns Request / Reply Basic Request / Reply var zmq = require('zmq'); reply = zmq.socket('rep'); reply.bind('tcp://127.0.0.1:5555', function(err) { if (err) throw err; } ); reply.on('message', function(msg) { console.log('Received: ' + msg); reply.send('Pong!'); }); var zmq = require('zmq'); request = zmq.socket('req'); request.connect('tcp://127.0.0.1:5555'); request.send('Ping'); request.on('message', function(msg) { console.log('Response: ' + msg); });
  • 37. Patterns Request / Reply Dealer socket message delivery Messages have to be multipart, consisting on: an empty delimiter header, followed by the content body parts. sock.send("Body"); Outgoing Queue 0 6 Body sock.send(new Buffer([]), zmq. ZMQ_SNDMORE); send send
  • 38. Patterns Request / Reply Dealer socket message delivery Outgoing messages are round-robined among all connected peers. However, sending depends on the availability of the receiver. sock.send( ["", "Msg"]); Outgoing Queue 3 Msg 6 Part A Peer Socket A Peer Socket B sock.send( ["", "Bla"); sock.send( ["", "Msg2"]); send send send To A To B To A send <write ready> <write busy> <write ready> 0 0 4 Msg2 0
  • 39. Patterns Request / Reply Dealer socket message delivery Reconnections are handled automatically: messages are asynchronously delivered. Response time does not block sending more messages. Outgoing Queue Peer Socket A Peer Socket B send -> Up again sock.send( ["", "Msg"]); 3 Msg sock.send( ["", "Msg2"]); send send To A To A 0 4 Msg2 0
  • 40. Patterns Request / Reply Ø REP #1 Ø REP # 2Ø DEALER enqueue < Msg A > send < Msg B > -> REP #1 is down enqueue < Msg C > send < Msg A, Msg C > send < Msg D > Dealer socket handles peer reconnection automatically. It will send messages that queued for that peer once it has established connection.
  • 41. Patterns Request / Reply > Response from: 5001 > Response from: 5001 > Response from: 5002 > Response from: 5001 > Response from: 5001 > Response from: 5002 > ... Dealer example var dealer = zmq.socket('dealer'); dealer.connect('tcp://127.0.0.1:5001'); dealer.connect('tcp://127.0.0.1:5002'); setInterval(function() { dealer.send(["", "Msg"]); }, 1000); dealer.on('message', function(h, msg) { console.log('Response from: ' + msg); }); running this 'might' output ->
  • 42. Patterns Request / Reply Router socket messaging Messages have to be multipart, consisting on: an identity frame, an empty delimiter frame, followed by the content body parts. This applies to both incoming and outgoing messages. sock.send("Body"); Outgoing Queue 0 6 Body sock.send("", zmq. ZMQ_SNDMORE); send send sock.send( "worker-1", zmq. ZMQ_SNDMORE); 8 worker-1 send
  • 43. Patterns Request / Reply Router is asynchronous Incoming messages are fair-queued among all connected and available peers. Peer Socket A Peer Socket B ØMQ Router Incoming Queue Socketsend send send
  • 44. Patterns Request / Reply Router is asynchronous Receiving depends on the availability of the sender. Peer Socket A Peer Socket B ØMQ Router Incoming Queue Socketsend send
  • 45. Patterns Push / Pull Unidirectional data distribution The Push / Pull pattern fits well on pipelined communication, i.e., when no response is required for a given message. Ø Ø ... ØØ
  • 46. Patterns Push / Pull Binding the Push socket Outgoing messages are round-robined among all connected and available peers. push.send("Msg"); push.send("Part B"); Outgoing Queue Peer Socket A Peer Socket B push.send("Part A", zmq.ZMQ_SNDMORE); push.send("Msg2"); 3 Msg 6 Part A 6 Part B 4 Msg2 send send send send
  • 47. Patterns Push / Pull Binding the Push socket Outgoing messages are round-robined among all connected and available peers. Outgoing Queue Peer Socket A Peer Socket B -> Down3 Msg 6 Part A 6 Part B 4 Msg2 send send send push.send("Msg"); push.send("Part B"); push.send("Part A", zmq.ZMQ_SNDMORE); push.send("Msg2"); send send send send
  • 48. Patterns Push / Pull Binding the Push socket Disconnections and reconnections are handled automatically. Outgoing Queue Peer Socket A Peer Socket B 4 More 6 Part 1 6 Part 2 5 Other send send send push.send("More"); send push.send("Part 2"); push.send("Part 1", zmq.ZMQ_SNDMORE); send send push.send("Other"); send
  • 49. Patterns Push / Pull Parallel task distribution Ø PULL #1 Ø PULL # 2 Ø PUSH < round robin > ...
  • 50. Patterns Push / Pull Passive agents / Monitor Ø PULLØ PUSH ... Ø PUSH
  • 51. Patterns Push / Pull Binding the Pull socket Push's outgoing messages are round-robined among all connected peers. push.send("Msg"); push.send("Part B"); Outgoing Queue Peer Socket A Peer Socket B push.send("Part A", zmq.ZMQ_SNDMORE); push.send("Msg2"); send send send send 3 Msg 6 Part A 6 Part B 4 Msg2 To A To B To A
  • 52. Patterns Push / Pull Binding the Pull socket Push's outgoing messages are round-robined among all connected peers. push.send("Msg"); push.send("Part B"); Outgoing Queue Peer Socket A Peer Socket B push.send("Part A", zmq.ZMQ_SNDMORE); push.send("Msg2"); send send send send send send send 3 Msg 6 Part A 6 Part B 4 Msg2 To A To B To A
  • 53. Patterns Push / Pull Binding the Pull socket Disconnections and reconnections are handled automatically. Outgoing Queue Peer Socket A Peer Socket B send send -> Down4 More 6 Part 1 6 Part 2 5 Other To A To A To B push.send("More"); send push.send("Part 2"); push.send("Part 1", zmq.ZMQ_SNDMORE); send send push.send("Other"); send
  • 54. Patterns Push / Pull Binding the Pull socket Sending is asynchronous, it depends on the availability of the receiver. Outgoing Queue Peer Socket A Peer Socket B send -> Up again 5 OtherTo B push.send("More"); send push.send("Part 2"); push.send("Part 1", zmq.ZMQ_SNDMORE); send send push.send("Other"); send
  • 55. Patterns Push / Pull Ø PULLØ PUSH #1 ... Ø PUSH #2 Active agents / collector pattern
  • 56. Patterns Publish / Subscribe Broadcast data distribution Ø SUB #1 Ø PUB #1 ... Ø SUB #2 Ø SUB #2
  • 57. Message distribution Patterns Publish / Subscribe sock.send("Msg"); Outgoing Queue 3 Msg Subscriber A Subscriber B send send Outgoing messages are send to each connected and available peers. Subscriber C
  • 58. Message distribution Patterns Publish / Subscribe sock.send("Msg"); Outgoing Queue 3 Msg Subscriber A Subscriber B send send Outgoing messages are send to each connected and available peers. Subscriber C 5 Othersock.send("Other"); send
  • 59. Subscribers can register to a specific topic. Data filtering Patterns Publish / Subscribe ØMQ Publisher Subscriber A Subscriber B Subscriber C Outgoing Queue subscribe AR subscribe VE Socket subscribe VE
  • 60. Subscribers can register to a specific topic. Data filtering Patterns Publish / Subscribe ØMQ Publisher Subscriber A Subscriber B Subscriber C Outgoing Queue subscribe AR subscribe VE Socket subscribe VE sock.send("AR news"); send 7 AR news send
  • 61. Subscribers can register to a specific topic. Data filtering Patterns Publish / Subscribe ØMQ Publisher Subscriber A Subscriber B Subscriber C Outgoing Queue subscribe AR subscribe VE Socket subscribe VE sock.send("VE news"); send 7 VE news sendsend
  • 62. Patterns Publish / Subscribe Data filtering example pub = zmq.socket('pub'); pub.bindSync("tcp://10.0.0.12:3055"); count = 0 setInterval(function() { pub.send("TEST " + count++); }, 1000); sub = zmq.socket('sub'); sub.connect("tcp://10.0.0.12:3055"); sub.subscribe("TEST"); sub.on("message", function(msg) { console.log("Received: " + msg); }); // older messages won't be // received > TEST 6 > TEST 7 > TEST 8 > TEST 9 > TEST 10 running this 'might' output ->
  • 63. Patterns Publish / Subscribe Multicast example var zmq = require('zmq'), pub = zmq.socket('pub'); pub.bind( "epgm://10.0.0.12;239.192.1.1:3055", function(err) { if(err) throw err; } ) setInterval(function() { pub.send("From pid: " + process.pid); }, 1000); var zmq = require('zmq'), sub = zmq.socket('sub'); sub.connect( "epgm://10.0.0.13;239.192.1.1:3055" ); sub.subscribe(""); sub.on('message', function(msg) { console.log("Received " + msg); }); (*) See running demo at http://youtu.be/NQrH0SATPk0
  • 64. "XSUB and XPUB are exactly like SUB and PUB except they expose subscriptions as special messages." Data distribution proxy Patterns XSUB / XPUB XSUB/XPUB Proxy Subscriber A Subscriber B Subscriber C XPUB Socket XSUB Socket Publisher A Publisher B Publisher C subscribe PY forward subscription
  • 65. Messages are forwarded by the proxy to the registered subscribers. Data distribution proxy Patterns XSUB / XPUB XSUB/XPUB Proxy Subscriber A Subscriber B Subscriber C XPUB Socket XSUB Socket Publisher A Publisher B Publisher C forward message send "PY<msg>" send
  • 69. Useful Links Pieter Hintjens personal blog http://hintjens.com/