SlideShare a Scribd company logo
“RabbitMQ
     python and ruby staring
       at the looking glass”
               - an asynchronous tale -

 •   http://www.slideshare.net/hungryblank
 •   http://github.com/hungryblank/rabbitmq_rupy_2009

Paolo Negri                        @hungryblank
Resources

• http://www.slideshare.net/hungryblank
• http://github.com/hungryblank/rabbitmq_rupy_2009
About me
Time
       GNU/Linux - Dbs
                          Perl
         “systems”
                                   PHP
                          Python




                         Ruby
AMQP
Advanced Message Queuing Protocol

   • standard for high performance
     enterprise messaging
   • totally open
   • platform agnostic
   • interoperable
AMQP
     Why is it interesting?
“We use asynchronicity heavily in those 
cases where performance is an issue.
This is generally where we send content 
from one peer to another.  We send off 
methods as fast as possible without  
waiting for confirmations”
                  AMQP Specs [0.8 June 2006]
Summary

“AMQP as a case of asynchronous
protocol implementation in python
and ruby”
AMQP - Entities

Producer   msg



Consumer         msg
                       Broker


                       http://www.flickr.com/photos/17258892@N05/2588347668/
AMQP - Entities
Producer   msg

Producer   msg



                       Broker
Producer   msg


Consumer         msg

Consumer         msg




                       http://www.flickr.com/photos/17258892@N05/2588347668/
AMQP
     Implementations

• Producer/Consumer: libs available for
  python and ruby
• Broker no python or ruby
  implementation
• RabbitMQ is an implementation of
  AMQP Broker
• It’s opensource
• Written in Erlang
Erlang?
• general-purpose concurrent programming
  language designed by Ericsson
• first version written by J. Armstrong in 1986
• distributed
• fault tolerant
• soft real time
• high availability
Erlang?
Erlang's main strength is support for
concurrency
“Process communication is done via a
shared-nothing asynchronous message
passing:
every process has a “mailbox”, a queue
of messages sent by other processes,
that are not yet consumed” (Wikipedia)
+ Erlang


It’s messages all the way down
Async Python libs
            txAMQP

• “twisted AMQP”
• based on twisted python
• https://launchpad.net/txamqp
Async Python libs
               amqpev

• based on eventlet
• experimental, not ready for
  production
• http://bitbucket.org/edarc/amqpev
Async Python libs
                pika

• based on asyncio
• young but mantained by member of
  RabbitMQ core team
• http://github.com/tonyg/pika
Async Ruby libs
              amqp

• amqp gem
• based on EventMachine
• mature and widely used
• http://github.com/tmm1/amqp/
Async?

• Twisted Python
• Asyncio (python stdlib)
• eventlet (python)
• EventMachine (ruby)
Reactor Pattern

• Non blocking IO and lightweight
  concurrency
• eliminate the complexities of high-
  performance threaded network
  programming
synchronous          asynchronous
 process      Time   process

   code                 code



 network                                network
 operation              Free
                                        operation

use network          use network
 operation            operation
                                   Callback
   result               result


   Free
                        Free
Not only reactor


Some of the libs provide more i.e. eventlet
provides also coroutines
Python, pick one
              pika
• asyncio is part of python stdlib
• easy syntax
• developer member of RabbitMQ team
• fits on slides :-P
Code! Producer (ruby)
Consumer (ruby)
Behind the scenes

Publisher

  msg       Exchange   Queue   Consumer
What and where

     RabbitMQ
      (Erlang)              Producer
                          (ruby/python)

                 TCP/IP
                            Consumer
Exchange Queue
                          (ruby/python)
Producer (python)
Producer (python)




 TCP/IP connection
Producer (python)



       channel 1

 TCP/IP connection
Producer (python)



       channel 1

 TCP/IPchannel 2
         connection
Producer (python)



       channel 1

 TCP/IPchannel 2
         connection
       channel n
Producer (python)
Producer (python)
Producer (python)
Producer (python)
Producer (python)
Producer (python)
Producer (python)
Producer (python)
Producer (python)
Producer (python)
Producer (python)
Producer (python)
Publisher

  msg       Exchange   Queue   Consumer
Producer (python)
Publisher

  msg       Exchange   Queue     Consumer



             key based routing
Producer (python)
                       binding by key
Publisher

  msg       Exchange   Queue            Consumer



             key based routing
Consumer (python)
Things go wrong




If a consumer has a problem we might lose
          one or more messages
                   http://www.flickr.com/photos/danzen/2288625136/
ACKing consumer.rb
ACKing consumer.rb
ACKing consumer.rb
ACKing consumer.py
ACKing consumer.py
ACKing consumer.py
Achieved: decoupling

Publisher

  msg       Exchange   Queue   Consumer
Achieved: easy work
   load distribution
                               Consumer
Publisher

 msg A      Exchange   Queue   Consumer



                               Consumer
Achieved: easy work
   load distribution
                               Consumer
Publisher

            Exchange   Queue   Consumer
             msg A

                               Consumer
Achieved: easy work
   load distribution
                                     Consumer
Publisher

            Exchange   Queue msg A   Consumer



                                     Consumer
Achieved: easy work
   load distribution
                               msg A Consumer
Publisher

            Exchange   Queue         Consumer



                                     Consumer
prefetch?




http://www.flickr.com/photos/balakov/327431271
prefetch?


                      tcp ip
                      buffer

http://www.flickr.com/photos/balakov/327431271
prefetch - ruby
prefetch - ruby
prefetch - python
prefetch - python
More routing models

     multicasting
with fanout exchange
Fanout producer.rb
Fanout producer.rb
Fanout consumer.rb
Fanout consumer.rb
Fanout consumer.rb
Fanout consumer.rb
Fanout

                      Queue1   Cons1
Producer

msg A      Exchange   Queue2   Cons2


                      Queue3   Cons3
Fanout

                      Queue1   Cons1
Producer
           Exchange   Queue2   Cons2
            msg A

                      Queue3   Cons3
Fanout

                      msg A Queue1   Cons1
Producer
           Exchange   msg A Queue2   Cons2


                      msg A Queue3   Cons3
Fanout producer.py
Fanout producer.py
Fanout producer.py
Fanout consumer.py
Exchanges

• Direct - based on binding routing key
• Fanout - always to all bound queues
• Topic - pattern matching on routing key
Clustering
         RabbitMQ - node A   RabbitMQ - node B

TCP/IP                                           TCP/IP



         RabbitMQ - node C

TCP/IP
Plugins

• introduced with v 1.7.0
• Add functionalities to the broker
• makes a interesting first erlang project
Ecosystem


• 65 RabbitMQ / AMQP projects on github
• + more on bitbucket, and others
Sync?

• easier to add to web apps
• suitable for non performance critical
  messaging
• useful to build cli tools
Sync?

• celldee / bunny - Ruby (github)
• famoseagle / carrot - Ruby (github)
• py-amqplib - Python (http://barryp.org/software/py-amqplib/)
• ...
Distributed systems

• ezmobious / nanite - Ruby (github)
• ask / carrot - Python (github)
• ask / celery - Python (github)
• auser / poolparty - Erlang (github)
Real time web


• RabbitHub PubSubHubBub
• dansimpson / amqp-js (github)
Thank you!



    ?

More Related Content

What's hot (20)

PPTX
Scaling application with RabbitMQ
Nahidul Kibria
 
PPTX
Spring RabbitMQ
Martin Toshev
 
PDF
RabbitMQ Data Ingestion
Alvaro Videla
 
PDF
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
JAX London
 
PDF
Messaging Standards and Systems - AMQP & RabbitMQ
All Things Open
 
PPTX
The RabbitMQ Message Broker
Martin Toshev
 
PDF
Messaging with RabbitMQ and AMQP
Eberhard Wolff
 
PDF
Introduction to AMQP Messaging with RabbitMQ
Dmitriy Samovskiy
 
PDF
The Future of Messaging: RabbitMQ and AMQP
Eberhard Wolff
 
PDF
RabbitMQ Operations
Michael Klishin
 
PPTX
Spring RabbitMQ
Martin Toshev
 
PPTX
RabbitMQ Model and Some Example Applications
Houcheng Lin
 
PDF
RabbitMQ fairly-indepth
Wee Keat Chin
 
PDF
Integrating PostgreSql with RabbitMQ
Gavin Roy
 
PDF
Distributed messaging with AMQP
Wee Keat Chin
 
PDF
Troubleshooting RabbitMQ and services that use it
Michael Klishin
 
PDF
XMPP & AMQP
voluntas
 
PDF
Improvements in RabbitMQ
Alvaro Videla
 
PDF
AMQP with RabbitMQ
Spyros Papageorgiou
 
PDF
Full Stack Bus with Javascript, RabbitMQ and Postal.js
Javier Arias Losada
 
Scaling application with RabbitMQ
Nahidul Kibria
 
Spring RabbitMQ
Martin Toshev
 
RabbitMQ Data Ingestion
Alvaro Videla
 
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
JAX London
 
Messaging Standards and Systems - AMQP & RabbitMQ
All Things Open
 
The RabbitMQ Message Broker
Martin Toshev
 
Messaging with RabbitMQ and AMQP
Eberhard Wolff
 
Introduction to AMQP Messaging with RabbitMQ
Dmitriy Samovskiy
 
The Future of Messaging: RabbitMQ and AMQP
Eberhard Wolff
 
RabbitMQ Operations
Michael Klishin
 
Spring RabbitMQ
Martin Toshev
 
RabbitMQ Model and Some Example Applications
Houcheng Lin
 
RabbitMQ fairly-indepth
Wee Keat Chin
 
Integrating PostgreSql with RabbitMQ
Gavin Roy
 
Distributed messaging with AMQP
Wee Keat Chin
 
Troubleshooting RabbitMQ and services that use it
Michael Klishin
 
XMPP & AMQP
voluntas
 
Improvements in RabbitMQ
Alvaro Videla
 
AMQP with RabbitMQ
Spyros Papageorgiou
 
Full Stack Bus with Javascript, RabbitMQ and Postal.js
Javier Arias Losada
 

Viewers also liked (9)

KEY
Real time system_performance_mon
Tomas Doran
 
PDF
Rabbit mq簡介(上)
共和 薛
 
PPTX
Being Ready for Apache Kafka - Apache: Big Data Europe 2015
Michael Noll
 
PDF
唯品会大数据实践 Sacc pub
Chao Zhu
 
PPTX
Apache kafka
Rahul Jain
 
PDF
Apache Kafka lessons learned @PAYBACK
Maxim Shelest
 
PDF
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
mumrah
 
PPTX
Introduction to Apache Kafka
Jeff Holoman
 
PDF
Developing Real-Time Data Pipelines with Apache Kafka
Joe Stein
 
Real time system_performance_mon
Tomas Doran
 
Rabbit mq簡介(上)
共和 薛
 
Being Ready for Apache Kafka - Apache: Big Data Europe 2015
Michael Noll
 
唯品会大数据实践 Sacc pub
Chao Zhu
 
Apache kafka
Rahul Jain
 
Apache Kafka lessons learned @PAYBACK
Maxim Shelest
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
mumrah
 
Introduction to Apache Kafka
Jeff Holoman
 
Developing Real-Time Data Pipelines with Apache Kafka
Joe Stein
 
Ad

Similar to RabbitMQ with python and ruby RuPy 2009 (20)

PDF
Lindsay distributed geventzmq
Robin Xiao
 
PDF
Evented applications with RabbitMQ and CakePHP
markstory
 
PDF
Messaging with amqp and rabbitmq
Selasie Hanson
 
PPT
Rabbit MQ introduction
Sitg Yao
 
PDF
Plone, rabbit mq and messaging that just works
Asko Soukka
 
PPTX
Message Broker System and RabbitMQ
University of Alabama at Birmingham
 
KEY
High scale flavour
Tomas Doran
 
PDF
Messaging in the Cloud - AMQP, RabbitMQ and Spring
Eberhard Wolff
 
KEY
Message queueing
Richard Jones
 
PDF
Life in a Queue - Using Message Queue with django
Tareque Hossain
 
KEY
Message Queueing - by an MQ noob
Richard Jones
 
ODP
Inter-Process/Task Communication With Message Queues
wamcvey
 
PDF
Rabbit mq messaginginthecloud_v_mworld_2010_ms
Rabbit MQ
 
PDF
Rabbit mq messaginginthecloud_v_mworld_2010_ms
liuhao1983
 
PDF
Erlang factory slides
Lecturer UC Davis & Northwestern
 
PDF
Erlang factory slides
Noah Linden
 
PDF
Messaging Standards and Systems - AMQP & RabbitMQ
POSSCON
 
ODP
The Art of Message Queues - TEKX
Mike Willbanks
 
PDF
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland
 
Lindsay distributed geventzmq
Robin Xiao
 
Evented applications with RabbitMQ and CakePHP
markstory
 
Messaging with amqp and rabbitmq
Selasie Hanson
 
Rabbit MQ introduction
Sitg Yao
 
Plone, rabbit mq and messaging that just works
Asko Soukka
 
Message Broker System and RabbitMQ
University of Alabama at Birmingham
 
High scale flavour
Tomas Doran
 
Messaging in the Cloud - AMQP, RabbitMQ and Spring
Eberhard Wolff
 
Message queueing
Richard Jones
 
Life in a Queue - Using Message Queue with django
Tareque Hossain
 
Message Queueing - by an MQ noob
Richard Jones
 
Inter-Process/Task Communication With Message Queues
wamcvey
 
Rabbit mq messaginginthecloud_v_mworld_2010_ms
Rabbit MQ
 
Rabbit mq messaginginthecloud_v_mworld_2010_ms
liuhao1983
 
Erlang factory slides
Lecturer UC Davis & Northwestern
 
Erlang factory slides
Noah Linden
 
Messaging Standards and Systems - AMQP & RabbitMQ
POSSCON
 
The Art of Message Queues - TEKX
Mike Willbanks
 
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland
 
Ad

More from Paolo Negri (10)

PDF
Turning the web stack upside down rethinking how data flows through systems
Paolo Negri
 
PDF
AWS Lambda in infrastructure
Paolo Negri
 
PDF
Erlang introduction geek2geek Berlin
Paolo Negri
 
PDF
Erlang as a cloud citizen, a fractal approach to throughput
Paolo Negri
 
PDF
Getting real with erlang
Paolo Negri
 
PDF
Erlang factory 2011 london
Paolo Negri
 
PDF
Erlang factory SF 2011 "Erlang and the big switch in social games"
Paolo Negri
 
PDF
Scaling Social Games
Paolo Negri
 
PDF
Mongrel2, a short introduction
Paolo Negri
 
PDF
SimpleDb, an introduction
Paolo Negri
 
Turning the web stack upside down rethinking how data flows through systems
Paolo Negri
 
AWS Lambda in infrastructure
Paolo Negri
 
Erlang introduction geek2geek Berlin
Paolo Negri
 
Erlang as a cloud citizen, a fractal approach to throughput
Paolo Negri
 
Getting real with erlang
Paolo Negri
 
Erlang factory 2011 london
Paolo Negri
 
Erlang factory SF 2011 "Erlang and the big switch in social games"
Paolo Negri
 
Scaling Social Games
Paolo Negri
 
Mongrel2, a short introduction
Paolo Negri
 
SimpleDb, an introduction
Paolo Negri
 

Recently uploaded (20)

PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
PDF
Draugnet: Anonymous Threat Reporting for a World on Fire
treyka
 
PDF
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
PPTX
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
PDF
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
PDF
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
PDF
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
PDF
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
PDF
FME in Overdrive: Unleashing the Power of Parallel Processing
Safe Software
 
PPTX
Practical Applications of AI in Local Government
OnBoard
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PPTX
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
Draugnet: Anonymous Threat Reporting for a World on Fire
treyka
 
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
FME in Overdrive: Unleashing the Power of Parallel Processing
Safe Software
 
Practical Applications of AI in Local Government
OnBoard
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 

RabbitMQ with python and ruby RuPy 2009