SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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
 

Tendances (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
 

Similaire à Ø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
 

Similaire à Ø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
 

Dernier

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
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
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
 
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
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile EnvironmentVictorSzoltysek
 
%+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
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
%+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
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 

Dernier (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
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
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
 
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
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
%+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...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%+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...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 

Ø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