SlideShare uma empresa Scribd logo
1 de 25
Distributed queues with
ØMQ
A QUICK GUIDE
Ø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
Ø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”)
Ø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
Ø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
Ø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/
Ø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.
ØMQ – Threads, synchronization
Image credit: http://www.tivix.com/blog/lets-go-python/
ØMQ – socket types
 REQ-REP
Image credit: http://zguide.zeromq.org/
ØMQ – socket types
 PUSH-PULL
Image credit: http://zguide.zeromq.org/
ØMQ – socket types
 PUB-SUB
Image credit: http://zguide.zeromq.org/
ØMQ – socket types
 Advanced
PUB-SUB
XPUB-XSUB
Image credit: http://zguide.zeromq.org/
ØMQ – message structure
 Multi-frame
 Header
 Body
Image credit: http://zguide.zeromq.org/
ØMQ – socket types
 DEALER
 A.k.a. proxy
 Round-robin
distribution
 One-way
distribution
Image credit: http://zguide.zeromq.org/
ØMQ – socket types
 ROUTER
 Directed messages
 Can perform non-uniform
distribution, based on
message type
Image credit: http://zguide.zeromq.org/
ØMQ – socket types
 PAIR
 Sync between threads
 Uses inproc://
Image credit: http://zguide.zeromq.org/
ØMQ – socket types
 Supported socket transports
Image credit: http://zguide.zeromq.org/
socket = context.bind(”tcp://0.0.0.0:5555")
socket = context.bind(”inproc://endpoint")
socket = context.bind(”icp:///tmp/socket_descriptor")
socket = context.bind(”epgm://host:port ")
socket = context.bind(”tcp://eth0:5555")
ØMQ – POSIX socket basics
 Bind and connect
 The LOG collector example
 Who is the SERVER?
Image credit: http://zguide.zeromq.org/
ØMQ – POSIX socket basics
 select, poll, epoll
import zmq
context = zmq.Context()
receiver = context.socket(zmq.PULL)
receiver.connect("tcp://localhost:5557")
subscriber = context.socket(zmq.SUB)
subscriber.connect("tcp://localhost:5556")
subscriber.setsockopt(zmq.SUBSCRIBE, b”topic")
ØMQ – POSIX socket basics
poller = zmq.Poller()
poller.register(receiver, zmq.POLLIN)
poller.register(subscriber, zmq.POLLIN)
while True:
sockets = dict(poller.poll())
if receiver in sockets:
message = receiver.recv()
if subscriber in sockets:
message = subscriber.recv()
ØMQ – Examples
 Load Balancing Broker
Image credit: http://zguide.zeromq.org/
ØMQ – Examples
Image credit: http://zguide.zeromq.org/
 High-availability
Clone Server Pair
ØMQ – Examples
Image credit: http://zguide.zeromq.org/
 State replication
ØMQ – Features
Image credit: http://zguide.zeromq.org/
 Encryption
 http://curvezmq.org/
 Elliptic-curve cryptography
Thank you!
Tihomir Trifonov
https://bg.linkedin.com/in/tisho

Mais conteúdo relacionado

Mais procurados

Introduction to es bs mule
Introduction to es bs   muleIntroduction to es bs   mule
Introduction to es bs muleAchyuta Lakshmi
 
Vm component in mule
Vm component in muleVm component in mule
Vm component in mulejaveed_mhd
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored proceduremdfkhan625
 
Groovy example in mule
Groovy example in muleGroovy example in mule
Groovy example in muleMohammed246
 
Caching for Cash: Caching
Caching for Cash: CachingCaching for Cash: Caching
Caching for Cash: CachingScott MacVicar
 
Compress and decompress
Compress and decompressCompress and decompress
Compress and decompressSon Nguyen
 
Windows Azure Infrastructure as a Service (IaaS) Avançado
Windows Azure Infrastructure as a Service (IaaS) AvançadoWindows Azure Infrastructure as a Service (IaaS) Avançado
Windows Azure Infrastructure as a Service (IaaS) AvançadoAzure Summit Brasil
 
For each component in mule
For each component in muleFor each component in mule
For each component in muleRajkattamuri
 
Php day2013 sports_statistics
Php day2013 sports_statisticsPhp day2013 sports_statistics
Php day2013 sports_statisticsTobias Josefsson
 
Caching & validating
Caching & validatingCaching & validating
Caching & validatingSon Nguyen
 
Caching for Cash: Benchmarking and Profiling
Caching for Cash: Benchmarking and ProfilingCaching for Cash: Benchmarking and Profiling
Caching for Cash: Benchmarking and ProfilingScott MacVicar
 
MuleSoft ESB Object Store
MuleSoft ESB Object StoreMuleSoft ESB Object Store
MuleSoft ESB Object Storeakashdprajapati
 
Backbone.js and rails - BanLV
Backbone.js and rails - BanLVBackbone.js and rails - BanLV
Backbone.js and rails - BanLVFramgia Vietnam
 

Mais procurados (20)

Websockets and SockJS, Real time chatting
Websockets and SockJS, Real time chattingWebsockets and SockJS, Real time chatting
Websockets and SockJS, Real time chatting
 
MuleSoft ESB XML to CSV
MuleSoft ESB XML to CSVMuleSoft ESB XML to CSV
MuleSoft ESB XML to CSV
 
Timer Interceptor in Mule part 2
Timer Interceptor in Mule part 2Timer Interceptor in Mule part 2
Timer Interceptor in Mule part 2
 
Introduction to es bs mule
Introduction to es bs   muleIntroduction to es bs   mule
Introduction to es bs mule
 
Vm component in mule
Vm component in muleVm component in mule
Vm component in mule
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedure
 
Groovy example in mule
Groovy example in muleGroovy example in mule
Groovy example in mule
 
Simple VM in Mule
Simple VM in MuleSimple VM in Mule
Simple VM in Mule
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Caching for Cash: Caching
Caching for Cash: CachingCaching for Cash: Caching
Caching for Cash: Caching
 
Compress and decompress
Compress and decompressCompress and decompress
Compress and decompress
 
Windows Azure Infrastructure as a Service (IaaS) Avançado
Windows Azure Infrastructure as a Service (IaaS) AvançadoWindows Azure Infrastructure as a Service (IaaS) Avançado
Windows Azure Infrastructure as a Service (IaaS) Avançado
 
For each component in mule
For each component in muleFor each component in mule
For each component in mule
 
Php day2013 sports_statistics
Php day2013 sports_statisticsPhp day2013 sports_statistics
Php day2013 sports_statistics
 
Caching & validating
Caching & validatingCaching & validating
Caching & validating
 
Caching for Cash: Benchmarking and Profiling
Caching for Cash: Benchmarking and ProfilingCaching for Cash: Benchmarking and Profiling
Caching for Cash: Benchmarking and Profiling
 
Mule java part-1
Mule java part-1Mule java part-1
Mule java part-1
 
Mule file connector
Mule file connectorMule file connector
Mule file connector
 
MuleSoft ESB Object Store
MuleSoft ESB Object StoreMuleSoft ESB Object Store
MuleSoft ESB Object Store
 
Backbone.js and rails - BanLV
Backbone.js and rails - BanLVBackbone.js and rails - BanLV
Backbone.js and rails - BanLV
 

Semelhante a Ømq - Distributed queues, threads and sockets

Zmq in context of openstack
Zmq in context of openstackZmq in context of openstack
Zmq in context of openstackYatin Kumbhare
 
ZeroMQ - Sockets on steroids!
ZeroMQ - Sockets on steroids!ZeroMQ - Sockets on steroids!
ZeroMQ - Sockets on steroids!Pedro Januário
 
Intern_Poster_Xing_Wei
Intern_Poster_Xing_WeiIntern_Poster_Xing_Wei
Intern_Poster_Xing_WeiXing Wei
 
Building an inflight entertainment system controller in twisted
Building an inflight entertainment system controller in twistedBuilding an inflight entertainment system controller in twisted
Building an inflight entertainment system controller in twistedDavid Novakovic
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...Aman Kohli
 
Real-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioReal-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioRick Copeland
 
ZeroMQ: Super Sockets - by J2 Labs
ZeroMQ: Super Sockets - by J2 LabsZeroMQ: Super Sockets - by J2 Labs
ZeroMQ: Super Sockets - by J2 LabsJames Dennis
 
Back to basics: Simple database web services without the need for SOA
Back to basics: Simple database web services without the need for SOABack to basics: Simple database web services without the need for SOA
Back to basics: Simple database web services without the need for SOASage Computing Services
 
Mom those things v1
Mom those things v1 Mom those things v1
Mom those things v1 von gosling
 
Js remote conf
Js remote confJs remote conf
Js remote confBart Wood
 
Using the Azure Container Service in your company
Using the Azure Container Service in your companyUsing the Azure Container Service in your company
Using the Azure Container Service in your companyJan de Vries
 
Inter-Process/Task Communication With Message Queues
Inter-Process/Task Communication With Message QueuesInter-Process/Task Communication With Message Queues
Inter-Process/Task Communication With Message Queueswamcvey
 
Hands on with CoAP and Californium
Hands on with CoAP and CaliforniumHands on with CoAP and Californium
Hands on with CoAP and CaliforniumJulien Vermillard
 
Monitoring with Syslog and EventMachine
Monitoring with Syslog and EventMachineMonitoring with Syslog and EventMachine
Monitoring with Syslog and EventMachineWooga
 
Microservices with SenecaJS (part 2)
Microservices with SenecaJS (part 2)Microservices with SenecaJS (part 2)
Microservices with SenecaJS (part 2)Designveloper
 
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure FunctionsMessaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure FunctionsJohn Staveley
 

Semelhante a Ømq - Distributed queues, threads and sockets (20)

Zmq in context of openstack
Zmq in context of openstackZmq in context of openstack
Zmq in context of openstack
 
ZeroMQ - Sockets on steroids!
ZeroMQ - Sockets on steroids!ZeroMQ - Sockets on steroids!
ZeroMQ - Sockets on steroids!
 
ZeroMQ with NodeJS
ZeroMQ with NodeJSZeroMQ with NodeJS
ZeroMQ with NodeJS
 
Intern_Poster_Xing_Wei
Intern_Poster_Xing_WeiIntern_Poster_Xing_Wei
Intern_Poster_Xing_Wei
 
Building an inflight entertainment system controller in twisted
Building an inflight entertainment system controller in twistedBuilding an inflight entertainment system controller in twisted
Building an inflight entertainment system controller in twisted
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
 
Real-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioReal-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.io
 
ZeroMQ: Super Sockets - by J2 Labs
ZeroMQ: Super Sockets - by J2 LabsZeroMQ: Super Sockets - by J2 Labs
ZeroMQ: Super Sockets - by J2 Labs
 
Back to basics: Simple database web services without the need for SOA
Back to basics: Simple database web services without the need for SOABack to basics: Simple database web services without the need for SOA
Back to basics: Simple database web services without the need for SOA
 
Mom those things v1
Mom those things v1 Mom those things v1
Mom those things v1
 
WebSphere MQ introduction
WebSphere MQ introductionWebSphere MQ introduction
WebSphere MQ introduction
 
zeromq
zeromqzeromq
zeromq
 
Js remote conf
Js remote confJs remote conf
Js remote conf
 
Using the Azure Container Service in your company
Using the Azure Container Service in your companyUsing the Azure Container Service in your company
Using the Azure Container Service in your company
 
Inter-Process/Task Communication With Message Queues
Inter-Process/Task Communication With Message QueuesInter-Process/Task Communication With Message Queues
Inter-Process/Task Communication With Message Queues
 
Hands on with CoAP and Californium
Hands on with CoAP and CaliforniumHands on with CoAP and Californium
Hands on with CoAP and Californium
 
Monitoring with Syslog and EventMachine
Monitoring with Syslog and EventMachineMonitoring with Syslog and EventMachine
Monitoring with Syslog and EventMachine
 
Apache
ApacheApache
Apache
 
Microservices with SenecaJS (part 2)
Microservices with SenecaJS (part 2)Microservices with SenecaJS (part 2)
Microservices with SenecaJS (part 2)
 
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure FunctionsMessaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
 

Último

Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durbanmasabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...masabamasaba
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 

Último (20)

Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 

Ømq - Distributed queues, threads and sockets

  • 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.
  • 8. ØMQ – Threads, synchronization Image credit: http://www.tivix.com/blog/lets-go-python/
  • 9. ØMQ – socket types  REQ-REP Image credit: http://zguide.zeromq.org/
  • 10. ØMQ – socket types  PUSH-PULL Image credit: http://zguide.zeromq.org/
  • 11. ØMQ – socket types  PUB-SUB Image credit: http://zguide.zeromq.org/
  • 12. ØMQ – socket types  Advanced PUB-SUB XPUB-XSUB Image credit: http://zguide.zeromq.org/
  • 13. ØMQ – message structure  Multi-frame  Header  Body Image credit: http://zguide.zeromq.org/
  • 14. ØMQ – socket types  DEALER  A.k.a. proxy  Round-robin distribution  One-way distribution Image credit: http://zguide.zeromq.org/
  • 15. ØMQ – socket types  ROUTER  Directed messages  Can perform non-uniform distribution, based on message type Image credit: http://zguide.zeromq.org/
  • 16. ØMQ – socket types  PAIR  Sync between threads  Uses inproc:// Image credit: http://zguide.zeromq.org/
  • 17. ØMQ – socket types  Supported socket transports Image credit: http://zguide.zeromq.org/ socket = context.bind(”tcp://0.0.0.0:5555") socket = context.bind(”inproc://endpoint") socket = context.bind(”icp:///tmp/socket_descriptor") socket = context.bind(”epgm://host:port ") socket = context.bind(”tcp://eth0:5555")
  • 18. ØMQ – POSIX socket basics  Bind and connect  The LOG collector example  Who is the SERVER? Image credit: http://zguide.zeromq.org/
  • 19. ØMQ – POSIX socket basics  select, poll, epoll import zmq context = zmq.Context() receiver = context.socket(zmq.PULL) receiver.connect("tcp://localhost:5557") subscriber = context.socket(zmq.SUB) subscriber.connect("tcp://localhost:5556") subscriber.setsockopt(zmq.SUBSCRIBE, b”topic")
  • 20. ØMQ – POSIX socket basics poller = zmq.Poller() poller.register(receiver, zmq.POLLIN) poller.register(subscriber, zmq.POLLIN) while True: sockets = dict(poller.poll()) if receiver in sockets: message = receiver.recv() if subscriber in sockets: message = subscriber.recv()
  • 21. ØMQ – Examples  Load Balancing Broker Image credit: http://zguide.zeromq.org/
  • 22. ØMQ – Examples Image credit: http://zguide.zeromq.org/  High-availability Clone Server Pair
  • 23. ØMQ – Examples Image credit: http://zguide.zeromq.org/  State replication
  • 24. ØMQ – Features Image credit: http://zguide.zeromq.org/  Encryption  http://curvezmq.org/  Elliptic-curve cryptography