Achieving Scale With Messaging And The Cloud 20090709
-
Upload
leastfixedpoint -
Category
Technology
-
view
4.573 -
download
1
Transcript of Achieving Scale With Messaging And The Cloud 20090709
![Page 1: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/1.jpg)
Achieving Scale with Messaging & the Cloud
Tony Garnock-Jones <[email protected]>
1Thursday, 9 July 2009
![Page 2: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/2.jpg)
Outline
• Messaging – what, why
• Cloud Messaging – some examples
• Achieving Scale – what, why, how
2Thursday, 9 July 2009
![Page 3: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/3.jpg)
Messaging
3Thursday, 9 July 2009
![Page 4: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/4.jpg)
Messaging Elements...relaying, filtering, multicasting, forwarding, buffering,
distribution/scheduling, subscription, topics, streaming, ...
ElementElement
Element
Element
Element
Element
...
...
4Thursday, 9 July 2009
![Page 5: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/5.jpg)
What is it good for?
• debuggability
• manageability
• monitorability
• rolling upgrades
• load-balancing
• cross-language integration
• fault-tolerance
• store-and-forward
• ...
Decoupling communication from behaviour, enabling:
5Thursday, 9 July 2009
![Page 6: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/6.jpg)
Messaging Elements...relaying, filtering, multicasting, forwarding, buffering,
distribution/scheduling, subscription, topics, streaming, ...
Elementmessage
messages
subscribe unsubscribe
6Thursday, 9 July 2009
![Page 7: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/7.jpg)
Messaging Elements
• Delivery:
• deliver(target, message);
• Subscription:
• bind(source, topic, target);
• unbind(source, topic, target);
7Thursday, 9 July 2009
![Page 8: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/8.jpg)
AMQP for Messaging
• Exchanges perform relaying, copying, and filtering
• Queues perform buffering and round-robin delivery
X
PC
X
P
C
C
8Thursday, 9 July 2009
![Page 9: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/9.jpg)
It’s Easy
QueueingConsumer consumer = new QueueingConsumer(ch);ch.basicConsume(queueName, consumer);while (true) { QueueingConsumer.Delivery delivery = consumer.nextDelivery(); // ... use delivery.getBody(), etc ... ch.basicAck(delivery.getEnvelope().getDeliveryTag(), false);}
ch.queueBind(queueName, exchange, routingKeyPattern);
byte[] body = ...;ch.basicPublish(exchange, routingKey, null, body);
9Thursday, 9 July 2009
![Page 10: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/10.jpg)
RabbitMQ Universe
...plus new developments like
RabbitHub, BBC FeedsHub, Trixx, ...
10Thursday, 9 July 2009
![Page 11: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/11.jpg)
Cloud Messaging
11Thursday, 9 July 2009
![Page 12: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/12.jpg)
Examples
• Soocial are using RabbitMQ + EC2 to coordinate their contacts-database synchronisation application
• The Ocean Observatories Initiative is using RabbitMQ + relays + gateways for a global sensing & data distribution network
12Thursday, 9 July 2009
![Page 13: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/13.jpg)
Soocial.com
13Thursday, 9 July 2009
![Page 14: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/14.jpg)
OOI – Ocean Observatories Initiative
14Thursday, 9 July 2009
![Page 15: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/15.jpg)
OOI – Ocean Observatories Initiative
Service.DomainName
Region Virtual IP
Cloud IPs
15Thursday, 9 July 2009
![Page 16: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/16.jpg)
Nanite
• Developed by Ezra Zygmuntowicz at Engineyard
• Presence
• Self-assembling compute fabric
• Load-balancing & recovers from failure
• An easy way of deploying to the cloud
(by pinging; we’re still working out the best way of putting presence into RabbitMQ itself)
16Thursday, 9 July 2009
![Page 17: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/17.jpg)
VPN3 (VPN-cubed)
• A secure Virtual Private Network in the cloud
• Uses RabbitMQ as a backend for IP multicast (!) which otherwise doesn’t work in EC2
• Uses BGP to arrange routing between nodes
• Can meld your datacentre(s) with EC2
17Thursday, 9 July 2009
![Page 18: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/18.jpg)
Achieving Scale
18Thursday, 9 July 2009
![Page 19: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/19.jpg)
Paul Baran’s NetworksPaul Baran, Introduction to Distributed Communications Networks, 1964
19Thursday, 9 July 2009
![Page 20: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/20.jpg)
• Capacity – throughput, latency, responsiveness
• Synchronisation & Sharing
• Availability – uptime, data integrity
• Network Management – lots of devices, lots of addresses, authentication & authorisation
Achieving Scale
20Thursday, 9 July 2009
![Page 21: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/21.jpg)
Capacity
• Service capacity: bandwidth, throughput
• Service responsiveness: latency
• Data capacity: storage
21Thursday, 9 July 2009
![Page 22: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/22.jpg)
Simple load-balancing
• Shared queue mediates access to service instances
• Load-balancing, live upgrades, fault-tolerance
Request Queue
(Private)ReplyQueue
22Thursday, 9 July 2009
![Page 23: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/23.jpg)
Clustering
23Thursday, 9 July 2009
![Page 24: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/24.jpg)
Clustering
24Thursday, 9 July 2009
![Page 25: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/25.jpg)
Clustering
Erlang Node
Message Store
Physical Machine
Listening Socket
Virtual Host
Erlang’s inter-nodemessage routing
25Thursday, 9 July 2009
![Page 26: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/26.jpg)
Divide and Conquer
• By record – parallelisable data lets separate broker clusters handle separate shards of your data
• By component – each independent part of your application can use separate brokers; “federation of distributed systems”
26Thursday, 9 July 2009
![Page 27: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/27.jpg)
WAN ClusterThe WAN cluster has local queues but global exchanges
Apps decide which broker-cluster to publish to
27Thursday, 9 July 2009
![Page 28: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/28.jpg)
Overfeeding the server
• Message backlogs can cause catastrophe
• Goal: O(0) RAM cost per message
• Spool out to disk when memory pressure gets high
• Testing and tuning: should land for RabbitMQ 1.7
28Thursday, 9 July 2009
![Page 29: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/29.jpg)
SynchronisationWhen clustering might not be right:
• huge networks
• intermittent connectivity
• ruling bandwidth with an iron fist
• different administrative domains
29Thursday, 9 July 2009
![Page 30: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/30.jpg)
Synchronisation
30Thursday, 9 July 2009
![Page 31: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/31.jpg)
Ring
Pass it on to your neighbour if your neighbour’s name isn’t in the list yet
31Thursday, 9 July 2009
![Page 32: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/32.jpg)
CompleteGraph
Pass it on to your neighbour if it hasn’t been labelled at all yet
32Thursday, 9 July 2009
![Page 33: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/33.jpg)
Multicast
Pass it on to your neighbour if it hasn’t been labelled at all yet
33Thursday, 9 July 2009
![Page 34: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/34.jpg)
Availability
• Broker Availability
• Application/Service Availability
• Data Availability
34Thursday, 9 July 2009
![Page 35: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/35.jpg)
Responsibility transferConsumer Broker
basic.ack
basic.deliver
basic.deliver
basic.deliver
...
35Thursday, 9 July 2009
![Page 36: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/36.jpg)
Responsibility transferProducer Broker
tx.commit
tx.commit-ok
basic.publish
basic.publish
basic.publish
...
36Thursday, 9 July 2009
![Page 37: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/37.jpg)
Responsibility transferProducer Broker
... ...
Consumer
37Thursday, 9 July 2009
![Page 38: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/38.jpg)
Responsibility transferProducer Broker Consumer
38Thursday, 9 July 2009
![Page 39: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/39.jpg)
Redundancy for HA
Pfailure = (Ploss)n
(assuming independence)39Thursday, 9 July 2009
![Page 40: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/40.jpg)
Redundancy for HA
Pfailure = (Ploss)n
(assuming independence)
Uptime Ploss n Pfailure Overall Uptime99% 0.01 2 0.0001 99.99%99% 0.01 3 0.000001 99.9999%
99.9% 0.001 2 0.000001 99.9999%99.9% 0.001 3 0.000000001 99.9999999%
39Thursday, 9 July 2009
![Page 41: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/41.jpg)
Redundancy for HA
X
P
C
X X
P
C
XOne broker,
two nodes each
Two brokers,
one node each
40Thursday, 9 July 2009
![Page 42: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/42.jpg)
Deduplication(“Idempotency Barrier”)
many messages enter
one message leaves
id=123
id=123
id=123
id=123
41Thursday, 9 July 2009
![Page 43: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/43.jpg)
Network Management
• Small systems can be managed by hand
• Large systems need automation:
• Naming & address management
• Service directories
• Authentication & authorization
• Logging, monitoring & alerting
42Thursday, 9 July 2009
![Page 44: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/44.jpg)
The Future
43Thursday, 9 July 2009
![Page 45: Achieving Scale With Messaging And The Cloud 20090709](https://reader034.fdocuments.us/reader034/viewer/2022052522/554f5fd8b4c905bb178b464a/html5/thumbnails/45.jpg)
Questions?http://www.rabbitmq.com/how
44Thursday, 9 July 2009