SlideShare a Scribd company logo
RabbitMQ Model and Some
Example Applications
houcheng@gmail.com
CCMA ITRI
Outline
•
•
•
•

RabbitMQ model and standard
Simplified message queue model
3 example code
5 real case studies
RabbitMQ Model
s1

C1

tmp1: private

(Distribution)
s2

direct
exchange

C2

q1: ! private

key: q1
reply-to: tmp1
cor-id: 1

s3

key1
q3:

fan-out
key1

q4:

to: fan-out
key:key1

topic
exchange

C3

STK.US.*
STK.IND.*

STK.US.* AND
type == pdf
to: topic
key: STK.US.C

filter
exchange

q5:
!durable

q6:

s4

(Fan-out)
Notations in RabbitMQ Model
s4

application
thread

virtual
host

TCP
connection

exchange

channel

binding

message

queue
consuming
RabbitMQ Model
• Virtual Host
• Exchange
– direct
– fan-out
– topic

• Binding
– topic
– cascading
– message select

• queue
– flags: private, durable

• Connection
– channel: every thread work
with one channel

• Message
– content header
• Properties: Reply-To, Cor-Id,
Message-Id, Key
• queue server may add
properties , wont remove/
modify

– content body (wont modify)
• binary/ file/ stream

• Application
– client/ server
Other Items in AMQP 0.8,
not included in Model
– AMQP transaction – deliver ACK to sender after
message received
– AMQP distributed transaction – deliver ACK to a
3rd party software after message received
– Access – a realm based access control model

we think these are irrelevant to ADDM
transaction detection
Simplified Message Queue Model
C1

s1

send rpc:q1.1
rpc

q1.*
s2

reply-to: tmp1
cor-id: (2)

q2.*
tmp1

C2

rpcresult

send update:q34

s3
update

q34

cor-id: 2

(Distribution)

s4

s5

rpc

q5

(Fan out)
s6

q5

queue server
Model Notation
C1

queue server

application thread

$name

exchange

($destination: key)

message
$key
$properties

binding
queue

consuming
3 Example Code
1. RabbitMQ tutorial code (synchronous)
2. RabbitMQ RPC (synchronous)
3. Celery framework (distributed task queue /
asynchronous)
Classical Scenario
in Example Code
– one request queue per service; one reply queue per client
– properties used on message
• correlate-id
• message-id
• reply-to

– steps
1.
2.
3.
4.

client thread send REQUEST and wait on reply queue
server thread receive REQUEST, process it and send REPLY to reply queue
client thread get reply from reply queue
if asynchronous mode, client may polls processing status by another status
update REQUEST message, and server reply another status update REPLY
message
Example Code 1:
RabbitMQ tutorial
C1

(q1.1)

s1

tmp1

reply-to: (tmp1)

(q1)

C1

q1

tmp1

1
(tmp1)
q1

3

reply-to: (tmp1)

2

C1

tmp1

q1

s1

s1

C1

(tmp1)

s1

tmp1

q1

4

• coordinate REQUEST-REPLY into transaction by reply queue id
Example Code 2:
RabbitMQ RPC

(rpcq1)

C1

s1

tmp1

reply-to: (tmp1)
cor-id: (1)

(rpcq1)

C1

rpcq1

tmp1

q1

1

tmp1

rpcq1

reply-to: (tmp1)
cor-id: (1)

2
(tmp1)

C1

cor-id: (1)

s1

C1

(tmp1)

cor-id: (1)

s1

rpcq1

tmp1

3
•

s1

Coordinate REQUEST-REPLY into transaction by correlate-id

4
Example Code 3:
Celery (Distributed Task Queue)
(celery:celery)

(celery:celery)

C1

s1

add
(1,1)

celery
result:
1

celery:
celery

cor-id: (1)

C1

s1

celery
result:
1

step 1

(

add
(1,1)
cor-id: (1)

step 2

(celery-result:1)

step 3: polling
status of result
queue many
times:

celery:
celery

C1

(celery-result:1)
C1

poll
step a

empty
step b

)*
Example Code 3:
Celery (Distributed Task Queue)

(celery-result:1)
C1

(celery-result:1)
worker

celeryresult:
1

celery:
celery

step 4

cor-id: (1)

C1

worker

cor-id: (1)

celeryresult:
1

celery:
celery

step 5

• Coordinate REQUEST-REPLY into transaction by (correlate-id)
Celery: one client application with two worker
w1
service

C1

w1

2+2

1+1

cor-id: (2)

cor-id: (1)

worker thread pool

1. client make two calls via the same connection
w1
C1

2
cor-id: (1)
w2

4
cor-id: (2)

2. worker send REPLY via its own connection
3. client receive REPLYs via the same connection
5 Real Cases Study
• Applications use RabbitMQ
1. Zenoss4‘s message bus between daemons (non
transaction app)
2. Nova controller’s RPC call between hosts (transaction app)

• Enterprise use RabbitMQ
3. Instagram : Celery + RabbitMQ
4. MercadoLibre: RabbitMQ
5. Indeed.com
MailboxApp
Case 1: Zenoss 4
• A message bus to pass event and heartbeat between daemons
– RabbitMQ as message queue server
– Protobufs to serialization

• Non-transaction application

zenhub

zenoss
event server

heart
beat
event
zenhubworker

zeventd
raw
event

RabbitMQ
Heartbeat
zenhub

zeneventd

zenhubwork
er

zenhubworker.py---(1)-->[RabbitMQ]
zenhubworker.py---(1)-->[RabbitMQ]
zenhubworker.py---(1)-->[RabbitMQ]
[RabbitMQ]---(3)-->java
[RabbitMQ]---(3)-->java
[RabbitMQ]---(3)-->java

zenoss
event server

HB

HB

HB

heart
beat

HB

message bus

publish exchange: zenoss.heartbeats key: zenoss.heartbeat.localhost
content header: org.zenoss.protobufs.zep.DaemonHeartbeat
content with len: 33
deliver
content header: org.zenoss.protobufs.zep.DaemonHeartbeat
content with len: 33
Ping Failure

zenoss
event server

zenping

1

raw
ping
event

event

2

ping
event

zeventd
raw
event
RabbitMQ
Ping Failure Messages
zenping---(1)-->[RabbitMQ]
zenping---(1)-->[RabbitMQ]
zenping---(1)-->[RabbitMQ]
[RabbitMQ]---(1)-->zeneventd.py
[RabbitMQ]---(1)-->zeneventd.py
[RabbitMQ]---(1)-->zeneventd.py
zeneventd.py---(1)-->[RabbitMQ]
zeneventd.py---(1)-->[RabbitMQ]
zeneventd.py---(1)-->[RabbitMQ]
[RabbitMQ]---(1)-->java
[RabbitMQ]---(1)-->java
[RabbitMQ]---(1)-->java
java---(6)-->[RabbitMQ]
java---(6)-->[RabbitMQ]
java---(6)-->[RabbitMQ]

publish exchange: zenoss.zenevents.raw key: zenoss.zenevent.status.ping
content header: org.zenoss.protobufs.zep.Event
content with len: 235
deliver
content header: org.zenoss.protobufs.zep.Event
content with len: 235
publish exchange: zenoss.zenevents.zep key: zenoss.zenevent.status.ping
content header: org.zenoss.protobufs.zep.ZepRawEvent
content with len: 432
deliver
content header: org.zenoss.protobufs.zep.ZepRawEvent
content with len: 432
publish exchange: zenoss.zenevents key: zenoss.zenevent.status.ping
content header: org.zenoss.protobufs.zep.EventSummary
content with len: 433
Case 2: Nova Controller
• A message queue server for RPC call between hosts
• Each RPC call has its own unique message-id generated by UUID library
Case 3: Instagram
• Web server uses nginx
• Messaging system use
RabbitMQ
– Scalability: self-made message
broker, dispatch message in RR
– Reliability: RabbitMQ cluster

• Worker system use Celery
– Celery is distributed task queue
– worker concurrency model
• slow task: pre-fork pool
• fast task: gevent

• Overall throughput
– 25k application threads
publishing task
– 4K tasks per second
– Also monitor queue length

http://lanyrd.com/2013/pycon/scdyrp/
Nginx Server with Celery

nginx

w1

client1

1
cor-id: (c1’s request)
w2

client
client
client
10k
10k
10k

2
cor-id: (c2’s request)

queue server
Nginx
• single thread
• event driven
• asynchronous (non-blocking)

• Task complete and
return REPLY messages
Case 4: MercadoLibre
• MercadoLibre is 8th largest ecommerce company in
Latin American
• original architecture of their ecommerce system:
requests
requests
requests

Redis

nodeJS
nginx
proxy
to route
requests

20 million request per
minutes, 4GB per seconds

Grails
Groovy

7000+ vm insance
(by openstack)

MongoDb
Case 4: MercadoLibre
• Changes from LB + web
app to enterprise
service bus architecture
• Benefit
–
–
–
–

error handling
routing
scalability
event driven for higher
performance

web
server

app1
req
app2

item
feed

req

enterprise
service bus

app3

persist
MercadoLibre’s
News Update System

• The items-app is not transaction based
MercadoLibre’s
Selectively Receive Message

• The items-app is not transaction based
Case 5:
indeed.COM
crawler
engine

Rabbit
MQ

crawler
engine

Rabbit
MQ

crawler
engine

Rabbit
MQ

Asian DC

Job write
service

Job write
service

DB

Job write
service

Rabbit
Rabbit
MQ
MQ
HA

DB

DB

pacific
US DC
ocean
• crawler engine app is not transaction based
Reference
•
•
•
•
•
•
•

RabbitMQ specification 0.8
RabbitMQ Tutorial, example 1/6 and its packet dump
Celery: Distributed Task Queue and its packet dump
Messaging at Scale at Instagram
How is nginx different from apache
Zenoss source code
nova controller source code

More Related Content

What's hot (15)

PPTX
Les Vpn
medalaa
 
PPTX
Simple mail transfer protocol
Anagha Ghotkar
 
PPTX
P2P - Sistemas Distribuídos
Valdir Junior
 
PPT
Apache Web Server Architecture Chaitanya Kulkarni
webhostingguy
 
PDF
Virtualization Technology Overview
OpenCity Community
 
PPTX
Queuing Theory
Trinity Dwarka
 
DOC
Srs template ieee
शैली शर्मा
 
PDF
Network security
Telematika Open Session
 
PPTX
Deep Packet Inspection technology evolution
Daniel Vinyar
 
PPTX
Is Your Volvo XC90 Displaying Anti-Skid Service Required Alert Here's Why
Bavarium Autoworks
 
PPTX
Imap(internet massege access protocaols)
shashikant pabari
 
PPT
isa serveur
YoussefAddi2
 
PDF
Routage rip
Ines Kechiche
 
PPTX
Mengenal lebih detail tentang synology dan cara penggunaannya dalam menjalani...
UntungSuprihadi1
 
PDF
Mise en place d'un vpn site à site avec pfsense
Pape Moussa SONKO
 
Les Vpn
medalaa
 
Simple mail transfer protocol
Anagha Ghotkar
 
P2P - Sistemas Distribuídos
Valdir Junior
 
Apache Web Server Architecture Chaitanya Kulkarni
webhostingguy
 
Virtualization Technology Overview
OpenCity Community
 
Queuing Theory
Trinity Dwarka
 
Srs template ieee
शैली शर्मा
 
Network security
Telematika Open Session
 
Deep Packet Inspection technology evolution
Daniel Vinyar
 
Is Your Volvo XC90 Displaying Anti-Skid Service Required Alert Here's Why
Bavarium Autoworks
 
Imap(internet massege access protocaols)
shashikant pabari
 
isa serveur
YoussefAddi2
 
Routage rip
Ines Kechiche
 
Mengenal lebih detail tentang synology dan cara penggunaannya dalam menjalani...
UntungSuprihadi1
 
Mise en place d'un vpn site à site avec pfsense
Pape Moussa SONKO
 

Viewers also liked (20)

PDF
Why and how Pricing Assistant migrated from Celery to RQ - Paris.py #2
Sylvain Zimmer
 
PDF
Introduction to AMQP Messaging with RabbitMQ
Dmitriy Samovskiy
 
PDF
RestMQ - HTTP/Redis based Message Queue
Gleicon Moraes
 
PDF
Rabbitmq, amqp Intro - Messaging Patterns
Javier Arias Losada
 
PDF
Uboot startup sequence
Houcheng Lin
 
PDF
Arm device tree and linux device drivers
Houcheng Lin
 
PDF
Dissecting the rabbit: RabbitMQ Internal Architecture
Alvaro Videla
 
PDF
"What we've learnt from Ember.js developing our new product" by Guillaume Pot...
TheFamily
 
PPTX
RabbitMQ Plugins Talk
Lecturer UC Davis & Northwestern
 
PDF
AMQP with RabbitMQ
Spyros Papageorgiou
 
PDF
Messaging Standards and Systems - AMQP & RabbitMQ
All Things Open
 
PDF
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Paolo Negri
 
PDF
Improvements in RabbitMQ
Alvaro Videla
 
PDF
RabbitMQ fairly-indepth
Wee Keat Chin
 
ODP
Inter-process communication of Android
Tetsuyuki Kobayashi
 
PDF
RabbitMQ Data Ingestion at Craft Conf
Alvaro Videla
 
PDF
An Introduction to Celery
Idan Gazit
 
PPTX
The RabbitMQ Message Broker
Martin Toshev
 
PDF
API's overview - MeliDevConf 2013 - SP
melidevelopers
 
PDF
Arquitetura de Mensagens Assíncronas - MeliDevConf 2013 - SP
melidevelopers
 
Why and how Pricing Assistant migrated from Celery to RQ - Paris.py #2
Sylvain Zimmer
 
Introduction to AMQP Messaging with RabbitMQ
Dmitriy Samovskiy
 
RestMQ - HTTP/Redis based Message Queue
Gleicon Moraes
 
Rabbitmq, amqp Intro - Messaging Patterns
Javier Arias Losada
 
Uboot startup sequence
Houcheng Lin
 
Arm device tree and linux device drivers
Houcheng Lin
 
Dissecting the rabbit: RabbitMQ Internal Architecture
Alvaro Videla
 
"What we've learnt from Ember.js developing our new product" by Guillaume Pot...
TheFamily
 
RabbitMQ Plugins Talk
Lecturer UC Davis & Northwestern
 
AMQP with RabbitMQ
Spyros Papageorgiou
 
Messaging Standards and Systems - AMQP & RabbitMQ
All Things Open
 
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Paolo Negri
 
Improvements in RabbitMQ
Alvaro Videla
 
RabbitMQ fairly-indepth
Wee Keat Chin
 
Inter-process communication of Android
Tetsuyuki Kobayashi
 
RabbitMQ Data Ingestion at Craft Conf
Alvaro Videla
 
An Introduction to Celery
Idan Gazit
 
The RabbitMQ Message Broker
Martin Toshev
 
API's overview - MeliDevConf 2013 - SP
melidevelopers
 
Arquitetura de Mensagens Assíncronas - MeliDevConf 2013 - SP
melidevelopers
 
Ad

Similar to RabbitMQ Model and Some Example Applications (20)

PDF
Queue Everything and Please Everyone
Vaidik Kapoor
 
KEY
Real time system_performance_mon
Tomas Doran
 
PDF
Messaging Standards and Systems - AMQP & RabbitMQ
POSSCON
 
PDF
The Future of Messaging: RabbitMQ and AMQP
Eberhard Wolff
 
KEY
High scale flavour
Tomas Doran
 
ODP
The Art of Message Queues - TEKX
Mike Willbanks
 
PDF
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
JAX London
 
PPTX
RabbitMQ and EasyNetQ
Ken Taylor
 
PDF
Messaging with RabbitMQ and AMQP
Eberhard Wolff
 
PDF
Построение распределенной системы сбора данных с помощью RabbitMQ, Alvaro Vid...
Ontico
 
PDF
Follow the White Rabbit - Message Queues with PHP
Eric Rodriguez (Hiring in Lex)
 
PDF
ITB2019 Multi-language / multi-OS communication using RabbitMQ - Wil de Bruin
Ortus Solutions, Corp
 
PDF
Multi-language/multi-OS communication using RabbitMQ
Wil de Bruin
 
PDF
Lindsay distributed geventzmq
Robin Xiao
 
PPTX
RabbitMQ 101 : job scheduling, micro service communication, event based data...
Quentin Adam
 
PPTX
RabbitMQ 101 : How to cook the rabbit? - phptour 2016
Quentin Adam
 
PPTX
Scaling application with RabbitMQ
Nahidul Kibria
 
PDF
Presentation
zladuric
 
PDF
Alvaro Videla, Building a Distributed Data Ingestion System with RabbitMQ
Tanya Denisyuk
 
PDF
ZeroMQ Is The Answer
Ian Barber
 
Queue Everything and Please Everyone
Vaidik Kapoor
 
Real time system_performance_mon
Tomas Doran
 
Messaging Standards and Systems - AMQP & RabbitMQ
POSSCON
 
The Future of Messaging: RabbitMQ and AMQP
Eberhard Wolff
 
High scale flavour
Tomas Doran
 
The Art of Message Queues - TEKX
Mike Willbanks
 
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
JAX London
 
RabbitMQ and EasyNetQ
Ken Taylor
 
Messaging with RabbitMQ and AMQP
Eberhard Wolff
 
Построение распределенной системы сбора данных с помощью RabbitMQ, Alvaro Vid...
Ontico
 
Follow the White Rabbit - Message Queues with PHP
Eric Rodriguez (Hiring in Lex)
 
ITB2019 Multi-language / multi-OS communication using RabbitMQ - Wil de Bruin
Ortus Solutions, Corp
 
Multi-language/multi-OS communication using RabbitMQ
Wil de Bruin
 
Lindsay distributed geventzmq
Robin Xiao
 
RabbitMQ 101 : job scheduling, micro service communication, event based data...
Quentin Adam
 
RabbitMQ 101 : How to cook the rabbit? - phptour 2016
Quentin Adam
 
Scaling application with RabbitMQ
Nahidul Kibria
 
Presentation
zladuric
 
Alvaro Videla, Building a Distributed Data Ingestion System with RabbitMQ
Tanya Denisyuk
 
ZeroMQ Is The Answer
Ian Barber
 
Ad

Recently uploaded (20)

PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 

RabbitMQ Model and Some Example Applications