No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

50
No free lunch, indeed: Three years Phil Calçado SoundCloud of microservices at SoundCloud

Transcript of No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

Page 1: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

No free lunch, indeed:Three years

Phil CalçadoSoundCloud

of microservicesat SoundCloud

Page 2: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

No free lunch, indeed:Three years

Phil CalçadoSoundCloud

of microservicesat SoundCloud

Page 3: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado
Page 4: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado
Page 5: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

> 11 hours of audio uploaded every minute

~ 300 million people every month

Page 6: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

heaps have been written about microservices in

the past year-ish

Page 7: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado
Page 8: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

tl;dr

• Rapid provisioning• Basic Monitoring• Rapid application deployment

Page 9: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

These make sense

• Rapid provisioning• Basic Monitoring• Rapid application deployment

this makes sense

why does it make me so nervous?

Page 10: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

the SoundCloud story you might know

Page 11: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

we moved to microservices

because $reasons

http://bit.ly/how_we_ended_up_with_microservices

Page 12: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado
Page 13: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

the pre-history

Page 14: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

SoundCloud, circa 2011

Page 15: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

let’s prepare for the “microservices

explosion"

Page 16: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

#1 provisioning

Page 17: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

what was cool in 2010-11

Page 18: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

what was cool in 2010-11

doozer lxc 12factor.net

Page 19: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

much better than anything else at the

time

Page 20: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

a problem

no resource limits (i.e. cgroups)+

naïve scheduling=

loud neighbour in your own datacentre

Page 21: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

a problemmade for

most of our services migrated to

Page 22: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

the problem

time

start workon v1

v1 100% deployed

start work on v2

Page 23: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

attempt #1 - before we go sophisticated, let’s simplify what we have

Page 24: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

warmed up pool

machineintake

Page 25: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

just a bit of glue code

Page 26: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

just a bit of glue codea LOT

Page 27: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

machineintake

Page 28: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

#2 telemetry

Page 29: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

state of telemetry tools circa 2011-12 wasn’t

great

Page 30: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

StatsD

Page 31: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

let’s build our own!

Page 32: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado
Page 33: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

but that’s not what broke…

Page 34: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

obvious with a monolith

monolith

Page 35: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

not so much now

?

?

?

Page 36: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

standardise dashboards

Page 37: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

standardise operations

https://twitter.github.io/twitter-server/Features.html#http-admin-interface

Page 38: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

visualise

Page 39: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

#3 deployment

Page 40: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado
Page 41: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

> git

SquashFS

> make

unit tests integration tests

acceptance tests perf tests

> make

/dev/null

Page 42: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

we ended up with 7 different deployment

scripts

Page 43: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

> make > gitunit tests integration tests

unit tests integration tests

acceptance tests perf tests

Page 44: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

containers let you spawn your mini-

SoundCloud

Page 45: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

but why was I so nervous?

Page 46: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

because wemessed up

Page 47: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

there are simple and incremental ways to address these

• Rapid provisioning• Basic Monitoring• Rapid application deployment

Page 48: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

“wtf? do you think Netflix got it right the first time?”

— @adrianco

Page 49: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

some of the good things

Page 50: No Free Lunch, Indeed: Three Years of Microservices at SoundCloud - Phil Calcado

Q&A