Reactive Systems Why now? Electronic Commerce Era Multicore Era - - PowerPoint PPT Presentation

reactive systems why now electronic commerce era
SMART_READER_LITE
LIVE PREVIEW

Reactive Systems Why now? Electronic Commerce Era Multicore Era - - PowerPoint PPT Presentation

Reactive Systems Why now? Electronic Commerce Era Multicore Era Cloud Era Backlash to the BOFH Era Rails, JEE, or X are just not good enough! Rails, JEE, or X are just not good enough! Simultaneous Invention/Evolution Successful systems


slide-1
SLIDE 1

Reactive Systems

slide-2
SLIDE 2

Why now?

slide-3
SLIDE 3

Electronic Commerce Era

slide-4
SLIDE 4

Multicore Era

slide-5
SLIDE 5

Cloud Era

slide-6
SLIDE 6

Backlash to the BOFH Era

slide-7
SLIDE 7

Rails, JEE, or X are just not good enough!

slide-8
SLIDE 8

Rails, JEE, or X are just not good enough!

slide-9
SLIDE 9

Successful systems patterns are being “discovered”

Simultaneous Invention/Evolution

slide-10
SLIDE 10

Responsive Resilient Elastic

  • Message-Driven

Desirable System Properties

slide-11
SLIDE 11

What’s in a name?

slide-12
SLIDE 12

re•act•ive


adjective \rē-ˈak-tiv\

  • : done in response to a problem or

situation

  • : reacting to problems when they occur

instead of doing something to prevent them

Source: http://www.merriam-webster.com/
slide-13
SLIDE 13

http://www.reactivemanifesto.org/

slide-14
SLIDE 14

Responsive

slide-15
SLIDE 15

re•spons•ive


adjective \ri-ˈspän(t)-siv\

  • : reacting in a desired or positive way
  • : quick to react or respond
Source: http://www.merriam-webster.com/
slide-16
SLIDE 16
slide-17
SLIDE 17
  • 1. Be Deterministic
  • 2. Offer good Service Times
  • 3. Go Parallel to divide work

How to be Responsive?

slide-18
SLIDE 18
  • 1. Deterministic

=> Order of Algorithms

slide-19
SLIDE 19

Order of Algorithms

slide-20
SLIDE 20

Latency Histograms

slide-21
SLIDE 21

Latency Histograms

Mode

slide-22
SLIDE 22

Latency Histograms

Mode Median

slide-23
SLIDE 23

Latency Histograms

Mode Median Mean

slide-24
SLIDE 24

Don’t be a Resource Hog

slide-25
SLIDE 25
  • 2. Service Time

=> Utilisation

slide-26
SLIDE 26

Queuing Theory

Response Time 3 6 8 11 Utilisation 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
slide-27
SLIDE 27

Limit queue lengths
 to control response times

slide-28
SLIDE 28
  • 3. Parallel

=> Contention & Coherence

slide-29
SLIDE 29

Universal Scalability Law

Speedup 5 10 15 20 Processors 1 2 4 8 16 32 64 128 256 512 1024 Amdahl USL
slide-30
SLIDE 30

Shared mutable state is the
 crystal meth


  • f concurrent systems
slide-31
SLIDE 31

Break work into batches and pipelines with no contention

slide-32
SLIDE 32

Are you a Hipster or a Geek?

slide-33
SLIDE 33

Learn to Measure & Apply Science

slide-34
SLIDE 34

“Synchronous RPC is the
 crack cocaine of
 distributed programming”

  • @mjpt777
slide-35
SLIDE 35

Resilient

slide-36
SLIDE 36

re·sil·ient adjective \ri-ˈzil-yənt\

: able to become strong, healthy, or successful again after something bad happens : able to return to an original shape after being pulled, stretched, pressed, bent, etc.

[Merriam-Webster online Dictionary]

@drkrab

slide-37
SLIDE 37

Bad things that happen

“Broken”

  • Computers
  • Memory
  • Disks
  • Networks
  • Routers
  • Cables

“Stretched”

  • Memory
  • Compute
  • I/O Load
  • Storage

capacity

  • Congestion

“Unforeseen”

  • Input Validation
  • Configuration
  • Inconsistency
  • Hackers
  • Just plain BUGS

“Anything that can possibly go wrong, eventually does.”

slide-38
SLIDE 38

Bulkheads

In essence: contain faults

slide-39
SLIDE 39

The 3 rules of resilience

  • 1. Isolate,
  • 2. Isolate, and
  • 3. Isolate. 

slide-40
SLIDE 40

“You need at least two [computers] to make a reliable system”

A B

  • bserve
  • bserve

Joe Armstrong

slide-41
SLIDE 41

Joe’s version


  • f Titanic

THE UNSINKABLE 1 THE UNSINKABLE 2

slide-42
SLIDE 42

The 3 rules of resilience

  • 1. Isolate,
  • 2. Isolate, and
  • 3. Make faults 

  • bservable.
slide-43
SLIDE 43

Units of Isolation

1. Data Center 2. Rack / Cluster 3. Machine 4. Operating System Process 5. Software Component

slide-44
SLIDE 44

Most software 
 faults are transient

When Microsoft Word hangs, 
 you restart it, and move on with life.

… this is where the Titanic analogy ends.

slide-45
SLIDE 45

The 3 rules of resilience

  • 1. Isolate,
  • 2. Make faults 

  • bservable,
  • 3. Restart
slide-46
SLIDE 46

Units of Isolation

1. Data Center 2. Rack / Cluster 3. Machine 4. Operating System Process 5. Software Component

slide-47
SLIDE 47

Actors: Isolated Components

1. Encapsulated 2. Faults are handled outside


– by another actor

3. Patterns for fault handlers 
 are called Supervisors

slide-48
SLIDE 48

Toolbox

  • Heartbeats / alive monitors
  • Transactions
  • Append-only file formats
  • Actors / Micro-processes
  • Component-local resources
  • Supervisors (Erlang, Akka)
  • Circuit Breaker Patterns
  • and many more …
slide-49
SLIDE 49

@drkrab … because you know it’s
 ISOLATED

slide-50
SLIDE 50

Elastic

slide-51
SLIDE 51

elas•tic


adjective /i-ˈlas-tik/

  • : capable of ready change or easy expansion
  • r contraction
  • : able to be changed
Source: http://www.merriam-webster.com/
slide-52
SLIDE 52

Outline

  • 1. Scaling
  • 2. Elastic
  • 3. Profit!
52
slide-53
SLIDE 53

Why do we need to be Elastic?

slide-54
SLIDE 54

The rules of the game

have changed

slide-55
SLIDE 55 55

Apps in the 60s-90s were written for Apps today are written for

Single machines Clusters of machines Single core processors Multicore processors Expensive RAM Cheap RAM Expensive disk Cheap disk Slow networks Fast networks Few concurrent users Lots of concurrent users Small data sets Large data sets Latency in seconds Latency in milliseconds

slide-56
SLIDE 56

Outline

56
  • 1. Scaling
  • 2. Elastic
  • 3. Profit!
slide-57
SLIDE 57

WAIT! What is Scalability?

slide-58
SLIDE 58

Scalability vs Performance

slide-59
SLIDE 59

UP

Scale

slide-60
SLIDE 60

OUT

Scale

slide-61
SLIDE 61

Data Center

61

Data Center Cluster Cluster Machine Machine JVM JVM Node Node Thread Thread CPU CPU CPU Socket CPU Socket CPU Core CPU Core CPU L1/L2 Cache CPU L1/L2 Cache

slide-62
SLIDE 62 62

Thus Scaling Up & Out is practically

the same thing

slide-63
SLIDE 63

IN

DOWN

$cale $cale

slide-64
SLIDE 64

ASYNC

64

be

slide-65
SLIDE 65 65

BLOCK

don’t

slide-66
SLIDE 66 66

CONQUER

66

divide

slide-67
SLIDE 67 67

LINE

pipe

slide-68
SLIDE 68 68

NOTHING

share

slide-69
SLIDE 69

TRANSPARENCY

69

location

slide-70
SLIDE 70

METRICS

70
  • btain
slide-71
SLIDE 71

Outline

71
  • 1. Scaling
  • 2. Elastic
  • 3. Profit!
slide-72
SLIDE 72

ELASTICITY

72

reactive

slide-73
SLIDE 73 73

ELASTICITY

predictive

slide-74
SLIDE 74

ELASTIC

become

slide-75
SLIDE 75

Outline

75
  • 1. Scaling
  • 2. Elastic
  • 3. Profit!
slide-76
SLIDE 76

Message Driven

slide-77
SLIDE 77

It’s not what Message Passing provides.

  • It’s what it makes harder
  • r even impossible.
slide-78
SLIDE 78 @toddlmontgomery

pro·to·col noun \ˈprō-tə-ˌkȯl, -ˌkōl, -ˌkäl, -kəl\

  • ...
  • : a set of conventions governing the treatment and especially the

formatting of data in an electronic communications system <network protocols> ... : a code prescribing strict adherence to correct etiquette and precedence (as in diplomatic exchange and in the military services) <a breach of protocol>

slide-79
SLIDE 79

Boundaries are Good!

slide-80
SLIDE 80
slide-81
SLIDE 81

Forced Decoupling & Separation of Concerns

Binary Boundary Asynchronous Boundary Event Ordering Implied Correlation Errors are Messages

slide-82
SLIDE 82

Message Driven facilitates other traits

slide-83
SLIDE 83

Responsive

Asynchrony Built-in Decoupling Forces Responsive Design Amdahl’s Law & USL Contention is Evil

slide-84
SLIDE 84

Resilient

Boundaries enforce bulkheads Supervisors & Hierarchies Live Piecemeal Upgrade Localized Errors

slide-85
SLIDE 85

Elastic

Decoupling key to Scale Contention is Evil Amdahl’s Law & USL Spin Up, Down, In, & Out

slide-86
SLIDE 86

Even traditional blocking operations can be decoupled

slide-87
SLIDE 87

REST is Reactive!

slide-88
SLIDE 88 @toddlmontgomery

Request Response Processing

HTTP

Can do LOTS of stuff while waiting But what about correlating responses with requests?! Don’t I need to wait?

“Message” “Message” “Message” “Message”

slide-89
SLIDE 89 @toddlmontgomery

Request ACK Response ACK

Sync Request Sync Response Web Services

But… Async Request/Response… kinda

Message Message

http://en.wikipedia.org/wiki/List_of_web_service_specifications

No, seriously, lots of these!!

slide-90
SLIDE 90

Errors are Messages

slide-91
SLIDE 91

Mistakes & BCP

Got an error, so let’s send a new error message back… TCP RST behavior…

slide-92
SLIDE 92

Reactive Streams