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

interaction protocols
SMART_READER_LITE
LIVE PREVIEW

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

Interaction Protocols Martin Thompson - @mjpt777 Code How significant are protocols to software development? protocol noun \ pr -t - k l \ Source: http://www.merriam-webster.com/ protocol noun \ pr -t - k l \ : a


slide-1
SLIDE 1

Interaction Protocols

Martin Thompson - @mjpt777

slide-2
SLIDE 2

Code

slide-3
SLIDE 3
slide-4
SLIDE 4
slide-5
SLIDE 5

How significant are protocols to software development?

slide-6
SLIDE 6

protocol

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

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

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

slide-8
SLIDE 8

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-9
SLIDE 9

Evolutionary Biology

slide-10
SLIDE 10

Facial Expressions

slide-11
SLIDE 11

Manners & Etiquette

slide-12
SLIDE 12

Hygiene

Evolution of Communities

Disease <=>

slide-13
SLIDE 13

Hygiene Courtesy

Evolution of Communities

Disease Society <=> <=>

slide-14
SLIDE 14

Hygiene Courtesy Norms

Evolution of Communities

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

slide-15
SLIDE 15

Formal Protocols

slide-16
SLIDE 16

Rules of Engagement

slide-17
SLIDE 17

“What is acceptable” Rules of Engagement

slide-18
SLIDE 18

“What is acceptable” “Good conditions to succeed” Rules of Engagement

slide-19
SLIDE 19

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

slide-20
SLIDE 20

Concurrent & Distributed Systems

slide-21
SLIDE 21

How should components Interact?

slide-22
SLIDE 22

IETF (Internet Engineering Task Force)

slide-23
SLIDE 23
slide-24
SLIDE 24

418 “I'm a teapot”

slide-25
SLIDE 25
slide-26
SLIDE 26
slide-27
SLIDE 27
slide-28
SLIDE 28
slide-29
SLIDE 29

How should we document our protocols?

slide-30
SLIDE 30

API vs Protocol

slide-31
SLIDE 31

Open, *[Read | Write], Close

slide-32
SLIDE 32

Open, *[Read | Write], Close

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

“What could possibly go wrong?”

slide-34
SLIDE 34
slide-35
SLIDE 35

Multicast Example

slide-36
SLIDE 36

ACK / NAK Implosion

slide-37
SLIDE 37
slide-38
SLIDE 38
slide-39
SLIDE 39

Where should we focus?

slide-40
SLIDE 40

Many Aspects to Consider

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

Who cares about waste?

slide-42
SLIDE 42

Encoding

Don’t use text codecs! Please use binary codecs

slide-43
SLIDE 43

Encoding

“…but it’s human readable…”

slide-44
SLIDE 44

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-45
SLIDE 45

Encoding

SBE, Flat Buffers, Cap’n’Proto, ASN.1, etc.

slide-46
SLIDE 46

Versioning

slide-47
SLIDE 47

Versioning

  • Protocols: What conversation?
slide-48
SLIDE 48

Versioning

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

Versioning

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

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

slide-52
SLIDE 52

Sync vs Async

slide-53
SLIDE 53

Synchronous

slide-54
SLIDE 54

Synchronous

slide-55
SLIDE 55

Synchronous

slide-56
SLIDE 56

Synchronous

slide-57
SLIDE 57

Synchronous

slide-58
SLIDE 58

Synchronous

slide-59
SLIDE 59

Synchronous

slide-60
SLIDE 60

Synchronous

slide-61
SLIDE 61

Synchronous

slide-62
SLIDE 62

Synchronous

slide-63
SLIDE 63

Synchronous

slide-64
SLIDE 64

Synchronous

slide-65
SLIDE 65

Synchronous

What’s Happening?

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

slide-71
SLIDE 71

Asynchronous

slide-72
SLIDE 72

Asynchronous

slide-73
SLIDE 73

Asynchronous

slide-74
SLIDE 74

Asynchronous

slide-75
SLIDE 75

Asynchronous

slide-76
SLIDE 76

Asynchronous

slide-77
SLIDE 77

Asynchronous

slide-78
SLIDE 78

Asynchronous

slide-79
SLIDE 79

Asynchronous

slide-80
SLIDE 80

Asynchronous

What’s Happening?

slide-81
SLIDE 81

“…but, but, synchronous is so much easier...”

slide-82
SLIDE 82

Synchronous => Blocking

slide-83
SLIDE 83

...it’s about managing state via feedback

slide-84
SLIDE 84

When designing an API, wrap Async with Sync if you must 

slide-85
SLIDE 85

RPC / HTTP / TCP

slide-86
SLIDE 86

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

slide-87
SLIDE 87
slide-88
SLIDE 88

0-RTT and replay attacks

slide-89
SLIDE 89

Batching

slide-90
SLIDE 90

Etiquette of a request

slide-91
SLIDE 91

100 GigE ?

slide-92
SLIDE 92

sndmmsg, rcvmmsg() Onload, VMA DPDK, ef_vi

Future of Syscalls

slide-93
SLIDE 93

Snake Oil Protocols

slide-94
SLIDE 94

2PC / XA

slide-95
SLIDE 95
slide-96
SLIDE 96

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

slide-97
SLIDE 97

Guaranteed Delivery™

slide-98
SLIDE 98

Applications should have feedback & recovery protocols

slide-99
SLIDE 99

Protocol Layering “What can we depend on?”

slide-100
SLIDE 100

Wrapping up…

slide-101
SLIDE 101

Are protocols significant to software development?

slide-102
SLIDE 102

Question, Hypothesis, Prediction, Experiment, Analysis

slide-103
SLIDE 103

Falsifiability

slide-104
SLIDE 104

Conway’s Law

slide-105
SLIDE 105

@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