My presentation @ LISA19
Containerizing your monolithJano González (@janogonzalez)
View Slide
Introduction
What’s SoundCloud
> 200M Tracks > 20M Creators Many SoundCloudRappersWhat’s SoundCloud
2017-2018 Migration Keep movingMotivation
What’s the balance?Motivation
Our migration to microservicesThe monolithContainerizing the monolithConclusionContents
Our migration to microservices
$ rails new soundcloudHow we started
Around 2012
After
But what about deployment?
Component Environment ZoneDeploymentOur abstractions
DeploymentThe process
The monolith
Track User PlaylistThe monolithCore entities
360 Chef provisionedbare-metal machinesRails 2.3 Capistrano deploymentThe monolithThe technology
The monolithThe architecturePublic APIInternal APIPublic APIStranglerInternal APIcaching/stranglerAnother BFFManymicroservicesPublic WebWorkers
The monolithThe componentsPublic APIMoshiMoshi(Internal API)Public Web AssetsMoshiMoshiComments(Internal API)Workers Cron Shell Migration
The monolithThe hostscomponentstatsd-exportermtail statsdpassenger-exporter…
Utilization Deployment Lack of confidenceThe monolithThe issues
Containerizing the monolith
Throw it into Kubernetes
Congrats, your monolith is amicroservice now
Thank You!
1.5 Engineers 1 year until the last bitwas cleaned upThe project
The first milestone
Docker developmentcontainerTests on GoCDThe first milestone
The proof of concept
First staging componentThe proof of conceptDoes it even work?
The proof of conceptPROBLEM!Init script Nginx PassengerPassengerProcessRails App???Where are my env variables?
The proof of conceptEnv variables with The Perl Hack™SOLUTION
Productionizing
Deployment Monitoring LogsProductionizingDoes it run where it matters?
ProductionizingAnatomy of a traffic serving podcomponent statsd statsd-exporterpassenger-exportermtail twemproxytwemproxy-cutwemproxy-exporterinit
Don’t choke servicediscoveryBe allocatableProductionizingSizing the pods
CPU units for maincontainerPassenger processesProductionizingSizing the pods3 16
ProductionizingPROBLEM!Stdout v/s the log metrics exporterComponentSTDOUTLog aggregatorFile???Mtail
ProductionizingMtail with The Rotatelogs Hack™SOLUTION
Productionizing Public API
OrchestrationProductionizing Public API
Productionizing Public APIPROBLEM!DNS latency and our excessive usageComponentService Service Service
Productionizing Public APICoreDNS and the DNS Hack™SOLUTION
Productionizing Internal API
Highest throughputProductionizing Internal API
Productionizing Internal APIPROBLEM!Latency was too high
Productionizing Internal APIOptimize GC and make cheaper SQL queriesSOLUTION
Productionizing Internal APIPROBLEM!Errors spikes during deployment
Productionizing Internal APIThe preStop Trick™SOLUTION
Productionizing Internal APIPROBLEM!Errors spikes during deployment (still???)
Productionizing Internal APIThe Pre Start Trick™SOLUTION
The rest
● Workers● Cron jobs● Shell / Migration hosts● Cleanup!The rest
Finishing
Current status
On-prem CloudCurrent statusNumber of pods~1000 ~140
On-prem RPS Cloud RPSCurrent statusTraffic25K 3K
Current statusMany deploys
Conclusions
One Infrastructure One Delivery ProcessConclusionsWhat we solved
Step by step Controlled rollouts Managing expectationsConclusionsHow we did it
Improved utilization Increased confidence Enabling new initiativesConclusionsBenefits
Assess current progress Evaluate costs andbenefitsConclusionsShould you do it?
@janogonzalezhttps://soundcloud.com/janogonzalez