Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
RabbitMQ OverviewTony Garnock-Jones <[email protected]>
Wednesday, 19 August 2009
Agenda
• AMQP in 3 minutes
• RabbitMQ architecture
• Availability, Clustering, Federation
• Durability, Persistence, Memory usage
• Security
• Operational Tools
• Ongoing work
Wednesday, 19 August 2009
AMQP
Wednesday, 19 August 2009
AMQP Basics
• Exchanges perform relaying, copying, and filtering
• Queues perform buffering and round-robin delivery
X
PC
X
P
C
C
(0-9-1)
Wednesday, 19 August 2009
AMQP Basics
ExchangesX
QueuesQ
bind to
(0-9-1)
App
App
Producers
Consumers
publish to
deliver to
Wednesday, 19 August 2009
PubSub
• AMQP exchange used as the destination copies to multiple queues
• Per-consumer private queues receive topical messages
XP
C
C
Wednesday, 19 August 2009
Queueing
• Using the default exchange (“”) routes directly to queues
• Both shared and private queues can be addressed like this
PC
C
Wednesday, 19 August 2009
Simple load-balancing
• Shared queue mediates access to service instances
• Load-balancing, live upgrades, fault-tolerance
Request Queue
(Private)ReplyQueue
Wednesday, 19 August 2009
RabbitMQ
Wednesday, 19 August 2009
Code Overview
(out of date numbers! it’s ~7500 LoC now, mid 2009)
Wednesday, 19 August 2009
Concurrency
Wednesday, 19 August 2009
Order Preservation
Wednesday, 19 August 2009
Clustering
Wednesday, 19 August 2009
Clustering
Erlang Node
Message Store
Physical Machine
Listening Socket
Virtual Host
Erlang’s inter-nodemessage routing
Wednesday, 19 August 2009
Connectivity
Wednesday, 19 August 2009
Availability,Clustering,Federation
Wednesday, 19 August 2009
Failover
• Split “availability” into
• Service availability: a broker’s ready when you need one
• Data availability: your persisted messages survive failures
• Short outage during failover; non-ack’d messages will need to be retransmitted
• Need better? Use redundant data paths
Wednesday, 19 August 2009
Failover
• Off-the-shelf components:
• Networked fsync()able filesystem
• Failure monitor: Linux-HA, ping + virtual ethernet, ...
Wednesday, 19 August 2009
FailoverC
X X
P
SAN
PrimaryWarm standby
mnesia + message journal
Wednesday, 19 August 2009
Redundancy for HA
X
P
C
X X
P
C
XOne broker,
two nodes each
Two brokers,
one node each
Wednesday, 19 August 2009
Exactly-Once Delivery
• “guaranteed delivery”, even with intermittent links
• “auto-deduplication”
Broker
Client
Client
Wednesday, 19 August 2009
Paul Baran’s NetworksPaul Baran, Introduction to Distributed Communications Networks, 1964
Wednesday, 19 August 2009
Clustering
Wednesday, 19 August 2009
WAN ClusterThe WAN cluster has local queues but global exchanges
Apps decide which broker-cluster to publish to
Wednesday, 19 August 2009
SynchronisationWhen clustering might not be right:
• huge networks
• intermittent connectivity
• ruling bandwidth with an iron fist
• different administrative domains
Wednesday, 19 August 2009
Synchronisation
Wednesday, 19 August 2009
Ring
Pass it on to your neighbour if your neighbour’s name isn’t in the list yet
Wednesday, 19 August 2009
CompleteGraph
Pass it on to your neighbour if it hasn’t been labelled at all yet
Wednesday, 19 August 2009
Multicast
Pass it on to your neighbour if it hasn’t been labelled at all yet
Wednesday, 19 August 2009
Durability, Persistence & Memory Usage
Wednesday, 19 August 2009
Terminology
• Durable: resource (exchange, queue, binding) that survives broker restart
• Persistent: message that survives broker restart
• Durability and persistence required for robust storage at the broker
Wednesday, 19 August 2009
Persister: Old
• Old persister slows down dramatically once a backlog builds up
• Old persister uses disk as a backup only: still limited by RAM + swap
• Once swap runs out, it’s all over
Wednesday, 19 August 2009
Persister: New
• New persister doesn’t slow down with backlog
• New persister doesn’t overflow RAM(but does make good use of the RAM you have installed!)
• Automatic or manual decision when to switch to disk and then disk-only mode
• Carefully tuned to give good default behaviour
Wednesday, 19 August 2009
32B, Backlog 5,000
Wednesday, 19 August 2009
32B, Backlog 10,000
Wednesday, 19 August 2009
32B, Backlog 20,000
Wednesday, 19 August 2009
32B, Backlog 40,000
Wednesday, 19 August 2009
32B, Backlog 80,000
Wednesday, 19 August 2009
1MB, Backlog 125
Wednesday, 19 August 2009
1MB, Backlog 250
Wednesday, 19 August 2009
1MB, Backlog 500
Wednesday, 19 August 2009
1MB, Backlog 1,000
Wednesday, 19 August 2009
1MB, Backlog 2,000
Wednesday, 19 August 2009
1MB, Backlog 4,000
Wednesday, 19 August 2009
Persister: Summary
• Fast (slower than old persister, but still fast)
• Scales to fill your disks without filling RAM
• In QA at the moment; will land for 1.7
Wednesday, 19 August 2009
Security
Wednesday, 19 August 2009
Resource ACLs
• Users are granted access to each vhost
• Each user has three regular expressions:
• for Administrative actions (create, delete)
• for Reading (bind from exch, consume from queue)
• for Writing (publish to exch, bind to queue)
Wednesday, 19 August 2009
Encryption, PKI
• Securing the Transport
• stunnel4
• native SSL support in final QA
• Securing the Messages
• key directory + per-message encryption and signing
Wednesday, 19 August 2009
Operational Tools
Wednesday, 19 August 2009
rabbitmqctl
Wednesday, 19 August 2009
BDL
Wednesday, 19 August 2009
Munin plugins
Wednesday, 19 August 2009
RESTful APIs: TrixxGET http://localhost:8080/exchanges/:vhostPOST http://localhost:8080/exchangesGET http://localhost:8080/queues/:vhostPOST http://localhost:8080/queuesGET http://localhost:8080/bindings/:vhostGET http://localhost:8080/vhostsPOST http://localhost:8080/vhostsGET http://localhost:8080/connectionsGET http://localhost:8080/users/:user/permissions
GET http://localhost:8080/usersPUT http://localhost:8080/users
POST http://localhost:8080/users
DELETE http://localhost:8080/users/:user
GET http://localhost:8080/rabbit/statusPUT http://localhost:8080/rabbit/startPUT http://localhost:8080/rabbit/stopPUT http://localhost:8080/rabbit/reset
POST http://localhost:8080/sessions/authenticate
Wednesday, 19 August 2009
RESTful APIs: Alice /conn - Current connection information /exchanges - Current exchanges information /queues - Current queues /users - Current users /bindings - Current bindings /control - Access to the RabbitMQ control /permissions - Current permissions /vhosts - Current vhosts
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
auser $ curl -i -XPOST \ -d'{"username":"ari", "password":"weak password"}' \ http://localhost:9999/users HTTP/1.1 200 OKServer: MochiWeb/1.0 (Any of you quaids got a smint?)Date: Thu, 16 Jul 2009 00:10:35 GMTContent-Type: text/jsonContent-Length: 25
{"users":["ari","guest"]}
Wednesday, 19 August 2009
Web UIs: Trixx
Wednesday, 19 August 2009
Web UIs: Wonderland
Wednesday, 19 August 2009
Other ongoing projects• Management
• SNMP
• JMX, HermesJMS
• Presence, meta-events
• AMQP Protocol extensions for management
• Gateways, federation
• RabbitHub (HTTP)
• Multicast
• XMPP, JMS bridges
• AMQP Protocol extensions for generalised gatewaying
Wednesday, 19 August 2009