Professional Documents
Culture Documents
INTERACTIVE POLLS
http://pollev.com/gmr SMS: 22333
Scaling RabbitMQ to 11
myYearbook.com
#1 Comscore Teen Destination, Top Trafficked Sites in US Use of RabbitMQ dates back to 2009 Multiple clusters for different purposes Browser <-> Backend Message Bus Messaging, Event Processing
DISASTER PORN
Gavin M. Roy @crad - Surge 2011
ABOUT AMPQ
Platform, Vendor Neutral Messaging format 0.9.1 finalized in November 2008 JP Morgan Chase, Red Hat, Rabbit Technologies, iMatrix, IONA Technologies, Cisco Systems, Envoy Technologies, Twist Process Innovations
Members now include Bank of America, Barclays Banks, Microsoft Corporation, Novell, VMWare 1.0 Final: October 2011
5
ABOUT RABBITMQ
Born in 2006, Released in 2007, Acquired in 2010 Written in Erlang/OTP Talks AMQP 0.8 and 0.9.1 Features include: Clustering, Active/Active HA Queues Management UI and API Plugin Architecture
6
PUBLISHERS
Gavin M. Roy @crad - Surge 2011
CONSUMERS
Gavin M. Roy @crad - Surge 2011
QUEUES
Durability: Queue survives reboot Auto-Delete: Delete the queue when consumer goes away Exclusive: Only one consumer may consume x-expires: Auto-Delete after given duration x-message-ttl: Auto-discard a message after ttl
11
MESSAGES
Have client specified properties: Content type, Encoding, Timestamp, App-Id, User-Id, Headers Delivery Mode: 1: Non-Persistent 2: Persistent
12
MESSAGE ROUTING
Its not just about Queues.
Gavin M. Roy @crad - Surge 2011
ROUTING KEY
In addition to the exchange, determines what is done with a message.
Gavin M. Roy @crad - Surge 2011
CC & BCC
Gavin M. Roy @crad - Surge 2011
HEADERS EXCHANGE
More on this later.
Gavin M. Roy @crad - Surge 2011
EXCHANGES
Gavin M. Roy @crad - Surge 2011
FANOUT
1:N Message Delivery Pattern No Routing Keys Involved Queues bound to a fanout exchange get all messages sent to the exchange
18
DIRECT
1:1 Message Delivery Pattern Routing Keys are direct, no wildcarding All queues bound to a routing key get the message
19
TOPIC EXCHANGES
Pattern Matching in Routing Keys Publish one message type to Surge.Sessions, another to Surge.Mentions Period delimiter, * stays within the period scope, # does not Example patterns: *.Mentions, Surge.*, # Slower than Fanout and Direct
20
HEADERS EXCHANGES
Matches on Basic.Properties headers table values to the arguments table specified when binding a queue Use x-match when declaring exchange to specify any or all headers must match Slow implementation in Erlang
21
PLUGIN EXCHANGES
Consistent Hash Exchange: Round-robin distribution to queues External: RPC Exchange Plugin Script: Similar in intent to External Riak Last-Value Cache Recent History Exchange: Keeps last 20 messages routed Global Fanout: Sends to all queues, regardless of routing key
22
CLUSTERS
Gavin M. Roy @crad - Surge 2011
SCALING ISSUES?
Scaling RabbitMQ to 11
WHAT TO WATCH
Scaling RabbitMQ to 11
RABBITMQ
Y U NO TAKE MESSAGE?
MEMORY MANAGEMENT
Gavin M. Roy @crad - Surge 2011
40%
MESSAGE PERSISTENCE
50-70% performance penalty compared to non-persisted messages. *
http://www.rabbitmq.com/faq.html#performance-persistent
CONSUMING
Ack, Nack and Reject vs Basic.Consume(no_ack=True)
Gavin M. Roy @crad - Surge 2011
Scaling RabbitMQ to 11
Server Basic.Deliver
Client Basic.[Ack/Nack/Reject]
Basic.[Ack/Nack/Reject]Ok
BASIC.QOS
Prefetch Size and Count How many messages the client wants the RabbitMQ to pre-deliver to the client
APACHE + MOD_PHP
Gavin M. Roy @crad - Surge 2011
CONNECTION PERSISTENCE
Gavin M. Roy @crad - Surge 2011
VORPAL BUNNY
VORPAL BUNNY
Light-weight PHP client for RabbitMQ Used the experimental JSON-RPC Channel plugin Handles the overhead of the HTTP, JSON-RPC to AMQP analog Fire and forget message publishing Can not be transparently load balanced
48
UP TO 60 SECONDS TO DETECT
Gavin M. Roy @crad - Surge 2011
RECOVERY?
CLUSTERING ALTERNATIVES
Gavin M. Roy @crad - Surge 2011
FEDERATION
Scaling RabbitMQ to 11
Exchange Plugin Provides ability to route all messages to a x-federation exchange to another broker
SHOVEL PLUGIN
From Queue on one broker to an exchange on another broker. Effective for cross-cluster data broadcasting
61
PHOTO CREDITS
62
Scaling RabbitMQ to 11
QUESTIONS?
Gavin M. Roy @crad - Surge 2011