Embracing Concurrency at scale (its about time!) Justin Sheehy - - PowerPoint PPT Presentation

embracing concurrency at scale
SMART_READER_LITE
LIVE PREVIEW

Embracing Concurrency at scale (its about time!) Justin Sheehy - - PowerPoint PPT Presentation

Embracing Concurrency at scale (its about time!) Justin Sheehy justin@basho.com Concurrency Matters "The free lunch is over." - Herb Sutter, 2005 Concurrency Matters You got a free lunch!? "The free lunch is over."


slide-1
SLIDE 1

Embracing Concurrency at scale

(it’s about time!)

Justin Sheehy

justin@basho.com

slide-2
SLIDE 2

Concurrency Matters

"The free lunch is over."

  • Herb Sutter, 2005
slide-3
SLIDE 3

Concurrency Matters

"The free lunch is over."

  • Herb Sutter, 2005

You got a free lunch!?

slide-4
SLIDE 4

New Problems, Old Solutions

Distributed Systems matter now more than ever, and we must learn from the past to build the future.

slide-5
SLIDE 5

Don't do what I say. (yet)

Working at scale isn't just "more." It is different.

slide-6
SLIDE 6

What is Concurrency?

concurrent: occurring at the same time concurring: agreeing with others

slide-7
SLIDE 7

Time is a Hard Problem

Einstein, Minkowski, Schwarzschild...

slide-8
SLIDE 8

Time in Computing

Lamport, 1978 -- gave us “happened before” Mattern, 1989 -- closer to Minkowski causality

slide-9
SLIDE 9

Time is a Hard Problem

In computing, we like to pretend it’s easy. This is a trap!

slide-10
SLIDE 10

Distributed Computing is Asynchronous Computing

Synchrony (distributed transactions) throws away the biggest gains of being distributed!

slide-11
SLIDE 11

Three Kinds of Computing

memories: at time T, I learned fact F guesses: based on my memories, I will try G apologies: G didn't work out, oops

  • Pat Helland
slide-12
SLIDE 12

There is no “Global State”

You only know about the past -- deal with it! This sadly often means giving up on ACID. (globally, not locally) This is going to hurt!

slide-13
SLIDE 13

Atomicity lly-Consistent tent Consistency Isolation Durability

slide-14
SLIDE 14

Atomicity lly-Consistent tent Consistency Isolation Durability Available Basically

slide-15
SLIDE 15

Atomicity lly-Consistent tent Consistency Isolation Durability Available Basically Soft State

slide-16
SLIDE 16

Atomicity lly-Consistent tent Consistency Isolation Durability Available Basically Soft State Eventually-Consistent

slide-17
SLIDE 17

lly-Consistent tent Available Basically Soft State Eventually-Consistent

This is a real tradeoff -- if you make it, understand it!

(Eric Brewer, 1997)

slide-18
SLIDE 18

CAP tradeoffs

Consistency Availability Partition-Tolerance

You want all three, but you can’t have them all at once.

slide-19
SLIDE 19

CAP tradeoffs

Consistency Availability Partition-Tolerance

Distributed Transactions (on any real network, this fails)

slide-20
SLIDE 20

CAP tradeoffs

Consistency Availability Partition-Tolerance

Quorum Protocols & typical Distributed Databases (nodes outside the quorum fail)

slide-21
SLIDE 21

CAP tradeoffs

Consistency Availability Partition-Tolerance

Sometimes allow stale data... ...but everything can keep going.

slide-22
SLIDE 22

CAP tradeoffs

Consistency Availability Partition-Tolerance

This is where leads us. BASE

slide-23
SLIDE 23

lly-Consistent tent Available Basically Soft State Eventually-Consistent

This is a real tradeoff -- if you make it, understand it!

B A S E

slide-24
SLIDE 24

lly-Consistent tent Eventually-Consistent Eventually-Consistent doesn’t mean “not consistent”!

It also doesn't mean slow. BASE and DIRT are not in conflict! Sometimes you go "eventual" in order to go fast. It just forces you to remember that everything is probabilistic.

slide-25
SLIDE 25

RPC is a scaling antipattern.

Treating remote communication like local function calls is a fundamentally bad abstraction.

  • Network can fail after call “succeeds”.
  • Data copying cost can be hard to predict.
  • Tricks you by working locally.
  • Prevents awareness of swimlanes.

(and then failing in a real dist sys) (and thus causes cascading failure)

slide-26
SLIDE 26

Protocols vs. APIs

  • Explicit understanding of boundaries.
  • Better re-use and composition.
  • Asynchronous reality, described accurately.

(trust boundaries, failure boundaries...) (unintuitive but true in the large) (see Clojure or Erlang/OTP libraries)

slide-27
SLIDE 27

Successful Protocols

Kings of the Internet: DNS & HTTP

What do they have in common?

B A S E

slide-28
SLIDE 28

The Web

  • no global state (closest: DNS root & MIME)
  • well-defined caching for eventual consistency
  • idempotent operations!
  • loose coupling
  • links instead of global relations
  • no must-understands except HTTP

(the second most successful distributed system ever)

slide-29
SLIDE 29

History of Scaling The Web

HTTP App DB HTTP HTTP HTTP HTTP App App Eek! Help from "NoSQL"?

slide-30
SLIDE 30

Scalable

"I can add twice as much X to get twice as much Y."

30

computers write-throughput! storage capacity! map/red power!

Linearly

slide-31
SLIDE 31

31

Measurement

Today’s networked world is full of cascading implicit and explicit SLAs Reason about your behavior, but also measure it in production.

slide-32
SLIDE 32

32

Measurement

In dist. sys. if you don't measure everything, then you’ll pick the wrong bottlenecks. Measure your systems top to bottom, and correlate information cross-system.

slide-33
SLIDE 33

33

Resilient

Assume that failures will happen. Designing whole systems and components with individual failures in mind is a plan for predictable success. At scale, they are ALWAYS happening.

slide-34
SLIDE 34

34

Know How You Degrade

You might prevent whole system failure if you’re lucky and good, but what happens during partial failure? Plan it and understand it before your users do.

slide-35
SLIDE 35

35

Know How You Degrade

Plan it and understand it before your users do. You think you know which parts will break.

slide-36
SLIDE 36

36

Know How You Degrade

Plan it and understand it before your users do. You think you know which parts will break. You are wrong.

slide-37
SLIDE 37

37

Harvest and Yield

harvest: a fraction

data available / complete data

yield: a probability

queries completed / q's requested

in tension with each other: (harvest * yield) ~ constant goal: failures cause known linear reduction to one of these

slide-38
SLIDE 38

38

Harvest and Yield

traditional ACID demands 100% harvest but success of modern applications is

  • ften measured in yield

plan ahead, know when you care!

slide-39
SLIDE 39

39

Sometimes, you will fail.

Being able to recover quickly from failure is more important than having failures less often.

Plan it and understand it before your users do.

  • John Allspaw

If you think you can prevent failure, then you aren’t developing your ability to respond.

  • Paul Hammond
slide-40
SLIDE 40

40

Sometimes, you will fail.

Plan it and understand it before your users do. Applications built for scale can make recovery either easier or harder. You get to choose.

slide-41
SLIDE 41

41

two things to make it easier:

minimal, async interfaces when possible locality of computation and reasoning

slide-42
SLIDE 42

Embracing Concurrency at scale

(it’s about time!)

Justin Sheehy

justin@basho.com