Slide 1

Slide 1 text

we don’t know HTTP Konstantin Haase

Slide 2

Slide 2 text

@konstantinhaase (I’m sorry about that) rkh on github

Slide 3

Slide 3 text

Sinatra Rack, Tilt, Rubinius, ...

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

RFC 2616

Slide 7

Slide 7 text

Performance

Slide 8

Slide 8 text

Scalability

Slide 9

Slide 9 text

Security

Slide 10

Slide 10 text

Interoperability

Slide 11

Slide 11 text

HTTP has been made for this

Slide 12

Slide 12 text

We just don’t know.

Slide 13

Slide 13 text

Database Application Server

Slide 14

Slide 14 text

Database Application Server Application Application

Slide 15

Slide 15 text

Database Application Server Application Application Database Database

Slide 16

Slide 16 text

Database Application Server Application Application Database Database Cache

Slide 17

Slide 17 text

Database Application Server Application Application Database Database Cache Cache

Slide 18

Slide 18 text

Database Application Server Application Application Database Database Cache Cache Cache

Slide 19

Slide 19 text

Database Application Server Application Application Database Database Cache Cache Cache Cache Cache Cache

Slide 20

Slide 20 text

Database Application Server Application Application Database Database !!! Cache !!! !!! Cache !!! !!! Cache !!! !!! Cache !!! !!! Cache !!! !!! Cache !!!

Slide 21

Slide 21 text

How to scale further?

Slide 22

Slide 22 text

Requests Resources Representation

Slide 23

Slide 23 text

GET / HTTP/1.1 Accept: text/html

Slide 24

Slide 24 text

Optimizing Requests

Slide 25

Slide 25 text

Persistent Connections

Slide 26

Slide 26 text

Pipelining

Slide 27

Slide 27 text

SPDY

Slide 28

Slide 28 text

HTTP 2.0

Slide 29

Slide 29 text

Optimizing Resources

Slide 30

Slide 30 text

aka RFC 2616 - The Good Parts

Slide 31

Slide 31 text

GET, HEAD, OPTIONS, TRACE PUT, DELETE POST, PATCH

Slide 32

Slide 32 text

1 GET / Repeatable! :) No state change! :) Deterministic! :)

Slide 33

Slide 33 text

1 2 PUT / 2 PUT / 2 Repeatable! :) State change! :( Deterministic! :)

Slide 34

Slide 34 text

1 DELETE / DELETE / Repeatable! :) State change! :( Deterministic! :)

Slide 35

Slide 35 text

1 2 PATCH / +1 3 PATCH / +1 Not repeatable! :( State change! :( Deterministic! :)

Slide 36

Slide 36 text

Not repeatable! :( State change! :( Non-deterministic! :( 1 ? POST / ...

Slide 37

Slide 37 text

Safe: Idempotent: PATCH: POST: :) :) :) :) :( :) :( :( :) :( :( :(

Slide 38

Slide 38 text

worst case PATCH = Lock on document + PUT

Slide 39

Slide 39 text

worst case POST = Lock on system + PUT

Slide 40

Slide 40 text

Resources Renderer Business Logic Business Data optional

Slide 41

Slide 41 text

Before Request + Business Logic + DB Access + Rendering After Request + DB Access + Rendering

Slide 42

Slide 42 text

Performance

Slide 43

Slide 43 text

Resources Renderer Business Logic Business Data Renderer

Slide 44

Slide 44 text

Resources Renderer Business Logic Business Data Renderer Business Logic

Slide 45

Slide 45 text

Resources Renderer Business Logic Business Data Renderer Business Logic Resources

Slide 46

Slide 46 text

Resources Renderer Business Logic Business Data Renderer Business Logic Resources Business Data

Slide 47

Slide 47 text

Server Box A Box B GET GET

Slide 48

Slide 48 text

Server Box A Box B PUT PUT PUT

Slide 49

Slide 49 text

Server Box A Box B PATCH PATCH PUT + Lock

Slide 50

Slide 50 text

Server POST ? :(

Slide 51

Slide 51 text

Browser support? :(

Slide 52

Slide 52 text

Locking? HTTP?

Slide 53

Slide 53 text

Locking :(

Slide 54

Slide 54 text

Optimistic Locking :)

Slide 55

Slide 55 text

PATCH / If-Match: “XYZ”

Slide 56

Slide 56 text

PUT / If-Non-Match: *

Slide 57

Slide 57 text

DELETE / If-Match: *

Slide 58

Slide 58 text

PATCH / If-Unmodified- Since: ...

Slide 59

Slide 59 text

Browser support? :(

Slide 60

Slide 60 text

Scalability

Slide 61

Slide 61 text

Example Attack JSON CSRF

Slide 62

Slide 62 text

// https://foo/secrets.json [“chunky”, “bacon”]

Slide 63

Slide 63 text

Slide 64

Slide 64 text

Browser support? :( GET /secrets.json Accept: */*

Slide 65

Slide 65 text

var captured = []; var oldArray = Array; function Array() { var obj = this, id = 0, capture = function(value) { obj.__defineSetter__(id++, capture); if (value) captured.push(value); }; capture(); }

Slide 66

Slide 66 text

Old Architecture Rerun Request Without Session Side-effects? Server load? :(

Slide 67

Slide 67 text

New Architecture Don’t Authenticate with Session Yay!

Slide 68

Slide 68 text

Security

Slide 69

Slide 69 text

Also, Hypermedia! ;)

Slide 70

Slide 70 text

Interoperability

Slide 71

Slide 71 text

hej och tack för kaffet jag är glad att vara här sätt på en kanna till för jag stannar ett tag hej och tack för kaffet jag är glad att vara här sätt på en kanna till för jag stannar ett tag