rabbitmq messaging in the cloud

Post on 08-Jan-2018

229 views 0 download

description

introduction Why messaging important? Why rabbitmq? What Rabbitmq can do? What need to be remembered in rabbitmq?

Transcript of rabbitmq messaging in the cloud

RABBITMQMESSAGING IN THE CLOUD

Thanh Tran

INTRODUCTION Why messaging important? Why rabbitmq? What Rabbitmq can do? What need to be remembered in rabbitmq?

WHY MESSAGING IMPORTANT? Scalability issue Traditional synchronous programming models

are poor at large scale Cloud computing Messaging enables scaling by decoupling

components and adding flexibility.

WHY RABBITMQ? Free, open source Easily installed and used by clients. Support many client’s languages Asynchronous message passing High performance (up to 30k mps for one

queue, 10k in my desktop), high availability and easy to scale up (cluster)

Support web-based administration

WHY RABBITMQ?

WHAT RABBITMQ CAN DO?

Producer Consumer

Decoupling

E.g. website passing orders to a credit-card charging engine

Producer Consumer

Bidirectional Decoupling

E.g. remote procedure call

Producer Consumer

Work aggregation, distribution and Decoupling

E.g. website passing orders to a credit-card charging engine

Producer Consumer

WHAT NEED TO BE REMEMBERED IN RABBITMQ?

3 key nouns: channel, exchange, queue. 3 types of exchange: direct, fanout, topic

3 TYPES OF EXCHANGE IN RABBITMQ

Direct:

X

ExchangeType=direct

rk: routing key bk: Binding key

Ark=“vodka”

“queue_1”

“queue_2”

bk=“vodka

bk=“beer”

Brk=“beer”

3 TYPES OF EXCHANGE IN RABBITMQ

Fanout:

X

ExchangeType=fanout

rk: routing key bk: Binding key

Ark=“vodka”

“queue_1”

“queue_2”

Ark=“vodka”

3 TYPES OF EXCHANGE IN RABBITMQ Topic: routing keys can be a pattern

* matches any 1 element # matches zero or more elements

X

ExchangeType=direct

rk: routing key bk: Binding key

Ark=“a.b.c”

“queue_1”

“queue_2”

bk=“a.*.c”

bk=“#.e”

Brk=“a.e”

DEMO Generate n random integers

Stand alone mode Distributed mode using rabbitmq

How:

master

worker_1queue_1

worker_2

worker_k

queue_2

queue_k

n random integers

n/k

n/k

n/k

Rabbitmq

Mergingqueue

Split j

ob

QUESTIONS?