life beyond the illusion of present

89
Life BEYOND the ILLUSION of PRESENT Jonas Bonér CTO Typesafe @jboner

Upload: jonas-boner

Post on 28-Jul-2015

10.292 views

Category:

Technology


10 download

TRANSCRIPT

Page 1: Life Beyond the Illusion of Present

Life BEYONDthe ILLUSIONof PRESENT

Jonas BonérCTO Typesafe

@jboner

Page 2: Life Beyond the Illusion of Present

"Time is what prevents everything from happening at once."- John Archibald Wheeler

Page 3: Life Beyond the Illusion of Present

Newton's PHYSICS

Page 4: Life Beyond the Illusion of Present

THIS SIMPLIFIED MODEL ISVERY APPEALING TO US

Page 5: Life Beyond the Illusion of Present

von NeumannARCHITECTURE

Page 6: Life Beyond the Illusion of Present

BACK THENLIFE WAS GOOD

Page 7: Life Beyond the Illusion of Present

THEN, ALONG CAMECONCURRENCYMADE LIFE MISERABLE

Page 8: Life Beyond the Illusion of Present

Jim Gray'sTRANSACTIONSSAVE THE DAY

Page 9: Life Beyond the Illusion of Present
Page 10: Life Beyond the Illusion of Present

WELL, ALONG CAMEDISTRIBUTIONMADE LIFE MISERABLE, again...

Page 11: Life Beyond the Illusion of Present

But don't be surprisedUNFORTUNATELY,THIS IS NOTHOW THE WORLD WORKS

Page 12: Life Beyond the Illusion of Present

"The future is a function of the past."- A. P. Robertson

Page 13: Life Beyond the Illusion of Present

"The (local) present is a merge function of multiple concurrent pasts."

— Me

Page 14: Life Beyond the Illusion of Present

val newLocalPresent = observedPasts. foldLeft(oldLocalPresent) { _ merge _ }

Page 15: Life Beyond the Illusion of Present

WE NEED TO EXPLICITLY MODEL THE

LOCAL PRESENT ASFACTS DERIVED FROM THEMERGING OF MULTIPLECONCURRENT PASTS

Page 16: Life Beyond the Illusion of Present

INFORMATION IS ALWAYS FROM THE PAST

Page 17: Life Beyond the Illusion of Present

THE TRUTHIS CLOSER TOEINSTEIN'S

PHYSICS

Page 18: Life Beyond the Illusion of Present

INFORMATION HAS

LATENCY

Page 19: Life Beyond the Illusion of Present

THE COST OF MAINTAININGTHIS ILLUSION IS INCREASED

CONTENTION &COHERENCY

Page 20: Life Beyond the Illusion of Present

AS LATENCY GETS HIGHER, THEILLUSION CRACKS EVEN MORE

Page 21: Life Beyond the Illusion of Present

DISTRIBUTED SYSTEMSEVERYWHERE

Page 22: Life Beyond the Illusion of Present

THE NETWORK IS RELIABLE...NAT

Page 23: Life Beyond the Illusion of Present

"If a tree falls in a forest and no one is around to hear it, does it make a sound?"

— Charles Riborg Mann

Page 24: Life Beyond the Illusion of Present

Information CAN (and will) GET LOST

Page 25: Life Beyond the Illusion of Present

HOW DO WE DEAL WITHINFORMATION LOSSIN REAL LIFE?

Page 26: Life Beyond the Illusion of Present

WE USE A SIMPLE PROTOCOL OFConfirm, Wait & Repeat

Page 27: Life Beyond the Illusion of Present

We fill in THE BLANKS

Page 28: Life Beyond the Illusion of Present

...AND IF WE ARE WRONG, WE TAKECOMPENSATING ACTIONAPOLOGY-ORIENTED PROGRAMMING - PAT HELLAND (IN MEMORIES, GUESSES, AND APOLOGIES)

Page 29: Life Beyond the Illusion of Present

The bottom line:WE CAN'T FORCE THE WORLD INTO A

SINGLE GLOBALLY CONSISTENT

PRESENT

Page 30: Life Beyond the Illusion of Present

Should we just GIVE UP?

Page 31: Life Beyond the Illusion of Present

I BELIEVE THAT THERE IS APATH FORWARD

Page 32: Life Beyond the Illusion of Present

WE NEED TO TREATTIME AS A

FIRST CLASS CONSTRUCT

Page 33: Life Beyond the Illusion of Present

WHAT IS TIME, really?

Page 34: Life Beyond the Illusion of Present

TIME IS THESUCCESSION OFCAUSALLY RELATED EVENTS

Page 35: Life Beyond the Illusion of Present

How can weMANAGETIME?

Page 36: Life Beyond the Illusion of Present

Think in FACTS

Page 37: Life Beyond the Illusion of Present

What is aFACT?

Page 38: Life Beyond the Illusion of Present

"A Fact is something that truly exists or happens: something that has actual existence, a true piece of information."

— Merriam Webster

Page 39: Life Beyond the Illusion of Present

IMMUTABILITYis a requirement

Page 40: Life Beyond the Illusion of Present

So, do variablesHAVE A PURPOSE IN LIFE?

Page 41: Life Beyond the Illusion of Present

"The assignment statement is the von Neumann bottleneck of programming languages and keeps us thinking in word-at-a-time terms

in much the same way the computer's bottleneck does."— John Backus (Turing Award lecture 1977)

Page 42: Life Beyond the Illusion of Present

MUTABLE STATENEEDS TO BECONTAINED

Page 43: Life Beyond the Illusion of Present

Ok, but how should weMANAGE FACTS?

Page 44: Life Beyond the Illusion of Present

FunctionalPROGRAMMING

Page 45: Life Beyond the Illusion of Present

LogicPROGRAMMING

Page 46: Life Beyond the Illusion of Present

DataflowPROGRAMMING

Page 47: Life Beyond the Illusion of Present

NEVERDELETEFACTS

Page 48: Life Beyond the Illusion of Present

"When bookkeeping was done with clay tablets or paper and ink, accountants developed some clear rules about good accounting practices. One never alters the books; if an error is made, it is

annotated and a new compensating entry is made in the books. The books are thus a complete history of the transactions of the business. Update-in-place strikes many systems designers as a cardinal sin: it violates traditional accounting practices that have been observed for

hundreds of years."— Jim Gray (1981)

Page 49: Life Beyond the Illusion of Present

CRUD

Page 50: Life Beyond the Illusion of Present

"Database is a cache of a subset of the log."— Pat Helland (2007)

Page 51: Life Beyond the Illusion of Present

Store facts in anEVENT LOG

Page 52: Life Beyond the Illusion of Present

The log allows

TIMETRAVEL

Page 53: Life Beyond the Illusion of Present

Can we REWRITE THE PAST?

Page 54: Life Beyond the Illusion of Present

Allows us to shift our focus from

DATA AT REST, toDATA IN MOTION

Page 55: Life Beyond the Illusion of Present

Stream Processing

Page 56: Life Beyond the Illusion of Present

CONSTRUCTING A SUFFICIENTLY CONSISTENT

LOCAL PRESENTMEANS EMPLOYING

CONSISTENCY MECHANISMS

Page 57: Life Beyond the Illusion of Present

ConsistencyWHAT?WHY?

WHEN?

Page 58: Life Beyond the Illusion of Present

WE NEED TO DECOMPOSE THE SYSTEM USINGCONSISTENCY BOUNDARIES

Page 59: Life Beyond the Illusion of Present

INSIDE DATA: OUR CURRENT PRESENTOUTSIDE DATA: BLAST FROM THE PASTBETWEEN SERVICES: HOPE FOR THE FUTURE

— PAT HELLAND (DATA ON THE INSIDE VS DATA ON THE OUTSIDE)

Page 60: Life Beyond the Illusion of Present

MicroSERVICE

Page 61: Life Beyond the Illusion of Present

AGGREGATE Root

Page 62: Life Beyond the Illusion of Present

WITHIN THE CONSISTENCY BOUNDARY

Page 63: Life Beyond the Illusion of Present

EVENTSourcing

Page 64: Life Beyond the Illusion of Present

BETWEEN THEConsistencyBoundariesIT'S A ZOO

Page 65: Life Beyond the Illusion of Present

Decoupling in

TIME / SPACE

Page 66: Life Beyond the Illusion of Present

STRONGCONSISTENCYThe wrong default

Page 67: Life Beyond the Illusion of Present

Here, we are living in theLOOMING SHADOW OF

IMPOSSIBILITYTHEOREMS

Page 68: Life Beyond the Illusion of Present

FLPCONSENSUS IS IMPOSSIBLE

Page 69: Life Beyond the Illusion of Present

PROTOCOLS CLIMB THE LADDER OF KNOWLEDGECɸ: Common Knowledge (infinite number of i)

Eiɸ: (Everyone knows * i) ɸE3ɸ: (Everyone knows * 3) ɸ

E2ɸ: Everyone knows Everyone knows ɸE1ɸ: Everyone knows ɸSɸ: Someone knows ɸ

Page 70: Life Beyond the Illusion of Present

COMMON KNOWLEDGEIS NOT ATTAINABLE VIA PROTOCOL

- JOSEPH HALPERN

Page 71: Life Beyond the Illusion of Present

CAPCONSISTENCY IS IMPOSSIBLE

Page 72: Life Beyond the Illusion of Present

Dissecting

CAP

Page 73: Life Beyond the Illusion of Present

"The first principle of successful scalability is to batter the consistency mechanisms down to a minimum."

– James Hamilton

Page 74: Life Beyond the Illusion of Present

EVENTUALCONSISTENCY

What does it really mean?

Page 75: Life Beyond the Illusion of Present

Tracking TIME is tracking CAUSALITY

Page 76: Life Beyond the Illusion of Present

RELYING ONTIMESTAMPSIS A BAD IDEA

Page 77: Life Beyond the Illusion of Present

Instead, rely onLOGICAL TIME

Page 78: Life Beyond the Illusion of Present

LamportCLOCKS

GLOBAL CAUSAL ORDERING BETWEEN

Page 79: Life Beyond the Illusion of Present

VectorCLOCKS

PARTIAL CAUSAL ORDERING BETWEEN EVENTS

Page 80: Life Beyond the Illusion of Present

CausalCONSISTENCY

Page 81: Life Beyond the Illusion of Present

WhatCONSISTENCY

DO YOU REALLY NEED AND

when?

Page 82: Life Beyond the Illusion of Present

ACID 2.0ASSOCIATIVE

COMMUTATIVEIDEMPOTENTDISTRIBUTED

Page 83: Life Beyond the Illusion of Present

CONFLICT-FREE REPLICATED DATA TYPES

Page 84: Life Beyond the Illusion of Present

DISORDERLY PROGRAMMINGCALM THEOREM

Page 85: Life Beyond the Illusion of Present

WE ARE JUST GETTING STARTED

Page 86: Life Beyond the Illusion of Present

WE HAVE A LONG ROAD AHEAD OF US...

Page 87: Life Beyond the Illusion of Present
Page 88: Life Beyond the Illusion of Present

ThanksFOR LISTENING

Page 89: Life Beyond the Illusion of Present

Life BEYONDthe ILLUSIONof PRESENT

Jonas BonérCTO Typesafe

@jboner