Top Banner
Finagle @ SoundCloud Phil Calçado SoundCloud
44

Pcalcado finaglecon-2015

Feb 13, 2017

Download

Software

Phil Calçado
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Pcalcado finaglecon-2015

Finagle @ SoundCloud

Phil CalçadoSoundCloud

Page 2: Pcalcado finaglecon-2015
Page 3: Pcalcado finaglecon-2015
Page 4: Pcalcado finaglecon-2015

> 11 hours of audio uploaded every minute

~ 300 million people every month

Page 5: Pcalcado finaglecon-2015
Page 6: Pcalcado finaglecon-2015

some more micro than others

Page 7: Pcalcado finaglecon-2015

~100 services ~130 engineers

Page 8: Pcalcado finaglecon-2015

each service has a cost we need to reduce

fixed cost

Page 9: Pcalcado finaglecon-2015

1) complexity cost

Page 10: Pcalcado finaglecon-2015
Page 11: Pcalcado finaglecon-2015

edge

value-added

foundation

Page 12: Pcalcado finaglecon-2015

edge

value-added

foundation

api-web

user-profile

user-metadata playlists

api-android

Page 13: Pcalcado finaglecon-2015
Page 14: Pcalcado finaglecon-2015

• Building in Scala should be a no-brainer

• Building in other JVM languages should be easy

• Building in something else should be possible

Page 15: Pcalcado finaglecon-2015

2) setup cost

Page 16: Pcalcado finaglecon-2015
Page 17: Pcalcado finaglecon-2015

+

Page 18: Pcalcado finaglecon-2015
Page 19: Pcalcado finaglecon-2015

3) RPC cost

Page 20: Pcalcado finaglecon-2015
Page 21: Pcalcado finaglecon-2015

the only thing these things had in common

was HTTP+JSON

Page 22: Pcalcado finaglecon-2015

typical flow

1. Get the IDs of all tracks by an artist

2. For each ID:2.1.Get track metadata from X2.2.Get usage permissions from Y2.3.Get comments from Z

3. Return list to client app

Page 23: Pcalcado finaglecon-2015

typical flow

1. Get the IDs of all tracks by an artist

2. For each ID:2.1.Get track metadata from X2.2.Get usage permissions from Y2.3.Get comments from Z

3. Return list to client appparallel concurrent

Page 24: Pcalcado finaglecon-2015

what to use?

Page 25: Pcalcado finaglecon-2015
Page 26: Pcalcado finaglecon-2015
Page 27: Pcalcado finaglecon-2015

lots of resistance

> That said, my overall critique of > [Finagle] is that I feel a lot of > their published implementations are > exceptionally complicated for the > problem domain or entail a bunch of > onerous transitive dependencies.

Page 28: Pcalcado finaglecon-2015

ultimately…

Page 29: Pcalcado finaglecon-2015

…the only three things you need to understand

Page 30: Pcalcado finaglecon-2015

basically

Page 31: Pcalcado finaglecon-2015

ActualFeature

Request Validator

User

Page 32: Pcalcado finaglecon-2015

Authentication Geo IP Rate Limiting AvailableFeatures

ActualFeature

User

Page 33: Pcalcado finaglecon-2015

ActualFeature

User

Filters

Service

}

Page 34: Pcalcado finaglecon-2015

we use filters a lot

Page 35: Pcalcado finaglecon-2015

10 services + 42 spans + 3 levels deep: 92ms

Page 36: Pcalcado finaglecon-2015

REST is always good enough.

Page 37: Pcalcado finaglecon-2015

or is it?

Page 38: Pcalcado finaglecon-2015

migrating to thriftmux

Page 39: Pcalcado finaglecon-2015

where we don’t follow the "defaults"

Page 40: Pcalcado finaglecon-2015

DNS for service discovery with SRV records

Page 41: Pcalcado finaglecon-2015

Prometheus.io for metrics

Page 42: Pcalcado finaglecon-2015

twitter-server jvmkit

Page 43: Pcalcado finaglecon-2015

verify new versions of Finagle

Page 44: Pcalcado finaglecon-2015

Q&A