+ All Categories
Home > Documents > MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS....

MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS....

Date post: 27-May-2020
Category:
Upload: others
View: 70 times
Download: 0 times
Share this document with a friend
24
Microservice Plumbing With RabbitMQ ASYNC MESSAGING FOR MICROSERVICES @jsonrow [email protected] https://github.com/JasonRowe
Transcript
Page 1: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

Microservice PlumbingWithRabbitMQASYNC MESSAGINGFORMICROSERVICES

@[email protected]

https://github.com/JasonRowe

Page 2: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

AboutMe

@JSONROW

jasonrowe.com

PastAsync MessagingExperience• MSMQ• NServiceBus• MassTransit

CurrentTechStack• .NETCore• RabbitMQ• Docker• Vue.JS

Page 3: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

RabbitMQ OverviewWhatisRabbitMQ?

@JSONROW

Page 4: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

WhatisAMQP?AdvancedMessageQueueProtocol

Openinternetprotocolforbusinessmessaging

Binarywire-levelprotocol

AMQPwasdesignedwiththefollowingmaincharacteristicsasgoals:

Security

Reliability

Interoperability

Standard

Open

@JSONROW

Page 5: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

AMQPModel

Exchange->Binding->[Queue]

Exchanges

Receivesandroutesmessages

Binding

Definestherelationshipbetweenexchangeandqueue

Queues

Storesmessagesuntiltheyareprocessed

@JSONROW

Page 6: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

RabbitMQ Hello,world.

@JSONROW

Page 7: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

RabbitMQ – changingamonolith

@JSONROW

P/C P/C P/C

P CX Q

P

C

C

BigChallenge- changingthecommunicationpattern.

Page 8: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

MessageDurabilityPublisherconfirms

Durabilityexchangesandqueues

message acknowledgements

Deliveryandprocessingconfirmation

@JSONROW

Page 9: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

MessagePublishing

@JSONROW

MessagePublishinginRabbitMQ,by GavinMRoy

Page 10: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

ReceivingMessages

@JSONROW

MessagePublishinginRabbitMQ,by GavinMRoy

Page 11: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

HighAvailability

EnablePublisherconfirms

UseDurablequeues,exchanges

Extensionstoconsider- consistentlyhashandsharding

DonotenableHiPE

Prefetch configuration

MultinodeswithHApolicy

@JSONROW

Page 12: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

HighPerformanceEnableHiPE

DisableLazyQueue

Shortqueues

TransientMessages

DisableHA

@JSONROW

Page 13: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

MyRecentRabbitMQ successstory.RefiningaservicesboundariesandswitchingtoRabbitMQ

@JSONROW

Page 14: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

RecentRabbitMQ successstory.

0

10,000

20,000

30,000

40,000

50,000

60,000

70,000

Run1 Run2 Run3

AverageTime(m

s)

Baselinetestruns

Legacy RabbitMQ

@JSONROW

Page 15: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

DirectExchange

Publisher DirectexchangeCreatedModifiedDeleted

RoutingKeys

Queue

Queue

Queue

Consumer

Consumer

Consumer

@JSONROW

Modified

Bindings

Page 16: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

Fanoutexample

P

C

Fanoutexchange

QueueA

QueueB

QueueC

@JSONROW

C

C

Page 17: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

TopicexchangeexampleWildcardroutingbyroutingkey*(star)cansubstituteforexactlyoneword.#(hash)cansubstituteforzeroormorewords.

@JSONROW

P Topicexchange

Q

Q

Q

C

C

C

*.*.mdc

Bindings

Page 18: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

AnalysisRequestExample

@JSONROW

P X

Q

cnc.emea

C

AnalysisRequest

Q

Q

C

C 3DPAmericaAnalysis

CNCUKAnalysis

InjectionMoldingJapanAnalysis

Q C AnalysisArchive

Page 19: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

CompetingConsumers

@JSONROW

Page 20: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

Rabbitmq UseCasesGood

EventStream

Connectingappsnewandoldwrittenindifferentlanguages

WhenyouareuncertainRabbitMQ isacertainchoice

multiprotocolandpatterns

Federationbetweendatacenters

Bad

Largebinaryvideosandimages

Useasadatastorelargequeues

@JSONROW

Page 21: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

LessonsLearnedMajorRabbitMQ upgradesandErlang upgradescomeswithsomedowntimeevenonmulti-nodeclusters.(bluegreen)

Connections- don'topennewconnectionswitheverymessage.Don'tletqueuesgrow10,000messagesistoomuchlimitwithTTLormaxsizeSendpersistentmessagesandusedurablequeuesandexchangeUsepublisherconfirmswhenitmakessenseTakealookatprefetch andadjustifneeded

@JSONROW

Page 22: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

MonitoringQueueLength

MissingConsumers

Howlongmessageshavebeeninqueue

CPU,RAM,Disk

https://www.rabbitmq.com/production-checklist.html

@JSONROW

Page 23: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

Summary• RabbitMQ isagreatsolutionforconnectingasync messagingforMicroservices

• RabbitMQ providesoptionsforhighperformanceandhighreliability

• Messagingdoesn’tneedtobehard,itcanbeboring,andboringisgood.

• It’sageneralpurposemessagingsystemthatmaybetherightchoicetohelpbreakupyourmonolithorconnectourmicroservices

@JSONROW

Page 24: MicroservicePlumbing With RabbitMQ€¦ · • .NET Core • RabbitMQ • Docker • Vue.JS. RabbitMQOverview What is RabbitMQ? @JSONROW. What is AMQP? Advanced Message Queue Protocol

Questions?

@JSONROW


Recommended