2. ØMQ – what it is and what it’s not
ØMQ is:
Broker-less
Fast (Ø-latency)
Distributed
Library
Open-source (LGPL)
ØMQ is not/doesn’t have:
Centralized message queue server
Administration UI
Image credit: Randy Bias/cloudscaling.com
3. ØMQ – how to use it?
Server (server.py)
import zmq
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://*:%s" % 5556)
while True:
message = socket.recv()
print "Received: ", message
socket.send(”Server ack”)
4. ØMQ – how to use it?
Client (client.py)
import zmq
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect("tcp://localhost:%s" % 5556)
socket.send("Greetings")
message = socket.recv()
print "Received reply: ", message
5. ØMQ – how to use it?
$ python server.py
$ python client.py
Received: Greetings
Received: Greetings
$ python client.py
Received reply: Server ack
Received reply: Server ack
6. ØMQ – Threads, synchronization
I am OS Thread,
nice to meet you.
OS threads vs. Green threads
Mutex, semaphore
Go away GIL, you’re drunk!
Image credit: https://community.eveonline.com/news/dev-blogs/carbonio-and-bluenet-next-level-network-technology-1/
7. ØMQ – Threads, synchronization
Image credit: https://community.eveonline.com/news/dev-blogs/carbonio-and-bluenet-next-level-network-technology-1/
Some people, when confronted
with a problem, think, "I know, I'll
use mutexes.”
Now they have
Some people, when confronted with a
problem, think "I know, I'll use
multithreading".
Nothhw tpe yawrve o oblems.