Beruflich Dokumente
Kultur Dokumente
Mike Krieger
INSTAGRAM
So Paulo, Brazil
Stanford SymSys
@mikeyk
mike@instagram.com
@goldenretrieverbailey
we had an engineering
team of 4 people
we had about
30 million monthly actives
TODAY...
we have an eng
team of 95 people
we have over
300 million monthly actives
THIS TALK
how we adapted to
infra, team, and product changes
ORIGINAL PHILOSOPHY
do the simple
thing first
aka YAGNI
boring means
operationally quiet, too
nginx &
redis &
memcached &
postgres &
gearman &
django
2015 EDITION
nginx &
redis &
memcached &
postgres &
gearman &
django
nginx &
cassandra &
memcached &
postgres &
rabbitmq &
django
nginx &
cassandra &
memcached &
postgres & unicorn &
rabbitmq & proxygen &
scribe &
django
thrift
1
do the simple
2
thing first
until your
{scale, team, product}
changes
1
do the simple
2
thing first
until your
{scale, team, product}
changes
which components to
replace & when
DEEPER DIVE
ASYNC TASKS
requests
should
take
<
3s
ADS
CAROUSEL ADS
especially
popular
users
ADS
CAROUSEL ADS
v1:
Gearman
ADS
CAROUSEL ADS
async
task
broker
ADS
CAROUSEL ADS
1 gearman broker
4
app
servers
ADS
1 async worker box
CAROUSEL ADS
dead
simple
to
set
up
ADS
CAROUSEL ADS
memcached-like
in
simplicity
ADS
CAROUSEL ADS
got us through
ADS
1.5 years of growth
CAROUSEL ADS
photo: MAMJODH
messy to add/deploy
ADS new workers
CAROUSEL ADS
1s+ADS
enqueue time under load
CAROUSEL ADS
8 gearman brokers
400 app servers
ADS12,000+ threads
32
async
worker
boxes
CAROUSEL ADS
v2:
sharded
gearman
ADS
CAROUSEL ADS
BROKERS[node_index % len(BROKERS)]
ADS
CAROUSEL ADS
no
graceful
failover
ADS
CAROUSEL ADS
# of app
servers
growing
quickly
ADS
CAROUSEL ADS
operating
at
new
scale
ADS
CAROUSEL ADS
time
to
move
on
ADS
CAROUSEL ADS
your infra
do
the
simple
thing
next
ADS
CAROUSEL ADS
roll
your
own
ADS
CAROUSEL ADS
rewrite
gearman
ADS
CAROUSEL ADS
v3:
celery
and
rabbitmq
ADS
CAROUSEL ADS
celery
ADS
for much simpler worker code
CAROUSEL ADS
rabbitmq
ADS
low(ish) maintenance
CAROUSEL ADS
kick
off
with
function.delay()
ADS
CAROUSEL ADS
replication + failover
ADS + persistence
CAROUSEL ADS
ADS
5ms mean
10ms P90
CAROUSEL ADS
more details:
ADS
http://bit.ly/igcelery
CAROUSEL ADS
DEPLOYMENT
the ADS
art of getting code to prod
CAROUSEL ADS
v1:
fab
and
git
pull
ADS
CAROUSEL ADS
fabric:
Python
remote
scripting
ADS
CAROUSEL ADS
great
for
2
engineers
ADS
CAROUSEL ADS
past
12
machines
=
pain
ADS
CAROUSEL ADS
ADS
CAROUSEL ADS
worked
up
to
70
machines
ADS
CAROUSEL ADS
the ADS
year of the GitHub DDOSs
CAROUSEL ADS
swear
it
wasn't
us
deploying
ADS
CAROUSEL ADS
v3:
fab
rollout
ADS
CAROUSEL ADS
lasted
us
another
1.5
years
ADS
CAROUSEL ADS
IG
infra
2
to
10
eng
ADS
CAROUSEL ADS
v4:
enter
Sauron
ADS
CAROUSEL ADS
lasted
us
another
1.5
years
ADS
CAROUSEL ADS
ADS
CAROUSEL ADS
backend
committers++
ADS
CAROUSEL ADS
human
lock
contention
ADS
CAROUSEL ADS
v5:ADS
continuous deployment
CAROUSEL ADS
ADS
take human
procedure,
automate
ADS
CAROUSEL ADS
SEARCH
v1:
minimize
moving
parts
ADS
CAROUSEL ADS
prefix-only,
plz
ADS
CAROUSEL ADS
haystack
was
pretty
small
ADS
CAROUSEL ADS
ok,
but
Bieber
ADS
CELEBRITY_OVERRIDES
=
{
'taylor
swift':
19151555,
(
:
E
D
'taylorswift':
19151555,
O
C
L
A
U
T
'justinbieber':
6860189,
C
A
ADS
'justin
bieber':
6860189
CAROUSEL
ADS
}
aka product
needs
have
evolved
ADS
ADS
v2: Solr
Lucene-based
HTTP/JSON
interface
ADS
great indexing options
ADS
CAROUSEL ADS
-
CELEBRITY_OVERRIDES
=
{
-
'taylor
swift':
19151555,
-
'taylorswift':
19151555,
-
'justin
bieber':
68680189
ADS
-
}
CAROUSEL ADS
<1ADS
month to transfer over
launch
Android
ADS
4x
the
queries
ADS
no
SolrCloud
yet
ADS
index twice?
ADS
partition by prefix?
scale
had
changed
ADS
v3:
ElasticSearch
ADS
ADS
CAROUSEL ADS
very
simple
to
set
up
ADS
in a steady state,
ADS
worked beautifully
ADS
split brain
AWS
autodiscovery
ADS
had
to
keep
queries
simple
ADS
meanwhile,
instagration
ADS
v4:
Unicorn
ADS
FB's
graph
search
system
ADS
ADS
bonus:
new
Explore
photos
ADS
v1:
most
liked,
globally
ADS
tryingADS
to everything to everyone
let's
get
social
ADS
ADS
CAROUSEL ADS
ADS
ADS
CAROUSEL ADS
http://bit.ly/fbunicorn
ADS
TAKEAWAYS
1
do the simple
2
thing first
until your
{scale, team, product}
changes
get in touch:
ADS
mike@instagram.com
CAROUSEL ADS