SlideShare ist ein Scribd-Unternehmen logo
1 von 45
Downloaden Sie, um offline zu lesen
Achieving Scale with
                    Messaging & the Cloud
                        Tony Garnock-Jones <tonyg@lshift.net>




Thursday, 9 July 2009                                           1
Outline

                        • Messaging – what, why

                        • Cloud Messaging – some examples

                        • Achieving Scale – what, why, how

Thursday, 9 July 2009                                        2
Messaging



Thursday, 9 July 2009               3
Messaging Elements
       ...relaying, filtering, multicasting, forwarding, buffering,
     distribution/scheduling, subscription, topics, streaming, ...

                                                                                     Element
                         Element
       ...
                                             Element



                                                                 Element


                                   Element
                                                       Element
                                                                               ...
Thursday, 9 July 2009                                                                           4

Messaging is used to structure distributed applications. There are lots of messaging patterns
in use: for example, plain old request-response RPC; point-to-point messaging, like email or
IM; multicast messaging, like mailing lists and newsgroups; and general publish/subscribe
(essentially multicast plus filtering) and queueing (store-and-forward).
What is it good for?
         Decoupling communication from behaviour, enabling:


                        •   debuggability      •   cross-language
                                                   integration
                        •   manageability
                                               •   fault-tolerance
                        •   monitorability
                                               •   store-and-forward
                        •   rolling upgrades
                                               •   ...
                        •   load-balancing

Thursday, 9 July 2009                                                                  5

Decouples patterns of communication from the behaviour of the communicating elements
Messaging Elements
       ...relaying, filtering, multicasting, forwarding, buffering,
     distribution/scheduling, subscription, topics, streaming, ...


                                                                               messages
           message
                                         Element



                               subscribe             unsubscribe

Thursday, 9 July 2009                                                                             6

One really common pattern in a messaging-based system is various incarnations of a
generalised publish/subscribe service, where messages flow in, are processed by the node,
and are forwarded on to subscribers. For example, with email mailing lists, joining the list is
a subscription, and your delivery settings - whether you want a digest or not, how frequently
you want the digest etc - are used by the mailing-list manager in making decisions about
what and how to forward incoming messages on to subscribers.
Messaging Elements
        • Delivery:
              • deliver(target,   message);



        • Subscription:
              • bind(source, topic, target);
              • unbind(source, topic, target);

Thursday, 9 July 2009                            7
AMQP for Messaging
                                                                        C
                            P           X
                                                                        C
                            P           X
                                                                        C
                        •   Exchanges perform        •   Queues perform
                            relaying, copying, and       buffering and round-
                            filtering                     robin delivery

Thursday, 9 July 2009                                                                 8

AMQP is a messaging protocol that’s designed to capture a lot of the common utility
elements in messaging systems. It can be seen as combining pub/sub with queueing.
[Explanation of the diagram]
It’s Easy
                byte[] body = ...;
                ch.basicPublish(exchange, routingKey, null, body);



                ch.queueBind(queueName, exchange, routingKeyPattern);



                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);
                }



Thursday, 9 July 2009                                                      9
RabbitMQ Universe

                                                                  ...plus new
                                                           developments like
                                                             RabbitHub, BBC
                                                           FeedsHub, Trixx, ...




Thursday, 9 July 2009                                                                          10

Naturally, since I work on RabbitMQ, I’m going to be focussing on systems built with it, but
generally a lot of the techniques for scaling out messaging work with other AMQP systems
and other kinds of messaging network.

RabbitMQ is an AMQP implementation with a server (“broker”) written in Erlang/OTP and
clients in many programming languages for many different environments. There are also
quite a few gateways to other kinds of messaging network, such as HTTP pubsub and various
flavours of XMPP.
Cloud Messaging



Thursday, 9 July 2009                     11
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



Thursday, 9 July 2009                                                                     12

And of course there are many, many applications using different kinds of messaging, such as
SQS, XMPP and so forth, as well.
Soocial.com




Thursday, 9 July 2009                 13
OOI – Ocean
                  Observatories Initiative




Thursday, 9 July 2009                        14
OOI – Ocean
                  Observatories Initiative
                                         Service.DomainName



                            Region Virtual IP




                             Cloud IPs




Thursday, 9 July 2009                                                                          15

“Twitter for data”; applying a social networking model to applications in a very large scientific
distributed system. Messaging holds the core of the system together.
Nanite
                        • Developed by Ezra Zygmuntowicz at
                          Engineyard
                        • Presence          (by pinging; we’re still working out the best way
                                            of putting presence into RabbitMQ itself)

                        • Self-assembling compute fabric
                        • Load-balancing & recovers from failure
                        • An easy way of deploying to the cloud
Thursday, 9 July 2009                                                                           16

Besides those concrete applications that are using messaging in the cloud, there are also
frameworks to help you construct your own managed messaging-based cloud applications,
like Nanite, and the system that Heroku have built.

In Nanite, Agents do the work; Mappers manage directory, distribution, auto-scaling and
load-balancing
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
Thursday, 9 July 2009                                                                          17

A different kind of framework is support not for applications but for deployments of general
networks into the cloud. CohesiveFT use RabbitMQ to stitch together the different
components in their Elastic Server product, and they’ve also produced an impressive system
called VPN-cubed that among other things provides support for multicast in an Amazon EC2
environment by using RabbitMQ to distribute the multicast packets.
Achieving Scale



Thursday, 9 July 2009                                                                          18

Having touched on a few examples of messaging being used for cloud-based distributed
systems, I’m going to get into the technical details of approaches to achieving scale.

Most of the time the simplest of the techniques I’m about to discuss will be more than
adequate; for example, RabbitMQ on a single core can cope with several thousand messages
per second with latencies of around a millisecond. When that’s not enough, though, it’s nice
to know the options for scaling up further.
Paul Baran, Introduction to Distributed Communications Networks, 1964



                        Paul Baran’s Networks




Thursday, 9 July 2009                                                                                  19

Back in the sixties, Paul Baran at the Rand Corporation performed the original, ground-
breaking research into fault-tolerant distributed systems. This diagram comes from a 1964
memo introducing the whole idea of a distributed network. I find it interesting because I see
many systems using messaging start with a centralised setup, which develops over time into
a more decentralised picture. Things can go two ways from that point: many networks
develop a scale-free aspect, becoming some hybrid of the middle and right pictures, but
some - like compute fabrics, workflow systems, and so forth - do develop into mesh-like
structures like the one on the right. So to me, reading this diagram left to right represents
the stages of scaling up a system.
Achieving Scale
                        • Capacity – throughput, latency,
                          responsiveness
                        • Synchronisation & Sharing
                        • Availability – uptime, data integrity
                        • Network Management – lots of devices,
                          lots of addresses, authentication &
                          authorisation


Thursday, 9 July 2009                                                                          20

There are lots of distinct but related ideas bundled up under the label of “scale”.
Scaling for capacity is one of the things the cloud is great for.
Once you move beyond the single, centralised broker, you often need to have some
communication between brokers.
Minimising downtime is important in many systems, and almost every system has at least a
few kinds of message that simply Must Not Get Lost, ever.
Finally, once you have a complex system, you start to need tools for cataloguing, exploring,
monitoring and debugging your network.
Capacity

                        • Service capacity: bandwidth, throughput

                        • Service responsiveness: latency

                        • Data capacity: storage

Thursday, 9 July 2009                                                                         21

Storage out-of-scope: messaging systems aren’t intended to store masses of data, but it’s
worth talking a little bit about what happens in exceptional situations where you need a
queue to act like a database temporarily while the rest of the system sorts itself out, ...
Simple load-balancing
                                                Request Queue



                                         (Private)
                                         Reply
                                         Queue




                        •   Shared queue mediates       •   Load-balancing, live
                            access to service               upgrades, fault-tolerance
                            instances

Thursday, 9 July 2009                                                                           22

Core RabbitMQ supports this pattern, and systems like Nanite provide easy-to-use
frameworks for working with it. This is often enough: frequently, it’s the service that’s the
bottleneck. But what about when the message broker itself becomes a chokepoint?
Clustering




Thursday, 9 July 2009                                                                           23

This is where RabbitMQ’s clustering comes in. Multiple Erlang virtual machines, all running
RabbitMQ, join together to create a giant virtual broker. Connecting clients all see the same
picture of the world: to them, it’s a single broker; the clustering is hidden away from them.
Clustering




Thursday, 9 July 2009                                                                     24

The nodes - Erlang VMs - in a cluster can run on separate cores within a box, or can run on
separate boxes connected over a network. Erlang’s built-in message passing is used for
communication between the nodes, and each node has a private disk-based store of its own.
Each node also listens on a separate socket of its own: at the moment, clients need to know
all the different socket addresses; DNS SRV records can be used for this.
Clustering
                                                Physical
                                                Machine
                        Erlang Node
                                                             Listening
                                                              Socket

                         Message              Erlang’s inter-node
                          Store                message routing




                               Virtual Host
Thursday, 9 July 2009                                                                         25

Erlang’s built-in mnesia database is used to maintain synchronisation of the routing and
filtering setup within the broker. Messages published to any node are transparently routed to
where they need to go. One important caveat is that the queues - message buffers, message
stores - in the system live on the node on which they were created, so while they’re
accessible from any other node in the cluster, their state is held only on a single node. We’re
working on improving this situation; and in the meantime, the whole problem can be made to
go away by using some of the techniques for high availability I’ll talk about in a little bit.
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”



Thursday, 9 July 2009                                                                            26

Once even a clustered single broker no longer copes with the load you’re throwing at it, it’s
time to move on to the decentralised network we saw before in Paul Baran’s diagram earlier.
If your data parallelises nicely, you can shard your data, effectively running a collection of
identical systems side-by-side, each responsible for a subset of the database; and if your
application has some serial processing aspect to it, you can let each stage use a separate
broker cluster for communicating with the next stage. There’s no intrinsic requirement to
route all your messages through a single broker.
WAN Cluster
            The WAN cluster has local
            queues but global exchanges
            Apps decide
            which broker-
            cluster to
            publish to




Thursday, 9 July 2009                                                                        27

A particularly interesting multi-broker design works well when you have multiple datacentres
or multiple branch offices. A RabbitMQ WAN cluster with a node in each location can be used
to perform message routing, filtering and delivery between locations, and local clusters can
be used for within-location communication. Since queues in a RabbitMQ cluster live on the
node they are created on, you get the advantages of a distributed, WAN-scale routing setup
with the actual mailboxes holding messages intended for applications nice and close to the
applications themselves. It’s not seamless, in that applications to have to know which cluster
to talk to for each particular task, but it is simple to set up, to understand, and to use.
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


Thursday, 9 July 2009                                                                     28

Before I move on to talking about synchronisation and relaying, a quick word about data
storage capacity...
Synchronisation
          When clustering might
          not be right:
              • huge networks
              • intermittent
                        connectivity
              •         ruling bandwidth
                        with an iron fist
              •         different
                        administrative
                        domains
Thursday, 9 July 2009                                                                      29

So clustering’s fine: but in some cases, it’s not enough. [Explanation of when clustering
might not be right] [Explanation of diagram]
Synchronisation




Thursday, 9 July 2009                                                                          30

The important part: Don’t Create Mail Loops!
AMQP has a standard field called “cluster ID” that isn’t formally defined, but that every AMQP
broker is required to pass on. This is a really convenient place to put mail-loop-breaking
information into: keep a record of who has seen each message, to avoid forwarding it
inappropriately.
Ring
         Pass it on to your
         neighbour if your
         neighbour’s name
         isn’t in the list yet




Thursday, 9 July 2009                                           31

High latency, economical with bandwidth, poor fault-tolerance
Complete
   Graph
         Pass it on to your
         neighbour if it
         hasn’t been
         labelled at all yet




Thursday, 9 July 2009                                      32

Low latency, wasteful of bandwidth, good fault-tolerance
Multicast
         Pass it on to your
         neighbour if it
         hasn’t been
         labelled at all yet




Thursday, 9 July 2009                                                                           33

Low latency, economical, but of course unreliable!

We’ve been getting good initial results experimenting with reliable multicast synchronisation
groups in which there are three roles: publishers, subscribers, and acknowledger-replayers.
Publishers keep retrying until an acknowledger ACKs the delivery. Subscribers are silent
unless they detect that they’ve missed a message, in which case they request it from a
replayer using a NACK. There are so many variables to explore here, we’re very much just
beginning.
Availability

                        • Broker Availability

                        • Application/Service Availability

                        • Data Availability

Thursday, 9 July 2009                                                                          34

Here’s where making the system robust in the face of failure comes in.

Broker availability – plain old clustering, or running many separate instances (warm/hot
standby)
App availability - we’ve already covered the basic idea in the “simple load balancing slide”
Data availability - not losing messages, reliable delivery (better known as responsibility
transfer), redundancy for improving the odds
Responsibility transfer
                         Consumer                               Broker

                                      basic.deliver

                                      basic.deliver

                                      basic.deliver


                                            ...

                                         basic.ack




Thursday, 9 July 2009                                                                        35

So to address responsibility transfer first: all that’s required is that the receiving party
acknowledge acceptance of responsibility for a received message to the sender. In AMQP,
that’s done with a “basic.ack” message, which lets the server know that the client received the
message OK and that it’s safe to delete the server’s copy.
Responsibility transfer
                         Producer                              Broker

                                     basic.publish

                                     basic.publish

                                     basic.publish

                                           ...
                                        tx.commit
                                      tx.commit-ok




Thursday, 9 July 2009                                                                      36

Things are a little awkward on the publishing side with AMQP, though. The protocol isn’t
symmetric - yet! - so you have to use a transactional delivery mode. The “commit-ok”
response coming back from the server acts as the acknowledgement for the published
messages.
Responsibility transfer
                         Producer         Broker           Consumer




                                                     ...
                                    ...




Thursday, 9 July 2009                                                                       37

Ideally, AMQP would permit this kind of situation, where the broker passes messages on to
consumers as they arrive and acknowledges them to the sender once the ultimate consumer
takes responsibility for them, but...
Responsibility transfer
                         Producer         Broker              Consumer




Thursday, 9 July 2009                                                                            38

... because of the grouping induced by the use of transactional mode, this is the closest you
can get by staying within the letter of the specification. The server isn’t free to pass on the
messages it’s received until it hears that transaction commit request from the publisher.
Redundancy for HA

                        Pfailure = (Ploss) n




                                                    (assuming independence)
Thursday, 9 July 2009                                                                        39

The next aspect of Availability I want to mention is the use of redundant intermediate
systems for broker availability.

The probability of total failure decreases exponentially with each independent redundant path
for data through the system. Just to illustrate that, here’s a back-of-the-envelope table; you
can see how redundant data paths really pay off very quickly.

Of course, this simple equation only applies if the probabilities of each delivery failing are
independent; usually they’ll not be completely independent. The idea is to make each delivery
path as independent as possible for maximum reliability.
Redundancy for HA

                        Pfailure = (Ploss) n
         Uptime           Ploss       n              Pfailure       Overall Uptime
             99%           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%

                                                    (assuming independence)
Thursday, 9 July 2009                                                                        39

The next aspect of Availability I want to mention is the use of redundant intermediate
systems for broker availability.

The probability of total failure decreases exponentially with each independent redundant path
for data through the system. Just to illustrate that, here’s a back-of-the-envelope table; you
can see how redundant data paths really pay off very quickly.

Of course, this simple equation only applies if the probabilities of each delivery failing are
independent; usually they’ll not be completely independent. The idea is to make each delivery
path as independent as possible for maximum reliability.
Redundancy for HA
                          P                             P


      One                 X        X                    X          X           Two
     broker,                                                                 brokers,
   two nodes                                                                one node
      each                                                                     each



                              C                               C


Thursday, 9 July 2009                                                                        40

With redundant paths through the broker, individual outages can be tolerated. The main
difference between the two configurations shown here is that on the right, the producer
needs to explicitly send every message to both broker instances. On the left, the built-in
RabbitMQ clustering takes care of that for you; on the other hand, the server admin tasks
involved in managing a cluster are slightly more complex than managing separate broker
instances, so there’s a tradeoff there.

At the bottom of the two pictures here, there’s a horizontal bar, representing a deduplication
filter.
Deduplication
                                (“Idempotency Barrier”)


                              id=123                  id=123


                              id=123


                              id=123




                        many messages                      one message
                            enter                             leaves

Thursday, 9 July 2009                                                                          41

The basic idea here is ...

Need a predicate for determining message identity: a simple, workable solution is to attach
UUIDs to messages, but sometimes hashing (e.g. SHA-1) the content is a good solution

Fault tolerance, but also exactly-once delivery: the server is free to redeliver previously-
attempted messages in certain circumstances, and a deduplication filter can be used to keep
things sane for the message receivers.

(((Needs a memory of what it’s seen. Can expire things: keep them for the duration of the
longest *automatically-recovered* service outage you want to support, plus a bit. So long as
longer outages are manually-recovered, the queues can be purged and the system monitored
to ensure that nothing’s lost or duplicated.)))
Network Management
                        • Small systems can be managed by hand
                        • Large systems need automation:
                         • Naming & address management
                         • Service directories
                         • Authentication & authorization
                         • Logging, monitoring & alerting
Thursday, 9 July 2009                                                                              42

Finally, a few words about management and monitoring of large networks.

Large systems: e.g. the internet itself, the cellular network (all those iPhones!), auto-scaling
systems running in the cloud

Messaging can be applied to management and monitoring tasks just as well as to application
tasks. Brokers can provide rich support for all these tasks; systems like Nanite, which uses
RabbitMQ for managing agents as well as letting them communicate, are helping to discover
and define the kinds of things that can be moved into the broker in these areas.
The Future




Thursday, 9 July 2009                                                                         43

We’re working on making it as easy as possible to use the design patterns I’ve been talking
about. In particular, solid support for synchronising relays, for gateway plugins, and for
deduplication (in support of redundancy-for-HA and so forth) is high on our to-do list.

People are already building things around RabbitMQ and making it easy to deploy in the
cloud; I’m looking forward to seeing what people do with it.
Questions?
                        http://www.rabbitmq.com/how




Thursday, 9 July 2009                                 44

Weitere ähnliche Inhalte

Andere mochten auch

RoA-Next Steps in Sftwr Dvlpmnt on SAP HANA
RoA-Next Steps in Sftwr Dvlpmnt on SAP HANARoA-Next Steps in Sftwr Dvlpmnt on SAP HANA
RoA-Next Steps in Sftwr Dvlpmnt on SAP HANA
Niels Lukassen
 
Presentación Transportecnia 2.012
Presentación Transportecnia 2.012Presentación Transportecnia 2.012
Presentación Transportecnia 2.012
Transportecnia
 
Jaime Y Manuel 1º Bto Sida
Jaime Y Manuel 1º Bto SidaJaime Y Manuel 1º Bto Sida
Jaime Y Manuel 1º Bto Sida
guesta17a14
 
Philip Stehlik at TechTalks.ph - Fundraising in Silicon Valley
Philip Stehlik at TechTalks.ph - Fundraising in Silicon ValleyPhilip Stehlik at TechTalks.ph - Fundraising in Silicon Valley
Philip Stehlik at TechTalks.ph - Fundraising in Silicon Valley
Philip Stehlik
 
Tcc remédios (texto) 20.01.10
Tcc   remédios (texto) 20.01.10Tcc   remédios (texto) 20.01.10
Tcc remédios (texto) 20.01.10
Pedro Antonio
 
7 1 2009_7_54_14_pm_cartilla_normas_tecnicas_final
7 1 2009_7_54_14_pm_cartilla_normas_tecnicas_final7 1 2009_7_54_14_pm_cartilla_normas_tecnicas_final
7 1 2009_7_54_14_pm_cartilla_normas_tecnicas_final
Jose Ospina
 

Andere mochten auch (20)

Crowdfunding für Museen – eine attraktive Finanzierungsmöglichkeit?
Crowdfunding für Museen – eine attraktive Finanzierungsmöglichkeit?Crowdfunding für Museen – eine attraktive Finanzierungsmöglichkeit?
Crowdfunding für Museen – eine attraktive Finanzierungsmöglichkeit?
 
Präsentation better business day in Lindau von impuls360
Präsentation better business day in Lindau von impuls360Präsentation better business day in Lindau von impuls360
Präsentation better business day in Lindau von impuls360
 
RoA-Next Steps in Sftwr Dvlpmnt on SAP HANA
RoA-Next Steps in Sftwr Dvlpmnt on SAP HANARoA-Next Steps in Sftwr Dvlpmnt on SAP HANA
RoA-Next Steps in Sftwr Dvlpmnt on SAP HANA
 
Labkotec applications guide_eng_2015_net (002)
Labkotec applications guide_eng_2015_net (002)Labkotec applications guide_eng_2015_net (002)
Labkotec applications guide_eng_2015_net (002)
 
Presentación Transportecnia 2.012
Presentación Transportecnia 2.012Presentación Transportecnia 2.012
Presentación Transportecnia 2.012
 
Jaime Y Manuel 1º Bto Sida
Jaime Y Manuel 1º Bto SidaJaime Y Manuel 1º Bto Sida
Jaime Y Manuel 1º Bto Sida
 
BForms
BFormsBForms
BForms
 
Immobilienmakler muenchen allach
Immobilienmakler muenchen allachImmobilienmakler muenchen allach
Immobilienmakler muenchen allach
 
" HOTEL SURF OLAS ALTAS"English Version
" HOTEL SURF OLAS ALTAS"English Version" HOTEL SURF OLAS ALTAS"English Version
" HOTEL SURF OLAS ALTAS"English Version
 
Andyyyy sosa 99
Andyyyy sosa 99Andyyyy sosa 99
Andyyyy sosa 99
 
Réseaux sociaux d'entreprise, l'entrée dans l'ère du conversationnel - Extrait
Réseaux sociaux d'entreprise, l'entrée dans l'ère du conversationnel - ExtraitRéseaux sociaux d'entreprise, l'entrée dans l'ère du conversationnel - Extrait
Réseaux sociaux d'entreprise, l'entrée dans l'ère du conversationnel - Extrait
 
Munich March 2015 - Cassandra + Spark Overview
Munich March 2015 -  Cassandra + Spark OverviewMunich March 2015 -  Cassandra + Spark Overview
Munich March 2015 - Cassandra + Spark Overview
 
Exocerebro. Un cerebro extendido
Exocerebro. Un cerebro extendidoExocerebro. Un cerebro extendido
Exocerebro. Un cerebro extendido
 
Plaisio Telephony November 2013
Plaisio Telephony November 2013Plaisio Telephony November 2013
Plaisio Telephony November 2013
 
Anatomia ana ortega, k arla murillo
Anatomia  ana ortega, k arla murilloAnatomia  ana ortega, k arla murillo
Anatomia ana ortega, k arla murillo
 
BPMN 2.0 & PAVONE Notation
BPMN 2.0 & PAVONE NotationBPMN 2.0 & PAVONE Notation
BPMN 2.0 & PAVONE Notation
 
Philip Stehlik at TechTalks.ph - Fundraising in Silicon Valley
Philip Stehlik at TechTalks.ph - Fundraising in Silicon ValleyPhilip Stehlik at TechTalks.ph - Fundraising in Silicon Valley
Philip Stehlik at TechTalks.ph - Fundraising in Silicon Valley
 
Tcc remédios (texto) 20.01.10
Tcc   remédios (texto) 20.01.10Tcc   remédios (texto) 20.01.10
Tcc remédios (texto) 20.01.10
 
7 1 2009_7_54_14_pm_cartilla_normas_tecnicas_final
7 1 2009_7_54_14_pm_cartilla_normas_tecnicas_final7 1 2009_7_54_14_pm_cartilla_normas_tecnicas_final
7 1 2009_7_54_14_pm_cartilla_normas_tecnicas_final
 
Notas de prensa 2.0 (2012)
Notas de prensa 2.0 (2012)Notas de prensa 2.0 (2012)
Notas de prensa 2.0 (2012)
 

Ähnlich wie Achieving Scale With Messaging And The Cloud

Karonis Rom Telecom
Karonis Rom TelecomKaronis Rom Telecom
Karonis Rom Telecom
knowhowgr
 
Message Oriented Architecture
Message Oriented ArchitectureMessage Oriented Architecture
Message Oriented Architecture
elliando dias
 
BSC-Microsoft Research Center Overview
BSC-Microsoft Research Center OverviewBSC-Microsoft Research Center Overview
BSC-Microsoft Research Center Overview
MICProductivity
 
OSGi In Anger - Tara Simpson
OSGi In Anger - Tara SimpsonOSGi In Anger - Tara Simpson
OSGi In Anger - Tara Simpson
mfrancis
 

Ähnlich wie Achieving Scale With Messaging And The Cloud (20)

Smalltalk Metaprogramming supports Probabilistic Program Analysis
Smalltalk Metaprogramming supports Probabilistic Program AnalysisSmalltalk Metaprogramming supports Probabilistic Program Analysis
Smalltalk Metaprogramming supports Probabilistic Program Analysis
 
Mini-Training: Message Brokers
Mini-Training: Message BrokersMini-Training: Message Brokers
Mini-Training: Message Brokers
 
The bigrabbit
The bigrabbitThe bigrabbit
The bigrabbit
 
Karonis Rom Telecom
Karonis Rom TelecomKaronis Rom Telecom
Karonis Rom Telecom
 
Intro To Git
Intro To GitIntro To Git
Intro To Git
 
Artromick Choosing And Implementing A Mobile Hospital Cart Solution
Artromick Choosing And Implementing A Mobile Hospital Cart SolutionArtromick Choosing And Implementing A Mobile Hospital Cart Solution
Artromick Choosing And Implementing A Mobile Hospital Cart Solution
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQP
 
OMG Data-Distribution Service (DDS) Tutorial - 2009
OMG Data-Distribution Service (DDS) Tutorial - 2009OMG Data-Distribution Service (DDS) Tutorial - 2009
OMG Data-Distribution Service (DDS) Tutorial - 2009
 
Commication Framework in OpenStack
Commication Framework in OpenStackCommication Framework in OpenStack
Commication Framework in OpenStack
 
zeromq
zeromqzeromq
zeromq
 
CMIS overview
CMIS overviewCMIS overview
CMIS overview
 
Message Oriented Architecture
Message Oriented ArchitectureMessage Oriented Architecture
Message Oriented Architecture
 
HPC Workbench Presentation
HPC Workbench PresentationHPC Workbench Presentation
HPC Workbench Presentation
 
Strong Mail Presentation Big Ten It Conf July 2009
Strong Mail Presentation   Big Ten It Conf   July 2009Strong Mail Presentation   Big Ten It Conf   July 2009
Strong Mail Presentation Big Ten It Conf July 2009
 
BSC-Microsoft Research Center Overview
BSC-Microsoft Research Center OverviewBSC-Microsoft Research Center Overview
BSC-Microsoft Research Center Overview
 
CMIS is here, did you know?
CMIS is here, did you know?CMIS is here, did you know?
CMIS is here, did you know?
 
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
 
OSGi In Anger - Tara Simpson
OSGi In Anger - Tara SimpsonOSGi In Anger - Tara Simpson
OSGi In Anger - Tara Simpson
 
Chargeback in a Cloud and Non-Cloud Environment, IAITAM ACE
Chargeback in a Cloud and Non-Cloud Environment, IAITAM ACEChargeback in a Cloud and Non-Cloud Environment, IAITAM ACE
Chargeback in a Cloud and Non-Cloud Environment, IAITAM ACE
 
Nuxeo 5.2 Glassfish
Nuxeo 5.2 GlassfishNuxeo 5.2 Glassfish
Nuxeo 5.2 Glassfish
 

Mehr von gojkoadzic

How I learned to stop worrying and love flexible scope - at JFokus 2014
How I learned to stop worrying and love flexible scope - at JFokus 2014How I learned to stop worrying and love flexible scope - at JFokus 2014
How I learned to stop worrying and love flexible scope - at JFokus 2014
gojkoadzic
 
Reinventing Software Quality, Agile Days Moscow 2013
Reinventing Software Quality, Agile Days Moscow 2013Reinventing Software Quality, Agile Days Moscow 2013
Reinventing Software Quality, Agile Days Moscow 2013
gojkoadzic
 

Mehr von gojkoadzic (20)

Descaling Agile (Agile Tour Vienna 2019)
Descaling Agile (Agile Tour Vienna 2019)Descaling Agile (Agile Tour Vienna 2019)
Descaling Agile (Agile Tour Vienna 2019)
 
Maximum Impact, Minimum Effort
Maximum Impact, Minimum EffortMaximum Impact, Minimum Effort
Maximum Impact, Minimum Effort
 
Painless visual testing
Painless visual testingPainless visual testing
Painless visual testing
 
Serverless JavaScript
Serverless JavaScriptServerless JavaScript
Serverless JavaScript
 
Serverless Code Camp Barcelona
Serverless Code Camp BarcelonaServerless Code Camp Barcelona
Serverless Code Camp Barcelona
 
Test Automation Without the Headache: Agile Tour Vienna 2015
Test Automation Without the Headache: Agile Tour Vienna 2015 Test Automation Without the Headache: Agile Tour Vienna 2015
Test Automation Without the Headache: Agile Tour Vienna 2015
 
How I learned to stop worrying and love flexible scope - at JFokus 2014
How I learned to stop worrying and love flexible scope - at JFokus 2014How I learned to stop worrying and love flexible scope - at JFokus 2014
How I learned to stop worrying and love flexible scope - at JFokus 2014
 
Sabotage product
Sabotage productSabotage product
Sabotage product
 
Reinventing Software Quality, Agile Days Moscow 2013
Reinventing Software Quality, Agile Days Moscow 2013Reinventing Software Quality, Agile Days Moscow 2013
Reinventing Software Quality, Agile Days Moscow 2013
 
5 key challenges
5 key challenges5 key challenges
5 key challenges
 
Death to the testing phase
Death to the testing phaseDeath to the testing phase
Death to the testing phase
 
Challenging Requirements/Oredev
Challenging Requirements/OredevChallenging Requirements/Oredev
Challenging Requirements/Oredev
 
Effective specifications for agile teams
Effective specifications for agile teamsEffective specifications for agile teams
Effective specifications for agile teams
 
Agile Testers: Becoming a key asset for your team
Agile Testers: Becoming a key asset for your teamAgile Testers: Becoming a key asset for your team
Agile Testers: Becoming a key asset for your team
 
From dedicated to cloud infrastructure
From dedicated to cloud infrastructureFrom dedicated to cloud infrastructure
From dedicated to cloud infrastructure
 
Specification Workshops - The Missing Link
Specification Workshops - The Missing LinkSpecification Workshops - The Missing Link
Specification Workshops - The Missing Link
 
Specification by example and agile acceptance testing
Specification by example and agile acceptance testingSpecification by example and agile acceptance testing
Specification by example and agile acceptance testing
 
Space Based Programming
Space Based ProgrammingSpace Based Programming
Space Based Programming
 
Getting business people and developers to listen to testers
Getting business people and developers to listen to testersGetting business people and developers to listen to testers
Getting business people and developers to listen to testers
 
Is the cloud a gamble
Is the cloud a gambleIs the cloud a gamble
Is the cloud a gamble
 

Kürzlich hochgeladen

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 

Achieving Scale With Messaging And The Cloud

  • 1. Achieving Scale with Messaging & the Cloud Tony Garnock-Jones <tonyg@lshift.net> Thursday, 9 July 2009 1
  • 2. Outline • Messaging – what, why • Cloud Messaging – some examples • Achieving Scale – what, why, how Thursday, 9 July 2009 2
  • 4. Messaging Elements ...relaying, filtering, multicasting, forwarding, buffering, distribution/scheduling, subscription, topics, streaming, ... Element Element ... Element Element Element Element ... Thursday, 9 July 2009 4 Messaging is used to structure distributed applications. There are lots of messaging patterns in use: for example, plain old request-response RPC; point-to-point messaging, like email or IM; multicast messaging, like mailing lists and newsgroups; and general publish/subscribe (essentially multicast plus filtering) and queueing (store-and-forward).
  • 5. What is it good for? Decoupling communication from behaviour, enabling: • debuggability • cross-language integration • manageability • fault-tolerance • monitorability • store-and-forward • rolling upgrades • ... • load-balancing Thursday, 9 July 2009 5 Decouples patterns of communication from the behaviour of the communicating elements
  • 6. Messaging Elements ...relaying, filtering, multicasting, forwarding, buffering, distribution/scheduling, subscription, topics, streaming, ... messages message Element subscribe unsubscribe Thursday, 9 July 2009 6 One really common pattern in a messaging-based system is various incarnations of a generalised publish/subscribe service, where messages flow in, are processed by the node, and are forwarded on to subscribers. For example, with email mailing lists, joining the list is a subscription, and your delivery settings - whether you want a digest or not, how frequently you want the digest etc - are used by the mailing-list manager in making decisions about what and how to forward incoming messages on to subscribers.
  • 7. Messaging Elements • Delivery: • deliver(target, message); • Subscription: • bind(source, topic, target); • unbind(source, topic, target); Thursday, 9 July 2009 7
  • 8. AMQP for Messaging C P X C P X C • Exchanges perform • Queues perform relaying, copying, and buffering and round- filtering robin delivery Thursday, 9 July 2009 8 AMQP is a messaging protocol that’s designed to capture a lot of the common utility elements in messaging systems. It can be seen as combining pub/sub with queueing. [Explanation of the diagram]
  • 9. It’s Easy byte[] body = ...; ch.basicPublish(exchange, routingKey, null, body); ch.queueBind(queueName, exchange, routingKeyPattern); 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); } Thursday, 9 July 2009 9
  • 10. RabbitMQ Universe ...plus new developments like RabbitHub, BBC FeedsHub, Trixx, ... Thursday, 9 July 2009 10 Naturally, since I work on RabbitMQ, I’m going to be focussing on systems built with it, but generally a lot of the techniques for scaling out messaging work with other AMQP systems and other kinds of messaging network. RabbitMQ is an AMQP implementation with a server (“broker”) written in Erlang/OTP and clients in many programming languages for many different environments. There are also quite a few gateways to other kinds of messaging network, such as HTTP pubsub and various flavours of XMPP.
  • 12. 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 Thursday, 9 July 2009 12 And of course there are many, many applications using different kinds of messaging, such as SQS, XMPP and so forth, as well.
  • 14. OOI – Ocean Observatories Initiative Thursday, 9 July 2009 14
  • 15. OOI – Ocean Observatories Initiative Service.DomainName Region Virtual IP Cloud IPs Thursday, 9 July 2009 15 “Twitter for data”; applying a social networking model to applications in a very large scientific distributed system. Messaging holds the core of the system together.
  • 16. Nanite • Developed by Ezra Zygmuntowicz at Engineyard • Presence (by pinging; we’re still working out the best way of putting presence into RabbitMQ itself) • Self-assembling compute fabric • Load-balancing & recovers from failure • An easy way of deploying to the cloud Thursday, 9 July 2009 16 Besides those concrete applications that are using messaging in the cloud, there are also frameworks to help you construct your own managed messaging-based cloud applications, like Nanite, and the system that Heroku have built. In Nanite, Agents do the work; Mappers manage directory, distribution, auto-scaling and load-balancing
  • 17. 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 Thursday, 9 July 2009 17 A different kind of framework is support not for applications but for deployments of general networks into the cloud. CohesiveFT use RabbitMQ to stitch together the different components in their Elastic Server product, and they’ve also produced an impressive system called VPN-cubed that among other things provides support for multicast in an Amazon EC2 environment by using RabbitMQ to distribute the multicast packets.
  • 18. Achieving Scale Thursday, 9 July 2009 18 Having touched on a few examples of messaging being used for cloud-based distributed systems, I’m going to get into the technical details of approaches to achieving scale. Most of the time the simplest of the techniques I’m about to discuss will be more than adequate; for example, RabbitMQ on a single core can cope with several thousand messages per second with latencies of around a millisecond. When that’s not enough, though, it’s nice to know the options for scaling up further.
  • 19. Paul Baran, Introduction to Distributed Communications Networks, 1964 Paul Baran’s Networks Thursday, 9 July 2009 19 Back in the sixties, Paul Baran at the Rand Corporation performed the original, ground- breaking research into fault-tolerant distributed systems. This diagram comes from a 1964 memo introducing the whole idea of a distributed network. I find it interesting because I see many systems using messaging start with a centralised setup, which develops over time into a more decentralised picture. Things can go two ways from that point: many networks develop a scale-free aspect, becoming some hybrid of the middle and right pictures, but some - like compute fabrics, workflow systems, and so forth - do develop into mesh-like structures like the one on the right. So to me, reading this diagram left to right represents the stages of scaling up a system.
  • 20. Achieving Scale • Capacity – throughput, latency, responsiveness • Synchronisation & Sharing • Availability – uptime, data integrity • Network Management – lots of devices, lots of addresses, authentication & authorisation Thursday, 9 July 2009 20 There are lots of distinct but related ideas bundled up under the label of “scale”. Scaling for capacity is one of the things the cloud is great for. Once you move beyond the single, centralised broker, you often need to have some communication between brokers. Minimising downtime is important in many systems, and almost every system has at least a few kinds of message that simply Must Not Get Lost, ever. Finally, once you have a complex system, you start to need tools for cataloguing, exploring, monitoring and debugging your network.
  • 21. Capacity • Service capacity: bandwidth, throughput • Service responsiveness: latency • Data capacity: storage Thursday, 9 July 2009 21 Storage out-of-scope: messaging systems aren’t intended to store masses of data, but it’s worth talking a little bit about what happens in exceptional situations where you need a queue to act like a database temporarily while the rest of the system sorts itself out, ...
  • 22. Simple load-balancing Request Queue (Private) Reply Queue • Shared queue mediates • Load-balancing, live access to service upgrades, fault-tolerance instances Thursday, 9 July 2009 22 Core RabbitMQ supports this pattern, and systems like Nanite provide easy-to-use frameworks for working with it. This is often enough: frequently, it’s the service that’s the bottleneck. But what about when the message broker itself becomes a chokepoint?
  • 23. Clustering Thursday, 9 July 2009 23 This is where RabbitMQ’s clustering comes in. Multiple Erlang virtual machines, all running RabbitMQ, join together to create a giant virtual broker. Connecting clients all see the same picture of the world: to them, it’s a single broker; the clustering is hidden away from them.
  • 24. Clustering Thursday, 9 July 2009 24 The nodes - Erlang VMs - in a cluster can run on separate cores within a box, or can run on separate boxes connected over a network. Erlang’s built-in message passing is used for communication between the nodes, and each node has a private disk-based store of its own. Each node also listens on a separate socket of its own: at the moment, clients need to know all the different socket addresses; DNS SRV records can be used for this.
  • 25. Clustering Physical Machine Erlang Node Listening Socket Message Erlang’s inter-node Store message routing Virtual Host Thursday, 9 July 2009 25 Erlang’s built-in mnesia database is used to maintain synchronisation of the routing and filtering setup within the broker. Messages published to any node are transparently routed to where they need to go. One important caveat is that the queues - message buffers, message stores - in the system live on the node on which they were created, so while they’re accessible from any other node in the cluster, their state is held only on a single node. We’re working on improving this situation; and in the meantime, the whole problem can be made to go away by using some of the techniques for high availability I’ll talk about in a little bit.
  • 26. 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” Thursday, 9 July 2009 26 Once even a clustered single broker no longer copes with the load you’re throwing at it, it’s time to move on to the decentralised network we saw before in Paul Baran’s diagram earlier. If your data parallelises nicely, you can shard your data, effectively running a collection of identical systems side-by-side, each responsible for a subset of the database; and if your application has some serial processing aspect to it, you can let each stage use a separate broker cluster for communicating with the next stage. There’s no intrinsic requirement to route all your messages through a single broker.
  • 27. WAN Cluster The WAN cluster has local queues but global exchanges Apps decide which broker- cluster to publish to Thursday, 9 July 2009 27 A particularly interesting multi-broker design works well when you have multiple datacentres or multiple branch offices. A RabbitMQ WAN cluster with a node in each location can be used to perform message routing, filtering and delivery between locations, and local clusters can be used for within-location communication. Since queues in a RabbitMQ cluster live on the node they are created on, you get the advantages of a distributed, WAN-scale routing setup with the actual mailboxes holding messages intended for applications nice and close to the applications themselves. It’s not seamless, in that applications to have to know which cluster to talk to for each particular task, but it is simple to set up, to understand, and to use.
  • 28. 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 Thursday, 9 July 2009 28 Before I move on to talking about synchronisation and relaying, a quick word about data storage capacity...
  • 29. Synchronisation When clustering might not be right: • huge networks • intermittent connectivity • ruling bandwidth with an iron fist • different administrative domains Thursday, 9 July 2009 29 So clustering’s fine: but in some cases, it’s not enough. [Explanation of when clustering might not be right] [Explanation of diagram]
  • 30. Synchronisation Thursday, 9 July 2009 30 The important part: Don’t Create Mail Loops! AMQP has a standard field called “cluster ID” that isn’t formally defined, but that every AMQP broker is required to pass on. This is a really convenient place to put mail-loop-breaking information into: keep a record of who has seen each message, to avoid forwarding it inappropriately.
  • 31. Ring Pass it on to your neighbour if your neighbour’s name isn’t in the list yet Thursday, 9 July 2009 31 High latency, economical with bandwidth, poor fault-tolerance
  • 32. Complete Graph Pass it on to your neighbour if it hasn’t been labelled at all yet Thursday, 9 July 2009 32 Low latency, wasteful of bandwidth, good fault-tolerance
  • 33. Multicast Pass it on to your neighbour if it hasn’t been labelled at all yet Thursday, 9 July 2009 33 Low latency, economical, but of course unreliable! We’ve been getting good initial results experimenting with reliable multicast synchronisation groups in which there are three roles: publishers, subscribers, and acknowledger-replayers. Publishers keep retrying until an acknowledger ACKs the delivery. Subscribers are silent unless they detect that they’ve missed a message, in which case they request it from a replayer using a NACK. There are so many variables to explore here, we’re very much just beginning.
  • 34. Availability • Broker Availability • Application/Service Availability • Data Availability Thursday, 9 July 2009 34 Here’s where making the system robust in the face of failure comes in. Broker availability – plain old clustering, or running many separate instances (warm/hot standby) App availability - we’ve already covered the basic idea in the “simple load balancing slide” Data availability - not losing messages, reliable delivery (better known as responsibility transfer), redundancy for improving the odds
  • 35. Responsibility transfer Consumer Broker basic.deliver basic.deliver basic.deliver ... basic.ack Thursday, 9 July 2009 35 So to address responsibility transfer first: all that’s required is that the receiving party acknowledge acceptance of responsibility for a received message to the sender. In AMQP, that’s done with a “basic.ack” message, which lets the server know that the client received the message OK and that it’s safe to delete the server’s copy.
  • 36. Responsibility transfer Producer Broker basic.publish basic.publish basic.publish ... tx.commit tx.commit-ok Thursday, 9 July 2009 36 Things are a little awkward on the publishing side with AMQP, though. The protocol isn’t symmetric - yet! - so you have to use a transactional delivery mode. The “commit-ok” response coming back from the server acts as the acknowledgement for the published messages.
  • 37. Responsibility transfer Producer Broker Consumer ... ... Thursday, 9 July 2009 37 Ideally, AMQP would permit this kind of situation, where the broker passes messages on to consumers as they arrive and acknowledges them to the sender once the ultimate consumer takes responsibility for them, but...
  • 38. Responsibility transfer Producer Broker Consumer Thursday, 9 July 2009 38 ... because of the grouping induced by the use of transactional mode, this is the closest you can get by staying within the letter of the specification. The server isn’t free to pass on the messages it’s received until it hears that transaction commit request from the publisher.
  • 39. Redundancy for HA Pfailure = (Ploss) n (assuming independence) Thursday, 9 July 2009 39 The next aspect of Availability I want to mention is the use of redundant intermediate systems for broker availability. The probability of total failure decreases exponentially with each independent redundant path for data through the system. Just to illustrate that, here’s a back-of-the-envelope table; you can see how redundant data paths really pay off very quickly. Of course, this simple equation only applies if the probabilities of each delivery failing are independent; usually they’ll not be completely independent. The idea is to make each delivery path as independent as possible for maximum reliability.
  • 40. Redundancy for HA Pfailure = (Ploss) n Uptime Ploss n Pfailure Overall Uptime 99% 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% (assuming independence) Thursday, 9 July 2009 39 The next aspect of Availability I want to mention is the use of redundant intermediate systems for broker availability. The probability of total failure decreases exponentially with each independent redundant path for data through the system. Just to illustrate that, here’s a back-of-the-envelope table; you can see how redundant data paths really pay off very quickly. Of course, this simple equation only applies if the probabilities of each delivery failing are independent; usually they’ll not be completely independent. The idea is to make each delivery path as independent as possible for maximum reliability.
  • 41. Redundancy for HA P P One X X X X Two broker, brokers, two nodes one node each each C C Thursday, 9 July 2009 40 With redundant paths through the broker, individual outages can be tolerated. The main difference between the two configurations shown here is that on the right, the producer needs to explicitly send every message to both broker instances. On the left, the built-in RabbitMQ clustering takes care of that for you; on the other hand, the server admin tasks involved in managing a cluster are slightly more complex than managing separate broker instances, so there’s a tradeoff there. At the bottom of the two pictures here, there’s a horizontal bar, representing a deduplication filter.
  • 42. Deduplication (“Idempotency Barrier”) id=123 id=123 id=123 id=123 many messages one message enter leaves Thursday, 9 July 2009 41 The basic idea here is ... Need a predicate for determining message identity: a simple, workable solution is to attach UUIDs to messages, but sometimes hashing (e.g. SHA-1) the content is a good solution Fault tolerance, but also exactly-once delivery: the server is free to redeliver previously- attempted messages in certain circumstances, and a deduplication filter can be used to keep things sane for the message receivers. (((Needs a memory of what it’s seen. Can expire things: keep them for the duration of the longest *automatically-recovered* service outage you want to support, plus a bit. So long as longer outages are manually-recovered, the queues can be purged and the system monitored to ensure that nothing’s lost or duplicated.)))
  • 43. Network Management • Small systems can be managed by hand • Large systems need automation: • Naming & address management • Service directories • Authentication & authorization • Logging, monitoring & alerting Thursday, 9 July 2009 42 Finally, a few words about management and monitoring of large networks. Large systems: e.g. the internet itself, the cellular network (all those iPhones!), auto-scaling systems running in the cloud Messaging can be applied to management and monitoring tasks just as well as to application tasks. Brokers can provide rich support for all these tasks; systems like Nanite, which uses RabbitMQ for managing agents as well as letting them communicate, are helping to discover and define the kinds of things that can be moved into the broker in these areas.
  • 44. The Future Thursday, 9 July 2009 43 We’re working on making it as easy as possible to use the design patterns I’ve been talking about. In particular, solid support for synchronising relays, for gateway plugins, and for deduplication (in support of redundancy-for-HA and so forth) is high on our to-do list. People are already building things around RabbitMQ and making it easy to deploy in the cloud; I’m looking forward to seeing what people do with it.
  • 45. Questions? http://www.rabbitmq.com/how Thursday, 9 July 2009 44