Interaction Protocols Martin Thompson - @mjpt777 Code Are - - PowerPoint PPT Presentation

interaction protocols
SMART_READER_LITE
LIVE PREVIEW

Interaction Protocols Martin Thompson - @mjpt777 Code Are - - PowerPoint PPT Presentation

Interaction Protocols Martin Thompson - @mjpt777 Code Are protocols the most significant human discovery? protocol noun \ pr -t - k l \ Source: http://www.merriam-webster.com/ protocol noun \ pr -t - k l \ : a code


slide-1
SLIDE 1

Interaction Protocols

Martin Thompson - @mjpt777

slide-2
SLIDE 2

Code

slide-3
SLIDE 3
slide-4
SLIDE 4

Are protocols the most significant human discovery?

slide-5
SLIDE 5

protocol

noun \ ˈprō-tə-ˌkȯl \

Source: http://www.merriam-webster.com/

slide-6
SLIDE 6

protocol

noun \ ˈprō-tə-ˌkȯl \ : a code prescribing strict adherence to correct etiquette and precedence

Source: http://www.merriam-webster.com/

slide-7
SLIDE 7

protocol

noun \ ˈprō-tə-ˌkȯl \ : a code prescribing strict adherence to correct etiquette and precedence : a set of conventions governing the treatment and formatting of data in an electronic communications system

Source: http://www.merriam-webster.com/

slide-8
SLIDE 8

Evolutionary Biology

slide-9
SLIDE 9

Facial Expressions

slide-10
SLIDE 10

Etiquette & Manners

slide-11
SLIDE 11

Hygiene Courtesy Norms

Evolution of Communities

Disease Society Trust <=> <=> <=>

slide-12
SLIDE 12

Rules of Engagement “What is acceptable” “Good conditions to succeed” “Jus ad bellum, Jus ad bello”

slide-13
SLIDE 13

Concurrent & Distributed Systems

slide-14
SLIDE 14

How to Interact

slide-15
SLIDE 15

IETF (Internet Engineering Task Force)

slide-16
SLIDE 16
slide-17
SLIDE 17

418 “I'm a teapot”

slide-18
SLIDE 18
slide-19
SLIDE 19
slide-20
SLIDE 20
slide-21
SLIDE 21
slide-22
SLIDE 22

How should we document our protocols?

slide-23
SLIDE 23

API vs Protocol

slide-24
SLIDE 24

Open, *[Read | Write], Close

slide-25
SLIDE 25

Open, *[Read | Write], Close

  • 1. Open: ...
  • 2. Read: ...
  • 3. Write: ...
  • 4. Close: ...
slide-26
SLIDE 26

Think events and then consider: pre, post, and invariant conditions

slide-27
SLIDE 27

“What can go wrong?”

slide-28
SLIDE 28

Multicast Example

slide-29
SLIDE 29

ACK / NAK Implosion

slide-30
SLIDE 30
slide-31
SLIDE 31
slide-32
SLIDE 32

Where should we focus?

slide-33
SLIDE 33

Many Aspects to Consider

  • Layering
  • Versioning
  • Encoding
  • Addressing
  • Error Handling
  • Flow Control
  • Congestion Control
  • Feedback
  • Sequencing
  • Batching
  • Sync/Async
  • Validation
  • Trust
  • Privacy
slide-34
SLIDE 34

Encoding

Don’t use text codecs! Please use binary codecs

slide-35
SLIDE 35

0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-------------------------------------------------------------+ |R| Frame Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-------------------------------+ | Version |B|E| Flags | Type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-------------------------------+ |R| Term Offset | +-+-------------------------------------------------------------+ | Session ID | +---------------------------------------------------------------+ | Stream ID | +---------------------------------------------------------------+ | Term ID | +---------------------------------------------------------------+ | Encoded Message ... ... | +---------------------------------------------------------------+

slide-36
SLIDE 36

Versioning

slide-37
SLIDE 37

Versioning/Identity

  • Protocols: What conversation?
slide-38
SLIDE 38

Versioning/Identity

  • Protocols: What conversation?
  • Messages: What encoding?
slide-39
SLIDE 39

Versioning/Identity

  • Protocols: What conversation?
  • Messages: What encoding?
  • State: What instance?
slide-40
SLIDE 40

MPMC Queue http://www.1024cores.net/

slide-41
SLIDE 41
slide-42
SLIDE 42

Sync vs Async

slide-43
SLIDE 43

Synchronous

slide-44
SLIDE 44

Synchronous

slide-45
SLIDE 45

Synchronous

slide-46
SLIDE 46

Synchronous

slide-47
SLIDE 47

Synchronous

slide-48
SLIDE 48

Synchronous

slide-49
SLIDE 49

Synchronous

slide-50
SLIDE 50

Synchronous

slide-51
SLIDE 51

Synchronous

slide-52
SLIDE 52

Synchronous

slide-53
SLIDE 53

Synchronous

slide-54
SLIDE 54

Synchronous

slide-55
SLIDE 55

Synchronous

What’s Happening?

slide-56
SLIDE 56

Asynchronous

slide-57
SLIDE 57

Asynchronous

slide-58
SLIDE 58

Asynchronous

slide-59
SLIDE 59

Asynchronous

slide-60
SLIDE 60

Asynchronous

slide-61
SLIDE 61

Asynchronous

slide-62
SLIDE 62

Asynchronous

slide-63
SLIDE 63

Asynchronous

slide-64
SLIDE 64

Asynchronous

slide-65
SLIDE 65

Asynchronous

slide-66
SLIDE 66

Asynchronous

slide-67
SLIDE 67

Asynchronous

slide-68
SLIDE 68

Asynchronous

slide-69
SLIDE 69

Asynchronous

slide-70
SLIDE 70

Asynchronous

What’s Happening?

slide-71
SLIDE 71

But, but, synchronous is much easier...

slide-72
SLIDE 72

...it’s all about feedback and managing state

slide-73
SLIDE 73

Events model the real world, i.e. it’s distributed

slide-74
SLIDE 74

When designing an API provide Async with an Sync wrapper if you must

slide-75
SLIDE 75

RPC / HTTP / TCP

slide-76
SLIDE 76

TCP → TCP Fast Open → QUIC HTTP/1.1 → SPDY → HTTP/2 TLS 1.2 → TLS 1.3

slide-77
SLIDE 77
slide-78
SLIDE 78

Batching

slide-79
SLIDE 79

Etiquette of a request

slide-80
SLIDE 80

100 GigE ?

slide-81
SLIDE 81

Syscalls

slide-82
SLIDE 82

sndmmsg, rcvmmsg() Onload, VMA DPDK, ef_vi, RDMA Verbs

Future of Syscalls

slide-83
SLIDE 83

Natural Batching & Mechanical Sympathy

slide-84
SLIDE 84

ORMs vs SQL

slide-85
SLIDE 85

Snake Oil Protocols

slide-86
SLIDE 86

2PC / XA

slide-87
SLIDE 87
slide-88
SLIDE 88

“Two-Phase Commit is not fault tolerant because it uses a single coordinator whose failure can cause the protocol to block”

slide-89
SLIDE 89

Protocols requiring arbitration

slide-90
SLIDE 90

Guaranteed Delivery™

slide-91
SLIDE 91

Applications should have feedback & recovery protocols

slide-92
SLIDE 92

Protocol Layering Depend on behaviour, not implementation

slide-93
SLIDE 93

Wrapping up…

slide-94
SLIDE 94

Are protocols the most significant human discovery?

slide-95
SLIDE 95

Question, Hypothesis, Prediction, Experiment, Analysis

slide-96
SLIDE 96
slide-97
SLIDE 97

Why are protocols not studied and practiced more?

slide-98
SLIDE 98

Your next project =>

  • 1. Frameworks? ⊕ Protocols?
  • 2. ...
slide-99
SLIDE 99

@mjpt777 https://github.com/real-logic/aeron “A distributed system is one in which the failure

  • f a computer you didn't even know existed

can render your own computer unusable.”

  • Leslie Lamport

Questions?