Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical...

111
the road to cloud native applications Fabien Hermenier 1

Transcript of Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical...

Page 1: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

the road to cloud

native applicationsFabien Hermenier

1

Page 2: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

2

cloud ready applications

cloud native applications

single-tiered monolithic hardware specific

leverage cloud services scalable reliable

Page 3: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

Agenda

Phase 1 Phase 2 Phase 3

Follow the lecture Profit

Page 4: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling
Page 5: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

5

Page 6: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

6

scale

upgrade

live and prosper wo. downtime

non-blocking, async communications

Page 7: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

7

prehistorical times

internet

Page 8: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

8

prehistorical times

2 Single Point of Failure limited scalability

not scalable online not upgradable online

Page 9: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

9

n-tiered apps to the rescue

Tiers 1

Tiers 2

Tiers 3

Page 10: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

10

n-tiered apps to the rescue

Tiers 1

Tiers 2

Tiers 3

load balancing horizontal scalability

upgradable online

Page 11: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

11

spread incoming requests to backend services

synchronous communications

loadbalancing

balancingbalancing

Page 12: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

possible load balancing algorithms

Round Robin…, 6, 5, 4, 3, 2, 1

4, 1

5, 2

6, 3nice on homogeneous nodes

Page 13: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

possible load balancing algorithms

weighted…, 6, 5, 4, 3, 2, 1

weight the nodes or the requests depending on their size

6, 5, 3, 1

4, 2

Page 14: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

is everything balanceable ?

14

spread incoming requests to backend services

synchronous communications“

Page 15: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

load balancing stateful stuff

Round Robin

1

2

3

…, 4, 3, 2, 1

Page 16: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

load balancing stateful stuff

Round Robin

2

3

…, 4, 3, 2, 1

Page 17: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

load balancing stateful stuff

Round Robin

2

3

…, 4, 3, 2, 1

4

Page 18: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

load balancing stateful stuff

Round Robin

2

3

…, 4, 3, 2, 1

4

achievement unlocked

Page 19: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

load balancing stateful stuff

Round Robin…, 4, 3, 2, 1

Page 20: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

load balancing stateful stuff

Round Robin…, 4, 3, 2, 1FAIL

Page 21: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

load balancing stateful stuff

Round Robin…, 4, 3, 2, 1

+ sticky sessions

yellow stuff

IP based

Page 22: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

load balancing stateful stuff

Round Robin…, 4, 3, 2, 1

+ sticky sessions

yellow stuff

IP basednot resilient to node failures

Page 23: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

18

elastic load balancing

mod_proxy_balancer lb

linux virtual server

galera

Page 24: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

19

scaling

Page 25: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

verti

cal s

claing

Tiers 1

Tiers 2

Tiers 3

20

scale up / down

Page 26: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

verti

cal s

claing

Tiers 1

Tiers 2

Tiers 3

20

scale up / down

Page 27: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

21

historical method (more powerful hardware) mostly cold approaches easy to implement coldly hardware bounded does not address reliability

verti

cal s

calin

g

Page 28: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

22

support for hot plug CPU

what about the runtime ?

Page 29: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

horizontal scaling23

Tiers 1

Tiers 2

Tiers 3

Page 30: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

horizontal scaling23

Tiers 1

Tiers 2

Tiers 3

Page 31: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

horizontal scaling

not application agnostic — require a load balancer / synchronisation — scale to the infinite in theory — support node failure

Page 32: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

Elasticityoptimize performance in live through

scaling requests

Page 33: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

static elasticity

error prone under/over-estimations

not feedback based

initiated by the administrator

Page 34: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

static elasticity

error prone under/over-estimations

not feedback based

initiated by the administrator

time-driven only ?time

instances

7am 8am 9am 10am

Page 35: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

27

getting a VM takes up to 5 minutes

think in terms of trends

spare space just in case

latency-aware elasticity

Page 36: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

28

t

forecastsreality

horizontal elasticityvertical elasticity

static elasticity

Page 37: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

dynamic elasticityinitiated by the app itself

rule based system

feedback from monitoring data

implemented inside/outside the app

Page 38: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

30

t

forecastsreality

horizontal elasticity

dynamic elasticity

Page 39: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

31

Page 40: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

32

monitor each tier to indentify the bottlenecks

dynamic elasticityscale where its matter

scale out apache/tomcat/mysql ?

Page 41: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

cost model for elasticity

33

service cost instance cost (hourly based)

/!\ don’t scale too often

Page 42: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

load balancing

transcode

transcodetranscode

consequences with high response time ?

requests cannot stall in a load balancer

Page 43: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

load balancing

transcode

transcodetranscode

consequences with high response time ?

x x—

requests cannot stall in a load balancer

Page 44: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

35

Message queues

asynchronous communication protocol to transfer data

producers consumers

Page 45: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

shift time consuming tasks to workers loose coupling

Message queues

producers consumers

benefits

Page 46: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

37

queues are reliable durable data fault tolerant eventual consistency

queues are scalable # workers # internal components

Page 47: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

dequeue — process — delete3 basic operations:

1. ?

2. ?

3. ?

Programming model for workers

Page 48: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

1. dequeue/delete

2. process

Programming model for workers

Page 49: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

1. dequeue/delete

2. process

message lost

Programming model for workers

Page 50: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

1. dequeue

2. process

3. delete« at least 1 one read » ?

Programming model for workers

Page 51: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

what is there is a node failure while processing

?1. dequeue

2. process

3. delete

Page 52: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

invisibility windowmessages are not definitely dequeued hidden for a period (configurable) removed once deleted a timeout makes the message visible again

Programming model for workers

Page 53: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

Programming model for workers

invisibility windowrealize eventual consistency

1. dequeue

2. process

3. delete

Page 54: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

what if processing time > invisibility window

?1. dequeue

2. process

3. delete

Page 55: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

Programming model for workers

1. dequeue

2. process

3. delete

eventual consistency makes possible to process a message twice.

Take care !

Page 56: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

billing model for queues

46

#request #Data transfered

/!\ pull mode

Page 57: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

47

Amazon SQS Simple Queuing System

Page 58: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

dealing with latency

48

Page 59: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

latency over business

49

>€

Page 60: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

50

-20% traffic

search

+500 ms

Page 61: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

51

-1% $$+100 ms

Page 62: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

Latency numbers

52

L1 cache reference ……………………. 0.5 ns Branch mispredict ………………………. 5 ns L2 cache reference ……………………… 7 ns Mutex lock/unlock ……………………… 25 ns Main memory reference …………………. 100 ns Compress 1K bytes with Zippy …………. 3,000 ns = 3 µs Send 2K bytes over 1 Gbps network ……. 20,000 ns = 20 µs SSD random read …………………… 150,000 ns = 150 µs Read 1 MB sequentially from memory ….. 250,000 ns = 250 µs Round trip within same datacenter …… 500,000 ns = 0.5 ms Read 1 MB sequentially from SSD* ….. 1,000,000 ns = 1 ms Disk seek ……………………… 10,000,000 ns = 10 ms Read 1 MB sequentially from disk …. 20,000,000 ns = 20 ms Send packet CA->Netherlands->CA …. 150,000,000 ns = 150 ms

Page 63: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

53

colocatesame process, server, rack, datacenter

1 Gb/secreduce latency

reduce data transfer costs

Page 64: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

cache

54

to store data closely and speed up future accesses

q1

Page 65: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

cache

54

to store data closely and speed up future accesses

q1

q1 ?

Page 66: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

cache

54

to store data closely and speed up future accesses

q1

q1 ?

q1

cache miss

Page 67: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

cache

54

to store data closely and speed up future accesses

q1

q1 ?

q1

d1

cache miss

Page 68: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

cache

54

to store data closely and speed up future accesses

q1 q1

d1

cache miss

q1: d1

Page 69: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

cache

54

to store data closely and speed up future accesses

q1 q1

d1

cache miss

q1: d1d1

Page 70: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

cache

55

to store data closely and speed up future accesses

q1

q1: d1

Page 71: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

cache

55

to store data closely and speed up future accesses

q1

cache hit

q1: d1

Page 72: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

cache

55

to store data closely and speed up future accesses

q1

cache hit

q1: d1d1

Page 73: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

cache everything everywhere

56

« Cache is the new RAM »

Page 74: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

Getting close to clients

57

Page 75: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

58

Getting close to the clients

Page 76: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

59

Content Delivery Networks (CDN)

Page 77: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

60

Content Delivery Networks (CDN)

available at network edges

data are injected into the CDN

the CDN spreads the data where it matters

user requests are redirected to the closest Point of Presence (PoP)

Page 78: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

Deploy

Page 79: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

Zero Downtime Deployment

Page 80: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

new features internal changes

fixes

What to deploy

Page 81: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

64

Tiers 1

Tiers 2

Tiers 3

how-to upgrade gracefully ?

Page 82: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

64

Tiers 1

Tiers 2

Tiers 3

how-to upgrade gracefully ?

Page 83: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

64

Tiers 1

Tiers 2

Tiers 3

how-to upgrade gracefully ?

Page 84: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

64

Tiers 1

Tiers 2

Tiers 3

how-to upgrade gracefully ?

Page 85: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

64

Tiers 1

Tiers 2

Tiers 3

how-to upgrade gracefully ?

Page 86: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

65

(that guy make good talks about github processes)

Page 87: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

66

There is some code you can’t break

tests are not enough

permission - billing - upgrades - maintenance

Page 88: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

67

new code can’t change production code behavior

Page 89: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

68

parallel paths

science « new auth » do |e| e.control{user.slow_auth} e.candidate{user.fast_auth}

end

Page 90: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

69

monitor progress

Page 91: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

70

2 releases a day

at facebook

the frontend is a standalone 1.5GB executabledeployment over bitorrentno downtime

see Push: tech talk

Page 92: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

71

canary release

at facebookdev fenced to the next release(6 private servers)over 2% of the production servers

over 100% of the production servers

Page 93: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

72

decoupling

at facebook

stateless sessionsbackward & forward compatible UIdark launches & feature flag

Page 94: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

73

integration tests

test if images are ok

test if every files are in a cdn

test if css is clean

everything is automated CI + grunt

Page 95: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

74

http://highscalability.com/

(in 2012)

Page 96: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

75

500 M page views a day

Peak rate of ~40k req/sec

1+ TB/day into Hadoop cluster

Posts: 50GB a day

Follower list updates: 2.7TB a day

Dashboard: 1M w/sec, 50K r/sec

Page 97: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

76

simple LAMP application on rackspace everything on a single server

HA-proxy MySQL sharding for the blog

Redis for the dashboard

origin

backend service in C memcache CDN

Page 98: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

77

JVM centric approach — for hiring and dev. speed PHP just for request authentication and presentation scale, finaggle — support from the big guys

HBase + Redis but still MySQL for bulk data

Redis for the dashboard notification

moved to high-concurrency oriented frameworks

Page 99: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

78

standalone app with its database once logged, a cell is assigned to the user, populated with data cell are populated for live events by a stream

isolation eases parallelism small isolated components isolate failures

dynamic isolation of users into cells

Page 100: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

79

500 web servers 200 database servers

47 pools 30 shards

30 memcache servers 22 redis servers

15 varnish servers 25 haproxy nodes

8 nginx 14 job queue servers

Page 101: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

RECAP80

Page 102: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

81

always available

Page 103: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

82

performant at any scale

Page 104: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

83

cost effective

Page 105: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

Developing within a PaaS

Page 106: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

85

PaaS to create and push a cloud application

support for multiple software stacksRuby, PHP, Pyhon, Java, Node.js, Docker, Go

deployment methodgit, files

Page 107: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

86

EC2, S3, SNS, CloudWatch, AutoScaling, Elastic load balancers, SQS

a low-level HTTP API

official binding for popular languages

official eclipse plugin

tons of documentation, tutorial on AWS website

Page 108: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

87

runtimes on top of EC2

multiple environments (web, worker, data)

deploy: env version + env configuration

env version comes from S3

Elastic HTTP balancers between the envs.

security, security, security, sec

Page 109: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling
Page 110: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

89

dev lifecycle

developlocally

testlocally

deploy toAWS EB

testremotely

viewlogs

deploy toproduction

Page 111: Fabien Hermenier - unice.frusers.polytech.unice.fr/~hermenie/sacc/sacc-architecture.pdf · ertical scaling. 22 support for hot plug CPU what about the runtime ? horizontal scaling

90

Go online !!