build your own service bus v2

60
Service Bus ALT.NET Paris October 2013 ABC Arbitrage Build your own

Upload: alprema

Post on 04-Jul-2015

550 views

Category:

Business


0 download

DESCRIPTION

Our feedback on the creation of a distributed enterprise service bus.

TRANSCRIPT

Page 1: Build your own Service Bus V2

Service Bus

ALT.NET Paris October 2013 ABC Arbitrage

Build your own

Page 2: Build your own Service Bus V2

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

Service Bus Build your own

Page 4: Build your own Service Bus V2

Application 1

ESB

Application 2

Application 3

Copyright Bullshit Consulting ®

Page 5: Build your own Service Bus V2
Page 6: Build your own Service Bus V2
Page 7: Build your own Service Bus V2
Page 8: Build your own Service Bus V2

The tube is a lie

Page 9: Build your own Service Bus V2

Qpid Service Bus V1: broker-based

Application 1 Application 2

Page 10: Build your own Service Bus V2

Qpid.Client Abc.ServiceBus

Application

Qpid

Broker-based Transport

layer

Bus library

Page 11: Build your own Service Bus V2

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

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

And they were blissfully, blissfully happy forever and ever

Page 14: Build your own Service Bus V2

And they were blissfully, blissfully happy forever and ever

Page 15: Build your own Service Bus V2

NEW REQUIREMENTS

Page 16: Build your own Service Bus V2

Higher troughtput

Page 17: Build your own Service Bus V2

Better latency

Page 18: Build your own Service Bus V2

Custom messaging usage was missing Service Bus features

Page 19: Build your own Service Bus V2

and the stack was kind of

Page 20: Build your own Service Bus V2

version

Page 21: Build your own Service Bus V2

LEFT DEAD

.NET client

Page 22: Build your own Service Bus V2

Buy or Build?

Page 23: Build your own Service Bus V2
Page 24: Build your own Service Bus V2

Brokerless transport recipe

• Peer to peer communication protocol

Page 25: Build your own Service Bus V2

• Peer directory

Brokerless transport recipe

Page 26: Build your own Service Bus V2

• Optional and parallel persistence

Brokerless transport recipe

Page 27: Build your own Service Bus V2

Chef tip: • Use interoperable ingredients

Brokerless transport recipe

Page 28: Build your own Service Bus V2

The cherry on the cake: • Build a gateway for Qpid communication

Brokerless transport recipe

Page 29: Build your own Service Bus V2

Maybe you want implementation details?

Page 30: Build your own Service Bus V2

P2P communication

Protocol Buffers

Page 31: Build your own Service Bus V2

“ØMQ sockets are the world-saving superheroes of the networking world”

Pieter Hintjens

Page 32: Build your own Service Bus V2

Service 1 Service 2 Service 3

Service 4

PUSH PUSH PUSH

PULL

Page 33: Build your own Service Bus V2

Who do we connect to?

Page 34: Build your own Service Bus V2

Connecting to the directory

Service 1 Service 2 Service 3

Directory

Page 35: Build your own Service Bus V2

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

Service 1

New service ID + subscriptions

Service 2 Service 3

Directory

Connecting to the directory

Page 37: Build your own Service Bus V2

Service 1 Service 2 Service 3

Directory

Connecting to the directory

HelloEvent

Page 38: Build your own Service Bus V2

The directory, our new SPOF

Page 39: Build your own Service Bus V2

Connecting to the directories

Directory 1 Directory 2

Service 1 Service 2 Service 3

Page 40: Build your own Service Bus V2

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

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

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

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

Cassandra to the rescue

Directory 1 Directory 2

Page 45: Build your own Service Bus V2

What if a service goes down?

Page 46: Build your own Service Bus V2

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

Persisting messages

Service 1

Persistence service

Service 2

HelloEvent Ack

Page 48: Build your own Service Bus V2

• Persistence service acting as frontend

• Cassandra for storage

Persistence service

Page 49: Build your own Service Bus V2

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

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

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

• 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

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

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

Meet our latest SPOF, the persistence

Page 56: Build your own Service Bus V2

• 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

Migration time !

Page 58: Build your own Service Bus V2

Service 1

Inter-bus gateway

Gateway

Service 2

Service 3

Service 4

QPID

Zebus

Broker

Page 59: Build your own Service Bus V2

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

Thank you