Layers Yelps Mission Connecting people with great local - - PowerPoint PPT Presentation

layers yelp s mission
SMART_READER_LITE
LIVE PREVIEW

Layers Yelps Mission Connecting people with great local - - PowerPoint PPT Presentation

Layers Yelps Mission Connecting people with great local businesses. (Abstraction) Layers (related: separation of concerns) Abstractions? "Being abstract is something profoundly different from being vague The purpose of


slide-1
SLIDE 1

Layers

slide-2
SLIDE 2

Yelp’s Mission

Connecting people with great local businesses.

slide-3
SLIDE 3
slide-4
SLIDE 4

(Abstraction) Layers

(related: separation of concerns)

slide-5
SLIDE 5

Abstractions?

"Being abstract is something profoundly different from being vague … The purpose of abstraction is not to be vague, but to create a new semantic level in which one can be absolutely precise." - Edsger Dijkstra All non-trivial abstractions, to some degree, are leaky. - Joel Spolsky Any problem in computer science can be solved with another layer of indirection. But that usually will create another problem - David Wheeler

slide-6
SLIDE 6

Danger: I don’t know as much as Rich Hickey

slide-7
SLIDE 7

Identify the Author’s Purpose

A. Persuade the audience that his/her design recommendations are better than the current status quo B. Inform others about the history of architecture decisions in computer science C. Inspire engineers to think outside the box when designing systems D. Entertain the audience with historic anecdotes E. None of the above

slide-8
SLIDE 8

DevOps

slide-9
SLIDE 9

DevOps

  • Est. 2009
slide-10
SLIDE 10

Let’s Talk About Devops

Features Wireframes Tasks Code / Unit Tests Build + Release Deployment | Monitoring | Alerting QA | Acceptance Tests PM UX Lead Dev Devs QA Release Engineering Operations

slide-11
SLIDE 11

“What if we got rid of some of the layers?”

slide-12
SLIDE 12

?

slide-13
SLIDE 13
slide-14
SLIDE 14

Let’s Talk About Devops (no-ops?)

Features Wireframes Tasks Code / Unit Tests QA | Acceptance Tests Build + Release Deployment | Monitoring | Alerting PM UX Devs

Separation Of Concerns

slide-15
SLIDE 15

Why?

  • Increased “Performance” (deploys per day)
  • Better ownership of issues
  • Harder to hire
  • Massive increase in developer complexity
  • Large inter-team communication overhead
slide-16
SLIDE 16

Filesystems

slide-17
SLIDE 17

Let’s talk about filesystems

files ext4 dm-crypt Software Raid Raw Block Devices LVM /mnt/stuff/foo /mnt/stuff /dev/mapper/luks-17c8... /dev/mapper/lv0 /dev/md0 /dev/sd{a,b}

slide-18
SLIDE 18

“What if we got rid of some of the layers?”

slide-19
SLIDE 19

Let’s talk about zfs

files zfs (zraid) (encryption) (checksums) (pools) (vdevs) Raw Block Devices /mnt/stuff/foo /mnt/stuff /dev/sd{a,b}

Separation Of Concerns

slide-20
SLIDE 20

Now What?

  • Better error detection/recovery
  • We can deduplicate things
  • More efficient snapshots / Repair
  • All new tooling is not interoperable
slide-21
SLIDE 21

New Concept: “Sympathetic Abstraction”

  • “Opposite” of “Leaky”?
  • https://mechanical-sympathy.blogspot.com/
slide-22
SLIDE 22

~ $ ssh -vv leb1.xkyle.com -- true OpenSSH_7.7p1 Ubuntu-4ubuntu0.1, OpenSSL 1.0.2n 7 Dec 2017 debug1: Reading configuration data /home/kyle/.ssh/config debug1: /home/kyle/.ssh/config line 1: Applying options for leb1.xkyle.com debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug2: resolving "leb1.xkyle.com" port 4242 debug2: ssh_connect_direct: needpriv 0 debug1: Connecting to leb1.xkyle.com [2607:8b00:0:96::d0eb:ec0a] port 4242. ... debug1: Entering interactive session. debug1: pledge: network debug2: channel_input_open_confirmation: channel 0: callback start debug2: fd 3 setting TCP_NODELAY debug2: client_session2_setup: id 0 debug1: Sending environment. debug1: Sending env LANG = en_US.UTF-8 debug2: channel 0: request env confirm 0 debug1: Sending command: true ... Transferred: sent 2696, received 2516 bytes, in 0.1 seconds Bytes per second: sent 23959.5, received 22359.8 debug1: Exit status 0

slide-23
SLIDE 23

https://docs.datastax.com/en/cassandra/3.0/cassandra/configuration/configCassandra_yaml.html?hl=commitlog_sync commit_failure_policy (Default: stop) Policy for commit disk failures:

  • die
  • Shut down gossip and Thrift and kill the JVM, so the node can be replaced.
  • stop
  • Shut down gossip and Thrift, leaving the node effectively dead, available for inspection using JMX.
  • stop_commit
  • Shut down the commit log, letting writes collect but continuing to service reads (as in pre-2.0.5 Cassandra).
  • ignore
  • Ignore fatal errors and let the batches fail.

disk_optimization_strategy (Default: ssd) The strategy for optimizing disk reads. Possible values: ssd or spinning. disk_failure_policy (Default: stop) Sets how Cassandra responds to disk failure. Recommend settings: stop or best_effort. Valid values:

  • die
  • Shut down gossip and Thrift and kill the JVM for any file system errors or single SSTable errors, so the node can be

replaced.

  • stop_paranoid
slide-24
SLIDE 24

Kyle’s Abstraction Law:

“Over time, layers tend toward becoming more sympathetic (or merged) in the pursuit of performance.”

slide-25
SLIDE 25

HTTP(S)

slide-26
SLIDE 26
slide-27
SLIDE 27

OSI Layer Model History

  • Published in 1984 under ISO7498 (35 years ago)
  • Mostly by Charles Bachman from his experience with ARPANET, etc
  • Written with the purpose of giving protocol designers a Map to follow
slide-28
SLIDE 28
slide-29
SLIDE 29

Layer 6: Presentation Layer 5: Session Layer 4: Transport Layer 2: Data link Layer 1: Physical Layer 3: Network SSL N/A (Right? HTTP is “stateless”) TCP (Transmission Control Protocol) IP (Internet Protocol) 802.11 (Wi-Fi?) 802.11 (Wi-Fi?) Layer 7: Application HTTP (Hypertext Transfer Protocol)

HTTPS in the OSI Network Model

slide-30
SLIDE 30

https://en.wikipedia.org/wiki/Internet_protocol_suite#Comparison_of_TCP/IP_and_OSI_layering

The IETF protocol development effort is not concerned with strict layering. Some of its protocols may not fit cleanly into the OSI model, although RFCs sometimes refer to it and often use the old OSI layer numbers. The IETF has repeatedly stated that Internet protocol and architecture development is not intended to be OSI-compliant. RFC 3439, addressing Internet architecture, contains a section entitled: "Layering Considered Harmful".

slide-31
SLIDE 31

RFC 1122, Internet STD 3 (1989) Cisco Academy[28] Kurose,[29] Forouzan[30] Comer,[31] Kozierok[32] Stallings[33] Arpanet Reference Model (RFC 871) OSI model Four layers Four layers Five layers Four+one layers Five layers Three layers Seven layers "Internet model" "Internet model" "Five-layer Internet model" or "TCP/IP protocol suite" "TCP/IP 5-layer reference model" "TCP/IP model" "Arpanet reference model" OSI model Application Application Application Application Application Application/Process Application Presentation Session Transport Transport Transport Transport Host-to-host or transport Host-to-host Transport Internet Internetwork Network Internet Internet Network Link Network interface Data link Data link (Network interface) Network access Network interface Data link Physical (Hardware) Physical Physical

slide-32
SLIDE 32

Layer 6: Presentation Layer 5: Session Layer 4: Transport Layer 2: Data link Layer 1: Physical Layer 3: Network SSL N/A (Right? HTTP is “stateless”) TCP (Transmission Control Protocol) IP (Internet Protocol) 802.11 (Wi-Fi?) 802.11 (Wi-Fi?) Layer 7: Application HTTP (Hypertext Transfer Protocol)

HTTP in the OSI Network Model

slide-33
SLIDE 33

“What if we got rid of some of the layers?”

slide-34
SLIDE 34

Transport Layer (OSI 4) Link Layer (OSI 1,2) Internet Layer (OSI 3) UDP (User Datagram Protocol) IP (Internet Protocol) 802.11 (Wi-Fi) Application Layer (OSI 5,6,7) Encryption Sessions Multiplexing Error Correction QUIC (Quick UDP Internet Connections)

QUIC in the IP Model

Separation Of Concerns

slide-35
SLIDE 35
slide-36
SLIDE 36

Now What?

  • Roaming sessions
  • 0-RRT Handshakes
  • Better throughput
  • Better loss recovery
  • You can’t debug via tcpdump anymore!
  • Only a few companies has dared to ship this!
  • Very poor tooling / ecosystems around it!
  • Must have faith in QUIC-crypto!
slide-37
SLIDE 37

(Micro) Services

slide-38
SLIDE 38

Rails App Model View Controller Users Mysql

slide-39
SLIDE 39

“What if we ADDED some more layers?”

slide-40
SLIDE 40

Users API Gateway Users Service Search Tweets Ads Moments Ads Mysql User Mysql Search Infra

Moments SQL

Tweets NoSQL Followers

Graph DB

Timeline

slide-41
SLIDE 41
slide-42
SLIDE 42
slide-43
SLIDE 43

Now What?

  • No more atomic cross-cutting changes
  • Simplified deploy process? (Simple for who?)
  • Polyglot stack (easy to hire for)
  • No more unified tooling
  • You scale out components (scale to millions of rps)
  • You scale out development (1000 engineers)
slide-44
SLIDE 44
slide-45
SLIDE 45

k8s

slide-46
SLIDE 46

Layer 3: Application Code Layer 1: IaaS VM Layer 0: IaaS Provider Bare Metal Layer 2: OS Java Jar Ubuntu x86_64 c5.xlarge N/A

Traditional Cloud Deployment

slide-47
SLIDE 47

“What if we ADDED EVEN MORE layers?”

slide-48
SLIDE 48

Layer 4: Pod Layer 3: Container Orchestration Layer 1: IaaS VM Layer 0: IaaS Provider Bare Metal Layer 2: OS pod-foo kublet Ubuntu x86_64 c5.xlarge N/A

Layers of a k8s Infra

Layer 5: Container docker Layer 6: Process java -jar

slide-49
SLIDE 49

Layer 5: k8s federation Layer 4: k8s cluster Layer 3: Deployment / ReplicaSet Layer 1: Docker Container Layer 0: Process Layer 2: Pod Prod k8s federation uswest1-prod Frontend replicaset myapp-pod FROM apache2 httpd

K8s Layers

slide-50
SLIDE 50

“What if we got rid of some of the layers?”

slide-51
SLIDE 51

AWS Metal Instances

slide-52
SLIDE 52

Layer 0/1: IaaS Provider Bare Metal Hardware

Future Layers

slide-53
SLIDE 53

Layer 0/1: IaaS Provider Bare Metal Hardware

Future Layers Extreme Example - Unikernels?

Layer 2-7: Unikernel (No OS, just a directly booting application) MirageOS, etc

slide-54
SLIDE 54

Layer 0/1: IaaS Provider Bare Metal Hardware

Future Layers - AWS Lambda / FaaS?

Layer 2-5: Amazon / k8s Stuff Same Stuff As Before Layer 7: Your Process Your Code Layer 6: Container Firecracker / Docker

slide-55
SLIDE 55

What? We Are Back To Where We Started?

  • Where is the mechanical sympathy?
  • What happened to Layer-Smashing, Kyle?
  • Three Reasons why we are moving this direction...
slide-56
SLIDE 56

Layer 0/1: IaaS Provider Bare Metal Hardware

Reason 1: You have a layer for just the stuff you care about

Layer 2-5: Amazon / k8s Stuff Same Stuff As Before Layer 7: Your Process Your Code Layer 6: Container Firecracker / Docker

slide-57
SLIDE 57

k8s pods Apache API Gateway + FaaS Controller (Request Routing) (Compute Dispatch)

Reason 2: Sympathetic routing and dispatch Or “Functions as a Service (Serverless)” Layer Smashing

Autoscaling Group (Compute Dispatch) Apache Elastic Load Balancer (Request Routing) Apache

slide-58
SLIDE 58

Reason 3: Sympathetic Compute Scheduling Layers (k8s operators)

Autoscaling Group MySQL MySQL ? K8s MySQL Operator MySQL MySQL

I know what I must do

slide-59
SLIDE 59
slide-60
SLIDE 60

Conclusions?

  • 1. “Sympathetic Layers” are the best layers!
  • 2. k8s operators and FaaS as re-slicing where the layers are

(for the greater good!)

  • 3. You should watch “Simple Made Easy” before changing

your mind

https://www.infoq.com/presentations/Simple-Made-Easy

slide-61
SLIDE 61

Hold for (shameless) applause, Then Questions?

SEPARATION OF CONCERNS IS OVERRATED

slide-62
SLIDE 62
slide-63
SLIDE 63
slide-64
SLIDE 64

Attribution

  • OSI Layers - http://www.gargasz.info/osi-model-how-internet-works/
  • Simple Made Easy - The Art of Unix Programming (2003) - Eric S. Raymond
slide-65
SLIDE 65

X

slide-66
SLIDE 66

Linux Kernel GPU X Server

X Client (GUI App) X11 Protocol over Socket /tmp/.X11-unix/X0 Ioctl via libdrm /dev/dri/card0 3d Game Ioctl via libdrm /dev/dri/card0 Window Manager

slide-67
SLIDE 67

“Mechanism, not policy”

slide-68
SLIDE 68
slide-69
SLIDE 69

“What if we got rid of some of the layers?”

slide-70
SLIDE 70
slide-71
SLIDE 71

Now What?

  • Lower latency GUI Interactions
  • NO TEARING