+ All Categories
Home > Documents > rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This...

rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This...

Date post: 08-Aug-2020
Category:
Upload: others
View: 6 times
Download: 0 times
Share this document with a friend
101
Building a Distributed Data Ingestion System with RabbitMQ Alvaro Videla - RabbitMQ
Transcript
Page 1: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Building a Distributed Data Ingestion System

with RabbitMQAlvaro Videla - RabbitMQ

Page 2: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Alvaro Videla

• Developer Advocate at Pivotal / RabbitMQ!

• Co-Author of RabbitMQ in Action!

• Creator of the RabbitMQ Simulator!

• Blogs about RabbitMQ Internals: http://videlalvaro.github.io/internals.html!

• @old_sound — [email protected] — github.com/videlalvaro

Page 3: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

About Me

Co-authored!!

RabbitMQ in Action!

http://bit.ly/rabbitmq

Page 4: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

About this Talk

• Exploratory Talk

• A ‘what could be done’ talk instead of ‘this is how you do it’

Page 5: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Agenda

• Intro to RabbitMQ

• The Problem

• Solution Proposal

• Improvements

Page 6: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

What is RabbitMQ

Page 7: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

RabbitMQ

Page 8: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

RabbitMQ

Page 9: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

RabbitMQ• Multi Protocol Messaging Server

Page 10: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

• Multi Protocol Messaging Server!• Open Source (MPL)

RabbitMQ

Page 11: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

• Multi Protocol Messaging Server!• Open Source (MPL)!• Polyglot

RabbitMQ

Page 12: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

• Multi Protocol Messaging Server!• Open Source (MPL)!• Polyglot!• Written in Erlang/OTP

RabbitMQ

Page 14: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

http://www.rabbitmq.com/community-plugins.html

Community Plugins

Page 15: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Polyglot

Page 16: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Polyglot

Page 17: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Polyglot

• Java

Page 18: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Polyglot

• Java!• node.js

Page 19: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Polyglot

• Java!• node.js!• Erlang

Page 20: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Polyglot

• Java!• node.js!• Erlang!• PHP

Page 21: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Polyglot

• Java!• node.js!• Erlang!• PHP!• Ruby

Page 22: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Polyglot

• Java!• node.js!• Erlang!• PHP!• Ruby!• .Net

Page 23: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Polyglot

• Java!• node.js!• Erlang!• PHP!• Ruby!• .Net!• Haskell

Page 24: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Polyglot

Even COBOL!!!11

Page 25: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Some users of RabbitMQ

Page 26: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

• Instagram

Some users of RabbitMQ

Page 27: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

• Instagram!• Indeed.com

Some users of RabbitMQ

Page 28: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

• Instagram!• Indeed.com!• Telefonica

Some users of RabbitMQ

Page 29: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

• Instagram!• Indeed.com!• Telefonica!• Mercado Libre

Some users of RabbitMQ

Page 30: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

• Instagram!• Indeed.com!• Telefonica!• Mercado Libre!• NHS

Some users of RabbitMQ

Page 31: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

• Instagram!• Indeed.com!• Telefonica!• Mercado Libre!• NHS!• Mozilla

Some users of RabbitMQ

Page 32: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

The New York Times on RabbitMQ

This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in Oregon and Dublin.

Upon launch today, the system autoscaled to ~500,000 users. Connection times remained flat at ~200ms.

http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2014-January/032943.html

Page 33: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

http://www.rabbitmq.com/download.html

Unix - Mac - Windows

Page 34: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Messaging with RabbitMQ

A demo with the RabbitMQ Simulator

https://github.com/RabbitMQSimulator/RabbitMQSimulator

Page 35: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

http://tryrabbitmq.com

Page 36: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

RabbitMQ Simulator

Page 37: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

The Problem

Page 38: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Distributed Application

App

App

App

App

Page 39: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Distributed Application

App

App

App

App

Page 40: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

ConnectionFactory factory = new ConnectionFactory(); factory.setHost("localhost"); !

Connection connection = factory.newConnection(); !

Channel channel = connection.createChannel();

Data ProducerObtain a Channel

Page 41: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

channel.exchangeDeclare(EXCHANGE_NAME, "direct", true);

Data Producer

Declare an Exchange

Page 42: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

String message = "Hello Federation!"; channel.basicPublish(EXCHANGE_NAME, "", null, message.getBytes());

Data Producer

Publish a message

Page 43: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

ConnectionFactory factory = new ConnectionFactory(); factory.setHost("localhost"); !

Connection connection = factory.newConnection(); !

Channel channel = connection.createChannel();

Data ConsumerObtain a Channel

Page 44: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

channel.queueDeclare(QUEUE_NAME, true, false, false, null); channel.exchangeDeclare(EXCHANGE_NAME, "direct", true); channel.queueBind(QUEUE_NAME, EXCHANGE_NAME, "");

Data ConsumerDeclare Queue and bind it

Page 45: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

QueueingConsumer consumer = new QueueingConsumer(channel); channel.basicConsume(QUEUE_NAME, false, consumer);

Data ConsumerStart a consumer

Page 46: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

while (true) { QueueingConsumer.Delivery delivery = consumer.nextDelivery(); String message = new String(delivery.getBody()); System.out.println("Received '" + message + "'"); !

channel.basicAck( delivery.getEnvelope(). getDeliveryTag(), false); }

Data ConsumerProcess messages

Page 47: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Ad-hoc solution

Page 48: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

A process that replicates data to the remote server

Page 49: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Possible issues• Remote server is offline

• Prevent unbounded local buffers

• Prevent message loss

• Prevent unnecessary message replication

• No need for those messages on remote server

• Messages that became stale

Page 50: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Can we do better?

Page 51: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

RabbitMQ Federation

Page 52: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

RabbitMQ Federation• Supports replication across different administrative domains

• Supports mix of Erlang and RabbitMQ versions

• Supports Network Partitions

• Specificity - not everything has to be federated

Page 53: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

RabbitMQ Federation

Page 54: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

RabbitMQ Federation

Page 55: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

RabbitMQ Federation

Page 56: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

RabbitMQ Federation

• It’s a RabbitMQ Plugin

Page 57: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

RabbitMQ Federation

• It’s a RabbitMQ Plugin

• Internally uses Queues and Exchanges Decorators

Page 58: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

RabbitMQ Federation

• It’s a RabbitMQ Plugin

• Internally uses Queues and Exchanges Decorators

• Managed using Parameters and Policies

Page 59: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Enabling the Plugin

rabbitmq-plugins enable rabbitmq_federation

Page 60: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Enabling the Plugin

rabbitmq-plugins enable rabbitmq_federation

rabbitmq-plugins enable rabbitmq_federation_management

Page 61: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Federating an Exchange

rabbitmqctl set_parameter federation-upstream my-upstream \ ‘{“uri":"amqp://server-name","expires":3600000}'

Page 62: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Federating an Exchange

rabbitmqctl set_parameter federation-upstream my-upstream \ ‘{“uri":"amqp://server-name","expires":3600000}' !

rabbitmqctl set_policy --apply-to exchanges federate-me "^amq\." \ '{"federation-upstream-set":"all"}'

Page 63: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Federating an Exchange

Page 64: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Configuring Federation

Page 65: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Config Optionsrabbitmqctl set_parameter federation-upstream \ name ‘json-object’

Page 66: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Config Optionsrabbitmqctl set_parameter federation-upstream \ name ‘json-object’ !

json-object: { ‘uri’: ‘amqp://server-name/’, ‘prefetch-count’: 1000, ‘reconnect-delay’: 1, ‘ack-mode’: on-confirm }

http://www.rabbitmq.com/federation-reference.html

Page 67: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Prevent unbound buffers

expires: N // ms. message-ttl: N // ms.

Page 68: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Prevent message forwarding

max-hops: N

Page 69: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Speed vs No Message Loss

ack-mode: on-confirm ack-mode: on-publish

ack-mode: no-ack

Page 70: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

AMQP URI:

amqp://user:pass@host:10000/vhost

http://www.rabbitmq.com/uri-spec.html

Page 71: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Config can be applied via

• CLI using rabbitmqctl

• HTTP API

• RabbitMQ Management Interface

Page 72: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

RabbitMQ Federation

Page 73: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Scaling the Setup

Page 74: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

The Problem

Page 75: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

The Problem

• Queues contents live in the node where the Queue was declared

Page 76: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

The Problem

• Queues contents live in the node where the Queue was declared

• A cluster can access the queue from every connected node

Page 77: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

The Problem

• Queues contents live in the node where the Queue was declared

• A cluster can access the queue from every connected node

• Queues are an Erlang process (tied to one core)

Page 78: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

The Problem

• Queues contents live in the node where the Queue was declared

• A cluster can access the queue from every connected node

• Queues are an Erlang process (tied to one core)

• Adding more nodes doesn’t really help

Page 79: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Enter Sharded Queues

Page 80: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Enter Sharded Queues

Page 81: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Pieces of the Puzzle

• modulo hash exchange (consistent hash works as well)

• good ol’ queues

Page 82: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Sharded Queues

Page 83: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Sharded Queues

Page 84: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Sharded Queues

Page 85: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Sharded Queues

Page 86: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Sharded Queues

• Declare Queues with name: nodename.queuename.index

Page 87: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Sharded Queues

• Declare Queues with name: nodename.queuename.index

• Bind the queues to a consistent hash exchange

Page 88: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Sharded Queues

• Declare Queues with name: nodename.queuename.index

• Bind the queues to a partitioner exchange

• Transparent to the consumer (virtual queue name)

Page 89: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

We need more scale!

Page 90: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Federated Queues

Page 91: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Federated Queues

• Load-balance messages across federated queues

• Only moves messages when needed

Page 92: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Federating a Queue

rabbitmqctl set_parameter federation-upstream my-upstream \ ‘{“uri":"amqp://server-name","expires":3600000}'

Page 93: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Federating a Queue

rabbitmqctl set_parameter federation-upstream my-upstream \ ‘{“uri":"amqp://server-name","expires":3600000}' !

rabbitmqctl set_policy --apply-to queues federate-me "^images\." \ '{"federation-upstream-set":"all"}'

Page 94: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

With RabbitMQ we can

Page 95: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

With RabbitMQ we can

• Ingest data using various protocols: AMQP, MQTT and STOMP

Page 96: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

With RabbitMQ we can

• Ingest data using various protocols: AMQP, MQTT and STOMP

• Distribute that data globally using Federation

Page 97: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

With RabbitMQ we can

• Ingest data using various protocols: AMQP, MQTT and STOMP

• Distribute that data globally using Federation

• Scale up using Sharding

Page 98: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

With RabbitMQ we can

• Ingest data using various protocols: AMQP, MQTT and STOMP

• Distribute that data globally using Federation

• Scale up using Sharding

• Load balance consumers with Federated Queues

Page 99: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Credits

world map: wikipedia.org

federation diagrams: rabbitmq.com

Page 100: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

Questions?

Page 101: rabbitmq data ingestion efl - erlang-factory.com€¦ · The New York Times on RabbitMQ This architecture - Fabrik - has dozens of RabbitMQ instances spread across 6 AWS zones in

ThanksAlvaro Videla - @old_sound


Recommended