• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Distributed messaging with AMQP
 

Distributed messaging with AMQP

on

  • 562 views

A presentation on the AMQP protocol with a brief live demo of RabbitMQ to illustrate the protocol.

A presentation on the AMQP protocol with a brief live demo of RabbitMQ to illustrate the protocol.

Statistics

Views

Total Views
562
Views on SlideShare
542
Embed Views
20

Actions

Likes
0
Downloads
27
Comments
0

3 Embeds 20

http://www.linkedin.com 16
http://localhost 3
http://dschool.co 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Distributed messaging with AMQP Distributed messaging with AMQP Presentation Transcript

    • Distributed Messaging AMQP, RabbitMQ (Quick demo) Tuesday, 10 September 13
    • Event Logging Current architecture & problems Tuesday, 10 September 13
    • Event Logging Server Client Client Client MongoDB Tuesday, 10 September 13
    • Problem Server Client Client Client 80 110 65 MongoDB Tuesday, 10 September 13
    • Problem Server Client Client Client 80 110 65 255 MongoDB Tuesday, 10 September 13
    • Problem Server Client Client Client 0 0 0 0 MongoDB Tuesday, 10 September 13
    • Problem Server Client Client Client 0 0 0 0 MongoDB Tuesday, 10 September 13
    • Possible Solutions • Server tweaks:TCP conns, ulimit, etc • Multi-master model • Localised queue • ... and quite a few more Tuesday, 10 September 13
    • Possible Solutions • Server tweaks:TCP conns, ulimit, etc • Multi-master model •Localised queue • ... and quite a few more Tuesday, 10 September 13
    • Localised Queues • Fast (no TCP latency) • Network partition tolerant • Modular & scalable • Reliable & Durable Tuesday, 10 September 13
    • Why Localise? Server Client Client Client 80 110 65 MongoDB Q Q Q < 10 Tuesday, 10 September 13
    • Why Localise? Server Client Client Client 80 110 65 MongoDB Q Q Q 0 Tuesday, 10 September 13
    • Why Localise? Server Client Client Client 80 110 65 MongoDB Q Q Q 0 Tuesday, 10 September 13
    • Why Localise? Server Client Client Client 80 110 65 MongoDB Q Q Q < 10 Tuesday, 10 September 13
    • Why Localise? Server Client Client Client 80 110 65 MongoDB Q Q Q < 10 Client Q Tuesday, 10 September 13
    • Queue Criteria • Reliable • Durable • Scalable Tuesday, 10 September 13
    • AMQP Advanced Message Queueing Protocol Tuesday, 10 September 13
    • Why AMQP? • Stable and mature • Designed for SX markets • Widely supported (good interop) • Modular, Fast & Flexible Tuesday, 10 September 13
    • Service ModelWire AMQP Overview AMQP Advanced Message Queueing Protocol Tuesday, 10 September 13
    • Service Model Wire AMQP Overview AMQP Tuesday, 10 September 13
    • ➡ Model/component spec ‣ Exchange ‣ Message Queue ‣ Binding AMQ Model Wire AMQP Overview AMQP Tuesday, 10 September 13
    • ➡ Model/component spec ‣ Exchange ‣ Message Queue ‣ Binding AMQ Model Wire AMQP Overview AMQP ➡ Function layer ‣Transactions, Exchange, Queues, etc ➡Transport layer ‣ Protocol format ‣ Data rep/framing ‣ Multiplexing, heart-beating, etc Tuesday, 10 September 13
    • AMQ Model Wire AMQP Overview AMQP ➡ Function layer ‣Transactions, Exchange, Queues, etc ➡Transport layer ‣ Protocol format ‣ Data rep/framing ‣ Multiplexing, heart-beating, etc ➡ Model/component spec ‣ Exchange ‣ Message Queue ‣ Binding Tuesday, 10 September 13
    • ExchangeQueuesBindingAMQ Model AMQ Model Tuesday, 10 September 13
    • QueuesExchange Binding AMQ Model AMQ Model Tuesday, 10 September 13
    • Virtual Host QueuesExchange Binding AMQ Model AMQ Model Tuesday, 10 September 13
    • Virtual Host QueuesExchange Binding AMQ Model AMQ Model Publisher Consumer Tuesday, 10 September 13
    • Virtual Host QueuesExchange Binding AMQ Model Publisher Consumer Tuesday, 10 September 13
    • Virtual Host QueuesExchange Binding AMQ Model Router Message Publisher Consumer Tuesday, 10 September 13
    • Virtual Host QueuesExchange Binding AMQ Model Router Message Publisher Consumer Tuesday, 10 September 13
    • Virtual Host QueuesExchange Binding AMQ Model Router Message Publisher Consumer Tuesday, 10 September 13
    • Virtual Host QueuesExchange Binding AMQ Model Router ?Message Publisher Consumer Tuesday, 10 September 13
    • Virtual Host QueuesExchange Binding AMQ Model Message Router ? Publisher Consumer Tuesday, 10 September 13
    • Virtual Host QueuesExchange Binding AMQ Model Message Router Publisher ➡ Queue: ‣ critical_error_queue ➡ Exchange: ‣ errors_exchange ➡ Filter: ‣ *.error.critical Consumer Tuesday, 10 September 13
    • Virtual Host QueuesExchange Binding AMQ Model ➡ Queue: ‣ critical_error_queue ➡ Exchange: ‣ errors_exchange ➡ Filter: ‣ *.error.critical Message Router Publisher Consumer Tuesday, 10 September 13
    • QueuesExchange Binding AMQP Service Model Tuesday, 10 September 13
    • QueuesExchange Binding AMQP Service Model ‣ routes messages based on criteria ‣ doesn’t store messages ‣ can inspect message content ‣ can be created at runtime consumers Tuesday, 10 September 13
    • QueuesExchange Binding AMQP Service Model ‣ store messages ‣ named ‣ bound-able to exchange ‣ criteria ‣ can be created at runtime by consumers ‣ routes messages based on criteria ‣ doesn’t store messages ‣ can inspect message content ‣ can be created at runtime consumers Tuesday, 10 September 13
    • QueuesExchange Binding AMQP Service Model ‣ creates a relationship between queues and exchanges ‣ contains criteria and properties ‣ can be created at runtime by consumers ‣ store messages ‣ named ‣ bound-able to exchange ‣ criteria ‣ can be created at runtime by consumers ‣ routes messages based on criteria ‣ doesn’t store messages ‣ can inspect message content ‣ can be created at runtime consumers Tuesday, 10 September 13
    • QueuesExchange Binding AMQP Service Model ‣ creates a relationship between queues and exchanges ‣ contains criteria and properties ‣ can be created at runtime by consumers ‣ store messages ‣ named ‣ bound-able to exchange ‣ criteria ‣ can be created at runtime by consumers ‣ routes messages based on criteria ‣ doesn’t store messages ‣ can inspect message content ‣ can be created at runtime consumers Tuesday, 10 September 13
    • QueuesExchange Binding AMQP Service Model Publisher Consumer ‣ creates a relationship between queues and exchanges ‣ contains criteria and properties ‣ can be created at runtime by consumers ‣ store messages ‣ named ‣ bound-able to exchange ‣ criteria ‣ can be created at runtime by consumers ‣ routes messages based on criteria ‣ doesn’t store messages ‣ can inspect message content ‣ can be created at runtime consumers Tuesday, 10 September 13
    • QueuesExchange Binding AMQP Service Model Publisher Consumer ‣ creates a relationship between queues and exchanges ‣ contains criteria and properties ‣ can be created at runtime by consumers ‣ store messages ‣ named ‣ bound-able to exchange ‣ criteria ‣ can be created at runtime by consumers ‣ routes messages based on criteria ‣ doesn’t store messages ‣ can inspect message content ‣ can be created at runtime consumers ‣ can create exchanges and queues ‣ can create exchanges and queues Tuesday, 10 September 13
    • Exchange AMQP Service Model Tuesday, 10 September 13
    • FanoutTopicHeadersSystem Exchange AMQP Service Model Types (routing algo) Tuesday, 10 September 13
    • Fanout Topic Headers System Exchange AMQP Service Model Types (routing algo) Direct Tuesday, 10 September 13
    • Fanout Topic Headers System Exchange AMQP Service Model Types (routing algo) Direct Tuesday, 10 September 13
    • Exchange AMQP Service Model Direct Type Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model Direct Type Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model Direct Type Message Message Message event.user.click event.user.view event.user.share Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model Direct Type Message Message Message event.user.click event.user.view event.user.share user_click_queue Tuesday, 10 September 13
    • Exchange ‘events’ Binding AMQP Service Model ➡Queue: ‣ user_click_queue Direct Type Message Message Message event.user.click event.user.view event.user.share user_click_queue Tuesday, 10 September 13
    • Exchange ‘events’ Binding AMQP Service Model ➡Queue: ‣ user_click_queue ➡Exchange: ‣ events Direct Type Message Message Message event.user.click event.user.view event.user.share user_click_queue Tuesday, 10 September 13
    • Exchange ‘events’ Binding AMQP Service Model ➡Queue: ‣ user_click_queue ➡Exchange: ‣ events ➡Routing Key: ‣ event.user.click Direct Type Message Message Message event.user.click event.user.view event.user.share user_click_queue Tuesday, 10 September 13
    • Exchange ‘events’ Binding AMQP Service Model ➡Queue: ‣ user_click_queue ➡Exchange: ‣ events ➡Routing Key: ‣ event.user.click Direct Type Message Message Message event.user.click event.user.view event.user.share PHP Script PHP Script PHP Script user_click_queue Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model Direct Type Message Message Message event.user.click event.user.view event.user.share PHP Script PHP Script PHP Script user_click_queue ConsumerPublisher/ Producer Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model Direct Type Message Message Message event.user.click event.user.view event.user.share user_click_queue user_view_queue user_share_queue Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model Direct Type Message Message Message event.user.click event.user.view event.user.share user_click_queue user_view_queue user_share_queue Message Message Message Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model What if... Message Message Message event.user.click event.user.view event.user.share user_interaction_queue user_shares_queue Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model What if... user_interaction_queue user_shares_queue Message Message Message event.user.click event.user.view event.user.share Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model What if... Message Message Message event.user.click event.user.view event.user.share user_interaction_queue user_shares_queue Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model Topic Exchange user_interaction_queue Binding Message Message Message event.user.click event.user.view event.user.share Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model Topic Exchange user_interaction_queue Binding ➡Queue: ‣ user_interaction_queue ➡Exchange: ‣ events ➡Routing Key: ‣ event.user.* Message Message Message event.user.click event.user.view event.user.share Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model Topic Exchange user_interaction_queue Binding ➡Queue: ‣ user_interaction_queue ➡Exchange: ‣ events ➡Routing Key: ‣ event.user.* Message Message Message event.user.click event.user.view event.user.share PHP Script PHP Script PHP Script Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model Topic Exchange user_shares_queue Binding Message Message Message event.user.click event.user.view event.user.share Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model Topic Exchange user_shares_queue Binding ➡Queue: ‣ user_interaction_queue ➡Exchange: ‣ events ➡Routing Key: ‣ event.user.share Message Message Message event.user.click event.user.view event.user.share Tuesday, 10 September 13
    • Exchange ‘events’ AMQP Service Model Topic Exchange user_shares_queue Binding ➡Queue: ‣ user_interaction_queue ➡Exchange: ‣ events ➡Routing Key: ‣ event.user.share Message Message Message event.user.click event.user.view event.user.share PHP Script PHP Script PHP Script Tuesday, 10 September 13
    • Message Exchange ‘events’ AMQP Service Model Topic Exchange Message Message Message event.user.click event.user.view event.user.share user_interaction_queue user_shares_queue Message Message event.user.* event.user.share Tuesday, 10 September 13
    • Message Exchange ‘events’ AMQP Service Model Topic Exchange Message Message Message event.user.click event.user.view event.user.share user_interaction_queue user_shares_queue Message Message Can be done at runtime event.user.* event.user.share Tuesday, 10 September 13
    • Message Exchange ‘events’ AMQP Service Model Topic Exchange Message Message Message event.user.click event.user.view event.user.share user_interaction_queue user_shares_queue Message Message Click vs Share Conversion? event.user.* event.user.share Tuesday, 10 September 13
    • Message Exchange ‘events’ AMQP Service Model Topic Exchange Message Message Message event.user.click event.user.view event.user.share user_interaction_queue user_shares_queue Message Message Click vs Share Conversion? event.user.* event.user.share Message click_share_queue Message event.user.share event.user.click Tuesday, 10 September 13
    • Message Exchange ‘events’ AMQP Service Model Topic Exchange Message Message Message event.user.click event.user.view event.user.share user_interaction_queue user_shares_queue Message live_view_queue event.user.* event.user.share *.*.view Message Message event.staff.view Message Message Staff vs user views? Tuesday, 10 September 13
    • AMQ Model Wire AMQP Overview AMQP ➡ Function layer ‣Transactions, Exchange, Queues, etc ➡Transport layer ‣ Protocol format ‣ Data rep/framing ‣ Multiplexing, heart-beating, etc ➡ Model/component spec ‣ Exchange ‣ Message Queue ‣ Binding Tuesday, 10 September 13
    • ➡ Model/component spec ‣ Exchange ‣ Message Queue ‣ Binding AMQ Model Wire AMQP Overview AMQP ➡ Function layer ‣Transactions, Exchange, Queues, etc ➡Transport layer ‣ Protocol format ‣ Data rep/framing ‣ Multiplexing, heart-beating, etc Tuesday, 10 September 13
    • Wire Wire Protocol Tuesday, 10 September 13
    • Wire Wire Protocol ‣ Datagram specification ‣ Protocol header ‣ Payload format ‣ Data fields specification ‣ Content framing ‣ Heartbeat frames ‣ Channel multiplexing ‣ Visibility guarantee ‣ Channel closure ‣ Content synchronisation ‣ Content ordering Tuesday, 10 September 13
    • Wire Protocol Method Payloads Tuesday, 10 September 13
    • Wire Protocol Method Payloads Tuesday, 10 September 13
    • Virtual Host QueuesExchange Binding Summary ➡ Queue: ‣ critical_error_queue ➡ Exchange: ‣ errors_exchange ➡ Filter: ‣ *.error.critical Message Router Publisher Consumer Tuesday, 10 September 13
    • Revisiting event logging A proposed solution Tuesday, 10 September 13
    • Event Logging Revisited Client Client Client MongoDB Tuesday, 10 September 13
    • Event Logging Revisited Client Client Client MQ MQ MQ MongoDB Tuesday, 10 September 13
    • MongoDB Event Logging Revisited MQClient Client Client 80 110 65 MQ MQ MQ Tuesday, 10 September 13
    • MongoDB Event Logging Revisited MQClient Client Client 80 110 65 MQ MQ MQ Tuesday, 10 September 13
    • MongoDB Event Logging Revisited MQClient Client Client 80 110 65 MQ MQ MQ MQ Tuesday, 10 September 13
    • MongoDB Event Logging Revisited MQ Client Client Client 80 110 65 MQ MQ MQ MQ Tuesday, 10 September 13
    • Message Exchange ‘events’ AMQP Service Model Topic Exchange Message Message Message event.user.click event.user.view event.user.share user_interaction_queue user_shares_queue Message live_view_queue event.user.* event.user.share *.*.view Message Message event.staff.view Message Message Remember this? Tuesday, 10 September 13
    • MongoDB Event Logging Revisited MQClient Client Client 80 110 65 MQ MQ MQ Reporting SQL Notification Tuesday, 10 September 13
    • RabbitMQ An AMQP Implementation Tuesday, 10 September 13
    • Why RabbitMQ? • Mature (born 2006) • Acquired by SpringSource (now part of VMWare) in 2010 • Used by companies like Nokia, Google, Mozilla, vFabric, SecondLife, OpenStack Tuesday, 10 September 13
    • Overview • Written in Erlang/OTP • Supports other protocols too - STOMP, MQTT • Many library supports - Python, PHP, Ruby, .NET • RESTful API is available Tuesday, 10 September 13
    • Hands on Demo Tuesday, 10 September 13
    • Q&A Tuesday, 10 September 13
    • Coming soon... RabbitMQ in Depth (sort of) Tuesday, 10 September 13