SlideShare a Scribd company logo
Scaling application
with RabbitMQ
Scaling application with RabbitMQ
Nahidul Kibria
Co-Leader, OWASP Bangladesh,
Principal Software Engineer,
Orbitax Bangladesh Ltd.
@nahidupa
What is RabbitMQ?
We See Code
Clustering and High Availability
Docker+RabbitMQ
I will stop on some checkpoint and take question.
Birds eye view.
Checkpoint sign
Demo sign
What is RabbitMQ ?
http://goo.gl/gEDUUo
Polyglot
Java and JVM
Ruby
Python
.NET
PHP
Perl
C / C++
Node.js
Go
•Erlang
•Haskell
•Provisioning (Chef, Puppet, etc)
and Operations
•Mobile
•Database Integration
•Web Messaging
•CLI
•3rd party
plugins
•Ocaml
•Common Lisp
•COBOL
Scaling
Scaling UP vs S c a leO UT
Why do we need messaging?
We are about to get a new project give me a prototype
will be simple
Product owner
come…Notify friends
We need to post in
twitter
First delivery
It take too much
bandwidth…lablabla..
I actually need that yesterday
We are going to third-
party integration
PHP
Python
Java
UX guys, Customer
feedback
we don’t want to wait
We need to build instagram!
Poor you (:
You play boss killer some time and get back to work
All of this the simple solution is
messaging
Simple message queue
Who are using RabbitMQ?
It is used in the Ocean Observatories Initiative—an
architecture that collects 8 terabytes of data per day.
Who are using RabbitMQ?
Instagram
Indeed.com
Telefonica
Mercado Libre
NHS
Mozilla
Install RabbitMQ
Install in *nix/debian
Scaling application with RabbitMQ
After Install
Install Management portal for
RabbitMQ
Demo time
Scaling application with RabbitMQ
Scaling application with RabbitMQ
Hello word
var factory = new ConnectionFactory() { HostName = "localhost" };
using (var connection = factory.CreateConnection())
{
using (var channel = connection.CreateModel())
{
channel.QueueDeclare("hello", false, false, false, null);
string message = "Hello World!";
var body = Encoding.UTF8.GetBytes(message);
channel.BasicPublish("", "hello", null, body);
Console.WriteLine(" [x] Sent {0}", message);
}
}
Queue Declare
var factory = new ConnectionFactory() { HostName = "localhost" };
using (var connection = factory.CreateConnection())
{
using (var channel = connection.CreateModel())
{
channel.QueueDeclare("hello", false, false, false, null);
var consumer = new QueueingBasicConsumer(channel);
channel.BasicConsume("hello", true, consumer);
Console.WriteLine(" [*] Waiting for messages." +
"To exit press CTRL+C");
while (true)
{
var ea = (BasicDeliverEventArgs)consumer.Queue.Dequeue();
var body = ea.Body;
var message = Encoding.UTF8.GetString(body);
Console.WriteLine(" [x] Received {0}", message);
}
}
}
Exchange
Scaling application with RabbitMQ
Scaling application with RabbitMQ
Scaling application with RabbitMQ
Scaling application with RabbitMQ
Coding
Work Queues
Exchanges
Routing
Direct exchange
Multiple bindings
Log
Topic exchange
Remote procedure call
(RPC)
easynetq
https://www.rabbitmq.com/devtools.html
Scaling application with RabbitMQ
Easynetq save your time
//many simplification
var bus = RabbitHutch.CreateBus("host=ubuntu:5672,ubuntu:5673");
//also give freedom
var advancedBus = RabbitHutch.CreateBus("host=localhost").Advanced
RabbitMQ Features
RabbitMQ Features
Large Message
Messaging in general should be small
AMPQ support very large messages
RabbitMQ you can use large messages but you need to be careful
MSMQ-Message Queuing is limited
in the size of documents that can
be processed. The maximum size
document that Message Queuing
supports is 4 MB if the document
is in ASCII. The message queue
can handle a maximum of 2 MB if
the document is in Unicode.
Buffered and chunked
http://goo.gl/SgnBYf
Virtual Hosts
Error Handling
//no retry
var ea = (BasicDeliverEventArgs) consumer.Queue.Dequeue();
channel.BasicReject(ea.DeliveryTag,false);
//retry
var ea = (BasicDeliverEventArgs) consumer.Queue.Dequeue();
channel.BasicReject(ea.DeliveryTag,true);
We cannot retry forever!
channel.BasicAck(ea.DeliveryTag,false);
ea.BasicProperties.Headers.Add("RetryHeader",1);
channel.BasicNack(ea.DeliveryTag, false,true);
Dead letter queue
feelsleepy
Clustering and High Availability
Demo Environment
Sync Erlang cookie
10.10.52.130 debian
If erlang version mismatch
Join cluster
Scaling application with RabbitMQ
Demo in management
Details http://goo.gl/BqQHjp
???
Breaking up a cluster
rabbit3$ rabbitmqctl stop_app
Stopping node rabbit@rabbit3 ...done.
rabbit3$ rabbitmqctl reset Resetting node
rabbit@rabbit3 ...done.
rabbit3$ rabbitmqctl start_app
Starting node rabbit@rabbit3 ...done.
Distributed Application
Shovel plugin
Loose coupling
they may have different users and virtual hosts;
they may run on different versions of RabbitMQ and
Erlang.
A process that replicates data
to the remote server
Scaling application with RabbitMQ
Cluster/LAN Cluster/LAN
Shovel
WAN friendly
rabbitmq-plugins enable rabbitmq_shovel
rabbitmq-plugins enable rabbitmq_shovel_management
Demo time
RabbitMQ Federation
Federation Plugin
Loose coupling
WAN-friendly
Specificity
Scalability
Federation Plugin
RabbitMQ Federation
•Supports replication across different administrative
domains
•Supports mix of Erlang and RabbitMQ versions
•Supports Network Partitions
•Specificity - not everything has to be federated
Federated Exchanges
Scaling application with RabbitMQ
Topologies
Topologies
Small complete graph
Topologies
Fan-out
Topologies
Ring
Federated Queues
rabbitmqctl set_parameter federation-upstream my-upstream
'{"uri":"amqp://admin:admin@192.168.52.133","expires":36000
00}‘
rabbitmqctl set_policy federate-me '^DigitalWorld.'
'{"federation-upstream-set":"all"}' --priority 0 --apply-to
exchanges
Enterprise Integration Patterns for RabbitMQ
Connecting with SSL
Authentication and Authorization
Security
Monitoring RabbitMQ
https://github.com/jamesc/nagios-plugins-rabbitmq
http://newrelic.com/plugins/pivotal/95
https://www.youtube.com/watch?v=CAak2ayFc
https://github.com/zenoss/ZenPacks.zenoss.RabbitMQ
http://looselycoupledlabs.com/2014/08/monitoring-
rabbitmq/
http://www.rabbitmq.com/how.html have a section
Memory Alarms
Disk Alarms
https://www.rabbitmq.com/alarms.html
Docker+RabbitMQ
http://www.fig.sh/install.html
Load Test jMeter
Apache JMeter and the AMQP plugin to run load tests:
https://github.com/jlavallee/JMeter-Rabbit-AMQP
Real Time
Socket.IO/SignalR
http://goo.gl/ObvblZ
SignalR
http://goo.gl/xumPOG
A client that is
connected to one
server will not
receive messages
sent from another
server.
http://goo.gl/79T7aZ
RabbitMQ
RabbitMQ is extremely efficient,
widely deployed & tested
message broker but can hit
performance, if tuned for more
durability and reliability. It’s
more targeted towards serving
enterprise messaging with
advanced routing requirements.
Redis is quick to start,
lightweight & fast broker but
does Not support reliable
delivery Hence can be chosen
for applications where in case
system terminates, losing the
information about tasks for a
few minutes is Not critical.
http://goo.gl/J5ak0j
References
http://jmcle.github.io/rabbitmq-visualizer/
https://github.com/RabbitMQSimulator/RabbitMQSimulator
http://java.dzone.com/articles/docker-rabbitmq-cluster
Questions
@nahidupa

More Related Content

PDF
RabbitMQ Data Ingestion
PDF
Alvaro Videla, Building a Distributed Data Ingestion System with RabbitMQ
PDF
PDF
Dissecting the rabbit: RabbitMQ Internal Architecture
PPTX
RabbitMQ Model and Some Example Applications
PDF
RabbitMQ Operations
PPTX
High powered messaging with RabbitMQ
PDF
Scaling applications with RabbitMQ at SunshinePHP
RabbitMQ Data Ingestion
Alvaro Videla, Building a Distributed Data Ingestion System with RabbitMQ
Dissecting the rabbit: RabbitMQ Internal Architecture
RabbitMQ Model and Some Example Applications
RabbitMQ Operations
High powered messaging with RabbitMQ
Scaling applications with RabbitMQ at SunshinePHP

What's hot (20)

PDF
RabbitMQ fairly-indepth
PDF
RabbitMQ with python and ruby RuPy 2009
PDF
Improvements in RabbitMQ
PPTX
The RabbitMQ Message Broker
PDF
Messaging Standards and Systems - AMQP & RabbitMQ
PPTX
Spring RabbitMQ
PDF
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
PDF
RabbitMQ Data Ingestion at Craft Conf
PDF
Introduction to AMQP Messaging with RabbitMQ
PDF
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
PDF
RabbitMQ & Hutch
PDF
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
PDF
Troubleshooting RabbitMQ and services that use it
PDF
The Future of Messaging: RabbitMQ and AMQP
PDF
AMQP with RabbitMQ
PDF
Integrating PostgreSql with RabbitMQ
PDF
Messaging with RabbitMQ and AMQP
PDF
Distributed messaging with AMQP
KEY
Real time system_performance_mon
PPTX
Message Broker System and RabbitMQ
RabbitMQ fairly-indepth
RabbitMQ with python and ruby RuPy 2009
Improvements in RabbitMQ
The RabbitMQ Message Broker
Messaging Standards and Systems - AMQP & RabbitMQ
Spring RabbitMQ
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
RabbitMQ Data Ingestion at Craft Conf
Introduction to AMQP Messaging with RabbitMQ
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
RabbitMQ & Hutch
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Troubleshooting RabbitMQ and services that use it
The Future of Messaging: RabbitMQ and AMQP
AMQP with RabbitMQ
Integrating PostgreSql with RabbitMQ
Messaging with RabbitMQ and AMQP
Distributed messaging with AMQP
Real time system_performance_mon
Message Broker System and RabbitMQ
Ad

Viewers also liked (8)

PPTX
Developing highly scalable applications with Symfony and RabbitMQ
PPTX
Отказоустойчивость и производительность
PPTX
Everybody loves html5,h4ck3rs too
PPTX
Banking malware zeu s zombies are using in online banking theft.
PPTX
G3t R00t at IUT
PPTX
Sending a for ahuh. win32 exploit development old school
PDF
Penetration testing web application web application (in) security
PPTX
Web Application Penetration Testing Introduction
Developing highly scalable applications with Symfony and RabbitMQ
Отказоустойчивость и производительность
Everybody loves html5,h4ck3rs too
Banking malware zeu s zombies are using in online banking theft.
G3t R00t at IUT
Sending a for ahuh. win32 exploit development old school
Penetration testing web application web application (in) security
Web Application Penetration Testing Introduction
Ad

Similar to Scaling application with RabbitMQ (20)

PDF
APIs for the Internet of Things
PDF
Tornado Web Server Internals
PDF
Hands on with CoAP and Californium
PDF
Import golang; struct microservice
PDF
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocket
PDF
Построение распределенной системы сбора данных с помощью RabbitMQ, Alvaro Vid...
PPT
Server side JavaScript: going all the way
PPTX
Hazelcast and MongoDB at Cloud CMS
PPTX
Could Virtual Threads cast away the usage of Kotlin Coroutines
PPTX
Managing gRPC Services using Kong KONNECT and the KONG API Gateway
PPTX
Nanocloud cloud scale jvm
PDF
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
PDF
Microservices Application Tracing Standards and Simulators - Adrians at OSCON
PPT
Taming Deployment With Smart Frog
PDF
OSGi Remote Services - Alexander Broekhuis, Bram de Kruijff
PPTX
introduction to node.js
PDF
Original slides from Ryan Dahl's NodeJs intro talk
PDF
OpenNebulaConf 2016 - Networking, NFVs and SDNs Hands-on Workshop by Rubén S....
PDF
202107 - Orion introduction - COSCUP
PDF
Introduction to ZooKeeper - TriHUG May 22, 2012
APIs for the Internet of Things
Tornado Web Server Internals
Hands on with CoAP and Californium
Import golang; struct microservice
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocket
Построение распределенной системы сбора данных с помощью RabbitMQ, Alvaro Vid...
Server side JavaScript: going all the way
Hazelcast and MongoDB at Cloud CMS
Could Virtual Threads cast away the usage of Kotlin Coroutines
Managing gRPC Services using Kong KONNECT and the KONG API Gateway
Nanocloud cloud scale jvm
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
Microservices Application Tracing Standards and Simulators - Adrians at OSCON
Taming Deployment With Smart Frog
OSGi Remote Services - Alexander Broekhuis, Bram de Kruijff
introduction to node.js
Original slides from Ryan Dahl's NodeJs intro talk
OpenNebulaConf 2016 - Networking, NFVs and SDNs Hands-on Workshop by Rubén S....
202107 - Orion introduction - COSCUP
Introduction to ZooKeeper - TriHUG May 22, 2012

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Big Data Technologies - Introduction.pptx
PPT
Teaching material agriculture food technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
A Presentation on Artificial Intelligence
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Modernizing your data center with Dell and AMD
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Cloud computing and distributed systems.
MYSQL Presentation for SQL database connectivity
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Big Data Technologies - Introduction.pptx
Teaching material agriculture food technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
A Presentation on Artificial Intelligence
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Approach and Philosophy of On baking technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Understanding_Digital_Forensics_Presentation.pptx
Electronic commerce courselecture one. Pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Network Security Unit 5.pdf for BCA BBA.
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Modernizing your data center with Dell and AMD
NewMind AI Monthly Chronicles - July 2025
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Cloud computing and distributed systems.

Scaling application with RabbitMQ

Editor's Notes

  • #5: Ask audience Any bus lover
  • #8: Advanced Message Queuing Protocol Message Queue Telemetry Transport—IBM-- binary packet payload--low bandwidth, high latency networks such as dial up lines and satellite links Simple/Streaming Text Oriented Messaging Protocol--browser, mobile app, or machine in real-time Publish from a protocol consume from another protocol
  • #10: Single point of failure
  • #24: Do not start showing other pattern
  • #28: sysv-rc-conf
  • #29: nano /etc/apt/sources.list deb http://www.rabbitmq.com/debian/ testing main wget https://www.rabbitmq.com/rabbitmq-signing-key-public.asc sudo apt-key add rabbitmq-signing-key-public.asc apt-get update sudo apt-get install rabbitmq-server
  • #30: update-rc.d -f rabbitmq-server remove update-rc.d -f rabbitmq-server defaults http://localhost:15672/ Sudo invoke-rc.d rabbitmq-server stop/start/etc apt-get install chkconfig chkconfig –list chkconfig rabbitmq-server on
  • #31: C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.4.3\sbin rabbitmq-plugins enable rabbitmq_management "C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.4.3\sbin" "rabbitmq-plugins enable rabbitmq_management“
  • #32: Show management console
  • #39: Again go to simulator
  • #45: routekey
  • #53: mnesia
  • #55: Message Queuing is limited in the size of documents that can be processed. The maximum size document that Message Queuing supports is 4 MB if the document is in ASCII. The message queue can handle a maximum of 2 MB if the document is in Unicode.
  • #57: /debug /production demo
  • #64: C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.4.3\sbin>rabbitmqctl jo in_cluster --ram rabbit@exdev Clustering node rabbit@JINOM with rabbit@exdev ... Error: {inconsistent_cluster,"OTP version mismatch: local node is 17.4, remote n ode R15B01"} Check erlang verssion erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' –noshell in_cluster --ram rabbit@exdev Clustering node rabbit@JINOM with rabbit@exdev ...
  • #66: On Unix systems, the cookie will be typically located in /var/lib/rabbitmq/.erlang.cookie or$HOME/.erlang.cookie. On Windows, the locations are C:\Users\Current User\.erlang.cookie(%HOMEDRIVE% + %HOMEPATH%\.erlang.cookie) orC:\Documents and Settings\Current User\.erlang.cookie, and C:\Windows\.erlang.cookie for RabbitMQ Windows service. If Windows service is used, the cookie should be placed in both places. As an alternative, you can insert the option "-setcookie cookie" in the erl call in the rabbitmq-serverand rabbitmqctl scripts.
  • #77: demo
  • #80: https://www.rabbitmq.com/federation.html rabbitmq-plugins enable rabbitmq_federation rabbitmq-plugins enable rabbitmq_federation_management
  • #89: demo
  • #92: https://www.youtube.com/watch?v=CAak2ayFcV0 https://github.com/zenoss/ZenPacks.zenoss.RabbitMQ http://looselycoupledlabs.com/2014/08/monitoring-rabbitmq/ http://www.rabbitmq.com/how.html have a section
  • #94: curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-`uname -s`-`uname -m` > /usr/local/bin/fig; chmod +x /usr/local/bin/fig http://java.dzone.com/articles/docker-rabbitmq-cluster
  • #96: https://github.com/rajaraodv/rabbitpubsub