wjax 2017: workflow and state machines at scale

62
Workflow and state machines at scale WJAX, Munic, 08th of November 2017 [email protected] | @berndruecker

Upload: bernd-ruecker

Post on 21-Jan-2018

362 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: WJAX 2017: Workflow and state machines at scale

Workflow and state machines at scale

WJAX, Munic, 08th of November 2017

[email protected] | @berndruecker

Page 2: WJAX 2017: Workflow and state machines at scale

What is workflow?

Page 3: WJAX 2017: Workflow and state machines at scale

The „hello world“ example

Human taskmanagement

Service orchestration

Events , e.g. timers

Page 4: WJAX 2017: Workflow and state machines at scale

More realistic examples

Page 5: WJAX 2017: Workflow and state machines at scale
Page 6: WJAX 2017: Workflow and state machines at scale

Microservices &distributed systems

Page 7: WJAX 2017: Workflow and state machines at scale

Message & Events

Page 8: WJAX 2017: Workflow and state machines at scale

Timeout

Page 9: WJAX 2017: Workflow and state machines at scale

Distributed transaction and compensation

Page 10: WJAX 2017: Workflow and state machines at scale

Messages and events

Page 11: WJAX 2017: Workflow and state machines at scale

And even „smaller“ use cases

Service(e.g. Go)

Kafka

RDMS

1. 3.

2.

Page 12: WJAX 2017: Workflow and state machines at scale

And even „smaller“ use cases

Service(e.g. Go)

Kafka

RDMS

1. 3.

2.

Page 13: WJAX 2017: Workflow and state machines at scale

And even „smaller“ use cases

Service(e.g. Go)

Kafka

RDMS

1. 3.

2.

Page 14: WJAX 2017: Workflow and state machines at scale

Traditional workflow engines

Page 15: WJAX 2017: Workflow and state machines at scale

Performance?

Page 16: WJAX 2017: Workflow and state machines at scale
Page 17: WJAX 2017: Workflow and state machines at scale

Status quo

Page 18: WJAX 2017: Workflow and state machines at scale

Concrete numbersplease!*

*using my ThinkPad T460s consumer notebookin a totally not repeatable mannerwhile rendereing a talk recording ;-)

Page 19: WJAX 2017: Workflow and state machines at scale

0

50

100

150

200

250

300

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

Inst

an

ces

sta

rte

d /

se

c

Time

on average

181instances started/sec

Page 20: WJAX 2017: Workflow and state machines at scale

Scaling

Page 21: WJAX 2017: Workflow and state machines at scale

In general, we may conclude that Camunda performed better and more stable for all metrics when compared with WfMS A and WfMS B.Micro-Benchmarking BPMN 2.0 Workflow Management Systems with Workflow Patterns, June 2016, University of Stuttgart, Germany and University of Lugano, Switzerland

Page 22: WJAX 2017: Workflow and state machines at scale

At Google, we have different ideas about scalability.Senior Architect at Google discussing BPMN.

Page 24: WJAX 2017: Workflow and state machines at scale

Telematics night-2420297_1920.jpg

Photo by jievoyage, available under Creative Commons CC0 1.0 license.

Page 25: WJAX 2017: Workflow and state machines at scale

IOT

Photo by Mark Bradshaw, available under Creative Commons BY 2.0 license.

Page 26: WJAX 2017: Workflow and state machines at scale

Logistics

Photo by Sam Churchill, available under Creative Commons BY 2.0 license.

Page 27: WJAX 2017: Workflow and state machines at scale

Financial trading

Photo by 3844328, available under Creative Commons CC0 1.0 license.

Page 28: WJAX 2017: Workflow and state machines at scale

Can you handle 200.000 trades/second?

Page 29: WJAX 2017: Workflow and state machines at scale

New requirements -> new solutions

Remove RDMS

Distributed system

Design forperformance

ResilienceFlexible

persistence

Load

Page 30: WJAX 2017: Workflow and state machines at scale
Page 31: WJAX 2017: Workflow and state machines at scale

Zeebe in a nutshell

https://zeebe.io/

ZeebeBroker

Yourapplication

Binary (MsgPack) Support streaming & batching

Client

Horiziontallyscalable

Append only log / event sourcing

Peer-to-peercluster

Page 32: WJAX 2017: Workflow and state machines at scale

Scale elastically

UP

DOWN

3 Nodes 30 Nodes

SCALE

Page 33: WJAX 2017: Workflow and state machines at scale

Distributed system with topics & partitions

P1: FP2 : FP3 : L

P1: LP2 : FP3 : F

P1: FP2 : LP3 : F

Example:

- Topic with 3 partitionsand replication factor 3

- PX = Partition X- L = Leader- F = Follower

Replication uses the Raft protocol

Page 34: WJAX 2017: Workflow and state machines at scale

Data flow (simplified)

Client

COMPLETEcommand

Broker - Partition Leader

Brokers -Partition Followers

1

2 append

replicate & commit

3

4 process

Stream Processor

State

Partition

5

decide & applyCOMPLETEDresponse

6

Page 35: WJAX 2017: Workflow and state machines at scale

No external services needed

Page 36: WJAX 2017: Workflow and state machines at scale

Publish / Subscribe

ZeebeBroker

Your codeZeebeClient

subscribe

Execute BPMNExecute Business Logic

Page 37: WJAX 2017: Workflow and state machines at scale

Publish / Subscribe

ZeebeBroker

Service1

ZeebeClient

subscribe to A

Service2

ZeebeClient

subscribe to B

Page 38: WJAX 2017: Workflow and state machines at scale

Live hacking

Page 39: WJAX 2017: Workflow and state machines at scale
Page 40: WJAX 2017: Workflow and state machines at scale

https://github.com/zeebe-io/spring-zeebe

Page 41: WJAX 2017: Workflow and state machines at scale

Performance?

Page 42: WJAX 2017: Workflow and state machines at scale

on average

23.414events/sec

on average

4.682started instance/sec

Page 43: WJAX 2017: Workflow and state machines at scale

The box said„RequiresWindows 7 or better“

so I installedLinux

Page 44: WJAX 2017: Workflow and state machines at scale

on average

213.152events/sec

on average

35.525started instance/sec

Page 45: WJAX 2017: Workflow and state machines at scale
Page 46: WJAX 2017: Workflow and state machines at scale

Status & Roadmap

• Tech preview (0.4.0)

• Working towards production-ready state

• Focus on core, not (yet) on completeness of features

• We love to get your feedback and discuss!

Page 47: WJAX 2017: Workflow and state machines at scale

Architecture choices (examples)

Zeebe

Service A

ZeebeClient

BPMN

Service B

ZeebeClient

*Isolation and autonomy can alsobe achieved in this architecture

Monolith

Zeebe

ZeebeClient

BPMN

Service A

ZeebeClient

BPMN

Zeebe

Service B

Kafka/AMQP/…

the monolith Microservices some hybrid*

Page 48: WJAX 2017: Workflow and state machines at scale

CADENCE

Page 49: WJAX 2017: Workflow and state machines at scale
Page 50: WJAX 2017: Workflow and state machines at scale

https://github.com/samarabbas/cadence-samples/blob/master/cmd/samples/

CADENCE

X

No imageavailable

Page 51: WJAX 2017: Workflow and state machines at scale

“[…]as the number of microservices grow and the complexity of the processes increases, getting visibility into these distributed workflows becomes difficult without a central orchestrator.”

Page 52: WJAX 2017: Workflow and state machines at scale

https://netflix.github.io/conductor/metadata/kitchensink/

Page 53: WJAX 2017: Workflow and state machines at scale
Page 54: WJAX 2017: Workflow and state machines at scale

http://docs.aws.amazon.com/step-functions/latest/dg/tutorial-creating-lambda-state-machine.html

Page 55: WJAX 2017: Workflow and state machines at scale

Zeebe Uber Cadence Netflix Orcherstrator

AWS StepFunctions

Client language orAPI

Java, Go Go Java, REST AWS SDK, REST

Persistent storage Event log on file system

Cassandra Netflix Dynomite(k-v)

-

License and business model

OSS, backed byvendor (EE)

OSS project OSS project Cloud

Distribution Source, Binary Source Source -

Flow language BPMN, YAML, Java YAML, Go JSON JSON

Visibility BPMN None Proprietary Proprietary

Page 56: WJAX 2017: Workflow and state machines at scale

BPMN

Executable*

Easy tounderstand**

Widespread

**(for Biz and Dev)* (and mature)

Page 57: WJAX 2017: Workflow and state machines at scale

Should I throw away my traditional workflow engine?

A-F G-Z

Page 58: WJAX 2017: Workflow and state machines at scale

https://db-engines.com/en/ranking_trend

Page 59: WJAX 2017: Workflow and state machines at scale

https://db-engines.com/en/ranking_trend

Page 60: WJAX 2017: Workflow and state machines at scale

Thank you!

Page 61: WJAX 2017: Workflow and state machines at scale

Slides:https://bernd-ruecker.com

Blog:https://blog.bernd-ruecker.com

Feedback:https://bernd-ruecker.com/feedback

Page 62: WJAX 2017: Workflow and state machines at scale

Images licensed from iStockno attribution required

Own photos

All icons licensed from Noun Projectno attribution required