SlideShare a Scribd company logo
Understanding
RabbitMQ Internals

                       2009-07-03
           Accense Technology, Inc.
                    Ryosuke NAKAI
Agenda
Introduction
AMQP?
RabbitMQ?
LShift?
Understanding RabbitMQ Internals
Introduction

Erlang/2, Python/7, Mac/3, VIM/4

XMPP, AMQP, SIP, HTTP, WebSockets

  RADIUS, DNS, DHCP
AMQP?
LShift?
     BBC, MS, Yahoo, T-Mobile, Vodafone

     Erlang

     Java     C#

RabbitMQ
C#           Java


Publisher   Subscriber

                                ...
RabbitMQ?
LShift                   AMQP

Erlang




Mozilla Public License

Erlang                      c_src
RabbitHub

PubSub-over-Webhooks with RabbitHub

MochiWeb

http://code.google.com/p/pubsubhubbub/

http://github.com/tonyg/rabbithub/tree/master
Understanding
RabbitMQ Internals
AMQP

                     ...

Erlang




         ...
tcp_listener.erl, tcp_acceptor.erl

  prim_inet:async_accept

tcp_listener_sup.erl, tcp_acceptor_sup.erl

  one_for_all

  simple_one_for_one

gen_server2, priority_queue

  pcall, pcast

  priority_queue:new, priority_queue:in/out
rabbit_log.erl

  error_logger

  gen_server

rabbit_control.erl

  init:get_plain_arguments

rabbit_tests.erl

rabbit_error_logger.erl

  gen_event
tcp_listener, tcp_acceptor
prim_inet:async_accept
gen_server

  gen_server  gen_tcp:accept
          (OTP     )

  mochiweb, Kai    proc_lib

  RabbitMQ    prim_inet:async_accept
!"#$%&'!()(*$'+#
                        '+#(*,&'-*




               -)($1-*$.%%
                                  -)($1-*$.%%




!"#$%&'!()(*                              !"#$.""(#!-*$'+#
  /-*0(*                                      '+#(*,&'-*




                                                '&2#%($-)($1-*$-)(




                                                       !"#$.""(#!-*
                                                          /-*0(*
one_for_all

tcp_listener            LSock



tcp_listener        tcp_acceptor
tcp_acceptor   supervisor:start_child
simple_one_for_one
one_for_one             supervisor:append_child
        ChildSpec

ListenSocket    start_child



supervisor:start_child(tcp_acceptor_sup, [LSock])

  module, function, [Arg1, Arg2] ++ [LSock]
tcp_listener:init
rabbit_control.erl
erl -extra

  init:get_plain_arguments()

-s module function arg1 arg2 arg3 ...

  default function ... start

-noinput, -hidden, -sname(MUST DNS)

erlang:list_to_atom(Commnad)

  ...(add_user, Node, ...)
fun(I) when .. -> ... (I) when ...




case A of _ when is_record(B) -> ; _ when
is_integer(C) -> ; ... .
RabbitMQ
Info, Key, Value
rabbit_log
gen_server

  handle_cast       log

error_logger

  info_msg, warning_msg, error_msg

  format, args
rabbit_tests
common_test      EUnit




 test_topic_matching

   passed = test_topic_match(“#”, “test.test”)

   passed = test_topic_match(“#.test”, “test”)

 Cluster   Log
gen_server2 & priority_queue

gen_server2:pcall/3, pcall/4, pcast/3

  pcall(Name, Priority, Request)

  pcall(Name, Priority, Request, Timeout)

  pcast({Name, Node}, Priority, Request)

call/cast
gen_server2

           gen_server    call   cast



gen_server2         priority_queue



priority
priority_queue

Queue = priority_queue:new().

priority_queue:in(X, 5, Queue).

Queue



priority_queue:out(Queue)
rabbit_error_logger

gen_event

  gen_event:add_handler

Exchange

-define(LOG_EXCH_NAME, <<"amq.rabbitmq.log">>).

  topic

More Related Content

PPTX
Build a compiler in 2hrs - NCrafts Paris 2015
PDF
Drupal 8 in action, the route to the method
PDF
Hacking Mac OSX Cocoa API from Perl
PDF
Debugging: Rules & Tools
PDF
PDF
KubeCon EU 2016: Custom Volume Plugins
PDF
Puppet Module Reusability - What I Learned from Shipping to the Forge
PDF
Augeas
Build a compiler in 2hrs - NCrafts Paris 2015
Drupal 8 in action, the route to the method
Hacking Mac OSX Cocoa API from Perl
Debugging: Rules & Tools
KubeCon EU 2016: Custom Volume Plugins
Puppet Module Reusability - What I Learned from Shipping to the Forge
Augeas

What's hot (20)

ODP
Nigel hamilton-megameet-2013
PPTX
How to recognise that the user has just uninstalled your android app droidc...
PPTX
How to recognise that the user has just uninstalled your android app
PDF
Ember background basics
PDF
Beyond Golden Containers: Complementing Docker with Puppet
PDF
Capistrano Rails
PDF
Go初心者がGoでコマンドラインツールの作成に挑戦した話
PDF
ES6 generators
KEY
plackdo, plack-like web interface on perl6
PDF
Javascript ES6 generators
PDF
Alta performance com Python
PDF
Chef Workshop: Setup Environment with Chef,Vagrant, and Berkshelf
KEY
puppet @techlifecookpad
PDF
Introduction to JavaFX 2
PDF
How to stand on the shoulders of giants
PDF
R-House (LSRC)
PPTX
Joy of Six - Discover the Joy of Perl 6
PDF
Django osc2018-okinawa
PDF
ZeroMQ Is The Answer: DPC 11 Version
PDF
ZeroMQ: Messaging Made Simple
Nigel hamilton-megameet-2013
How to recognise that the user has just uninstalled your android app droidc...
How to recognise that the user has just uninstalled your android app
Ember background basics
Beyond Golden Containers: Complementing Docker with Puppet
Capistrano Rails
Go初心者がGoでコマンドラインツールの作成に挑戦した話
ES6 generators
plackdo, plack-like web interface on perl6
Javascript ES6 generators
Alta performance com Python
Chef Workshop: Setup Environment with Chef,Vagrant, and Berkshelf
puppet @techlifecookpad
Introduction to JavaFX 2
How to stand on the shoulders of giants
R-House (LSRC)
Joy of Six - Discover the Joy of Perl 6
Django osc2018-okinawa
ZeroMQ Is The Answer: DPC 11 Version
ZeroMQ: Messaging Made Simple
Ad

Similar to RabbitMQ (20)

PDF
YAPC::Brasil 2009, POE
ODP
6. processes and threads
PDF
Alexander Reelsen - Seccomp for Developers
PDF
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
PDF
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
PDF
Debugging Ruby Systems
PDF
[Ruxcon 2011] Post Memory Corruption Memory Analysis
PPT
[CCC-28c3] Post Memory Corruption Memory Analysis
PDF
Zope component architechture
PDF
Hacking parse.y (RubyKansai38)
PDF
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
ODP
Sysprog 13
PDF
Cukeup nyc ian dees on elixir, erlang, and cucumberl
PDF
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHPNW Dec 2014 Meetup)
PDF
Rust: код может быть одновременно безопасным и быстрым, Степан Кольцов
PDF
Performance tweaks and tools for Linux (Joe Damato)
PDF
[Kiwicon 2011] Post Memory Corruption Memory Analysis
PDF
[HITB Malaysia 2011] Exploit Automation
PDF
RabbitMQ for Perl mongers
PDF
Hacking the swisscom modem
YAPC::Brasil 2009, POE
6. processes and threads
Alexander Reelsen - Seccomp for Developers
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
Debugging Ruby Systems
[Ruxcon 2011] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis
Zope component architechture
Hacking parse.y (RubyKansai38)
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
Sysprog 13
Cukeup nyc ian dees on elixir, erlang, and cucumberl
Adding 1.21 Gigawatts to Applications with RabbitMQ (PHPNW Dec 2014 Meetup)
Rust: код может быть одновременно безопасным и быстрым, Степан Кольцов
Performance tweaks and tools for Linux (Joe Damato)
[Kiwicon 2011] Post Memory Corruption Memory Analysis
[HITB Malaysia 2011] Exploit Automation
RabbitMQ for Perl mongers
Hacking the swisscom modem
Ad

RabbitMQ