Finagle @ SoundCloud

44
Finagle @ SoundCloud Phil Calçado SoundCloud

Transcript of Finagle @ SoundCloud

Page 1: Finagle @ SoundCloud

Finagle @ SoundCloud

Phil CalçadoSoundCloud

Page 2: Finagle @ SoundCloud
Page 3: Finagle @ SoundCloud
Page 4: Finagle @ SoundCloud

> 11 hours of audio uploaded every minute

~ 300 million people every month

Page 5: Finagle @ SoundCloud
Page 6: Finagle @ SoundCloud

some more micro than others

Page 7: Finagle @ SoundCloud

~100 services ~130 engineers

Page 8: Finagle @ SoundCloud

each service has a cost we need to reduce

fixed cost

Page 9: Finagle @ SoundCloud

1) complexity cost

Page 10: Finagle @ SoundCloud
Page 11: Finagle @ SoundCloud

edge

value-added

foundation

Page 12: Finagle @ SoundCloud

edge

value-added

foundation

api-web

user-profile

user-metadata playlists

api-android

Page 13: Finagle @ SoundCloud
Page 14: Finagle @ SoundCloud

• 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: Finagle @ SoundCloud

2) setup cost

Page 16: Finagle @ SoundCloud
Page 17: Finagle @ SoundCloud

+

Page 18: Finagle @ SoundCloud
Page 19: Finagle @ SoundCloud

3) RPC cost

Page 20: Finagle @ SoundCloud
Page 21: Finagle @ SoundCloud

the only thing these things had in common

was HTTP+JSON

Page 22: Finagle @ SoundCloud

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: Finagle @ SoundCloud

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: Finagle @ SoundCloud

what to use?

Page 25: Finagle @ SoundCloud
Page 26: Finagle @ SoundCloud
Page 27: Finagle @ SoundCloud

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: Finagle @ SoundCloud

ultimately…

Page 29: Finagle @ SoundCloud

…the only three things you need to understand

Page 30: Finagle @ SoundCloud

basically

Page 31: Finagle @ SoundCloud

ActualFeature

Request Validator

User

Page 32: Finagle @ SoundCloud

Authentication Geo IP Rate Limiting AvailableFeatures

ActualFeature

User

Page 33: Finagle @ SoundCloud

ActualFeature

User

Filters

Service

}

Page 34: Finagle @ SoundCloud

we use filters a lot

Page 35: Finagle @ SoundCloud

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

Page 36: Finagle @ SoundCloud

REST is always good enough.

Page 37: Finagle @ SoundCloud

or is it?

Page 38: Finagle @ SoundCloud

migrating to thriftmux

Page 39: Finagle @ SoundCloud

where we don’t follow the "defaults"

Page 40: Finagle @ SoundCloud

DNS for service discovery with SRV records

Page 41: Finagle @ SoundCloud

Prometheus.io for metrics

Page 42: Finagle @ SoundCloud

twitter-server jvmkit

Page 43: Finagle @ SoundCloud

verify new versions of Finagle

Page 44: Finagle @ SoundCloud

Q&A