Download - Build your own Service Bus V2
![Page 1: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/1.jpg)
Service Bus
ALT.NET Paris October 2013 ABC Arbitrage
Build your own
![Page 2: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/2.jpg)
Olivier Coanet OMG this guy does not tweet
Kevin Lovato @alprema
ABC Arbitrage Asset Management www.abc-arbitrage.com
ALT.NET France www.altnetfr.org www.meetup.com/altnetfr
![Page 3: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/3.jpg)
Service Bus Build your own
![Page 4: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/4.jpg)
Application 1
ESB
Application 2
Application 3
Copyright Bullshit Consulting ®
![Page 5: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/5.jpg)
![Page 6: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/6.jpg)
![Page 7: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/7.jpg)
![Page 8: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/8.jpg)
The tube is a lie
![Page 9: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/9.jpg)
Qpid Service Bus V1: broker-based
Application 1 Application 2
![Page 10: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/10.jpg)
Qpid.Client Abc.ServiceBus
Application
Qpid
Broker-based Transport
layer
Bus library
![Page 11: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/11.jpg)
Qpid.Client Abc.ServiceBus Application 1
Qpid
Qpid.Client Abc.ServiceBus Application 2
Application 3 Abc.ServiceBus
Qpid.Client ESB + infrastructure services
![Page 12: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/12.jpg)
Qpid.Client Abc.ServiceBus
Service 1
Qpid
Qpid.Client Abc.ServiceBus
Service 2
Service 3 Abc.ServiceBus
Qpid.Client
![Page 13: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/13.jpg)
And they were blissfully, blissfully happy forever and ever
![Page 14: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/14.jpg)
And they were blissfully, blissfully happy forever and ever
![Page 15: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/15.jpg)
NEW REQUIREMENTS
![Page 16: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/16.jpg)
Higher troughtput
![Page 17: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/17.jpg)
Better latency
![Page 18: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/18.jpg)
Custom messaging usage was missing Service Bus features
![Page 19: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/19.jpg)
and the stack was kind of
![Page 20: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/20.jpg)
version
![Page 21: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/21.jpg)
LEFT DEAD
.NET client
![Page 22: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/22.jpg)
Buy or Build?
![Page 23: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/23.jpg)
![Page 24: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/24.jpg)
Brokerless transport recipe
• Peer to peer communication protocol
![Page 25: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/25.jpg)
• Peer directory
Brokerless transport recipe
![Page 26: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/26.jpg)
• Optional and parallel persistence
Brokerless transport recipe
![Page 27: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/27.jpg)
Chef tip: • Use interoperable ingredients
Brokerless transport recipe
![Page 28: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/28.jpg)
The cherry on the cake: • Build a gateway for Qpid communication
Brokerless transport recipe
![Page 29: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/29.jpg)
Maybe you want implementation details?
![Page 30: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/30.jpg)
P2P communication
Protocol Buffers
![Page 31: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/31.jpg)
“ØMQ sockets are the world-saving superheroes of the networking world”
Pieter Hintjens
![Page 32: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/32.jpg)
Service 1 Service 2 Service 3
Service 4
PUSH PUSH PUSH
PULL
![Page 33: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/33.jpg)
Who do we connect to?
![Page 34: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/34.jpg)
Connecting to the directory
Service 1 Service 2 Service 3
Directory
![Page 35: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/35.jpg)
Peers list + subscriptions
Service 1 Service 2 Service 3
Directory
Connecting to the directory
RegisterCommand + I listen to HelloEvent
![Page 36: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/36.jpg)
Service 1
New service ID + subscriptions
Service 2 Service 3
Directory
Connecting to the directory
![Page 37: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/37.jpg)
Service 1 Service 2 Service 3
Directory
Connecting to the directory
HelloEvent
![Page 38: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/38.jpg)
The directory, our new SPOF
![Page 39: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/39.jpg)
Connecting to the directories
Directory 1 Directory 2
Service 1 Service 2 Service 3
![Page 40: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/40.jpg)
RegisterCommand + I listen to HelloEvent
Connecting to the directories
Directory 1 Directory 2
Service 1 Service 2 Service 3
RegisterCommand + I listen to HelloEvent
![Page 41: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/41.jpg)
Connecting to the directories
Directory 1 Directory 2
Service 1 Service 2 Service 3
HelloEvent listeners: Service 2
HelloEvent listeners: Service 1
![Page 42: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/42.jpg)
Connecting to the directories
Directory 1 Directory 2
Service 1 Service 2 Service 3
HelloEvent listeners: Service 2
HelloEvent listeners: Service 1
RegisterCommand Peers list + subscriptions
![Page 43: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/43.jpg)
Connecting to the directories
Directory 1 Directory 2
Service 1 Service 2 Service 3
HelloEvent listeners: Service 2
HelloEvent listeners: Service 1
HelloEvent listeners: Service 2
![Page 44: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/44.jpg)
Cassandra to the rescue
Directory 1 Directory 2
![Page 45: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/45.jpg)
What if a service goes down?
![Page 46: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/46.jpg)
HelloEvent
Service 1
Persistence service
Service 2
Copy of HelloEvent
Persisting messages
Stored messages Stored messages Stored messages
![Page 47: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/47.jpg)
Persisting messages
Service 1
Persistence service
Service 2
HelloEvent Ack
![Page 48: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/48.jpg)
• Persistence service acting as frontend
• Cassandra for storage
Persistence service
![Page 49: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/49.jpg)
Messages persistence model
Row Key
Abc_Service1 2013-10-03 08:25:38 2013-09-03 11:03:52 …
Serialized message …
Abc_Service2 2012-03-09 23:01:00 ...
..
…
![Page 50: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/50.jpg)
Acks persistence model
Row Key
Abc_Service1 2013-10-03 08:25:38 2013-09-03 11:03:52 …
null …
Abc_Service2 2012-03-09 23:01:00 ...
..
…
![Page 51: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/51.jpg)
Service 1
Persistence service
Service 2
Error recovery
Messages sent to Service 2 while it was down
Stored messages Stored messages Stored messages
![Page 52: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/52.jpg)
• Phase 1 : Missed messages recovery
Error recovery
Service 1
Persistence service
Service 2
Missed messages recovery Stored messages Stored messages Stored messages
![Page 53: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/53.jpg)
Service 1
Persistence service
Service 2
• Phase 1 : Missed messages recovery • Phase 2 : Mixed recovery
Normal message reception
Streaming of the messages from the persistence
Error recovery
![Page 54: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/54.jpg)
Service 1
Persistence service
Service 2
• Phase 1 : Missed messages recovery • Phase 2 : Mixed recovery • Phase 3 : Normal phase
Error recovery
Normal message reception
![Page 55: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/55.jpg)
Meet our latest SPOF, the persistence
![Page 56: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/56.jpg)
• Persistance only required at startup • Messages are also stored in the ZMQ outbound buffer
But actually, no
![Page 57: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/57.jpg)
Migration time !
![Page 58: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/58.jpg)
Service 1
Inter-bus gateway
Gateway
Service 2
Service 3
Service 4
QPID
Zebus
Broker
![Page 59: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/59.jpg)
Summary • Running in production • Migration: 40% done • Gateway under heavy load • Owning the transport layer is double edged
![Page 60: Build your own Service Bus V2](https://reader034.vdocuments.net/reader034/viewer/2022052412/5597057e1a28abd30e8b4582/html5/thumbnails/60.jpg)
Thank you