gilt from monolith ruby app to microservice scala service architecture
DESCRIPTION
The presentation that I gave at the 'NYC Tech Talks' meetup @ January 14, 2014TRANSCRIPT
![Page 1: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/1.jpg)
SCALING GILTFrom Monolith Ruby App
to
Distributed Scala Micro-Services
#NYCTECHTALKS
Lead Engineer - GILT Podium => http://bit.ly/podiumapp
Yoni (Jonathan) Goldberg
![Page 2: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/2.jpg)
ABOUT ME- Leading the Popeye Team
- Sale Personalization, Loyalty, SEO Post-purchase, Login/Registration flows
- MIT CS BS/Meng | Google | IBM | IDF
- Brooklyn | Coffee | Arduino | Running | Kite Surfing |Online Collaboration | Poker
Excited to be part of the NYC Tech community
![Page 3: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/3.jpg)
THE LESSONS AND CHALLENGES THATWE HAD/HAVE WITH
MICRO-SERVICE ARCHITECTURE
![Page 4: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/4.jpg)
![Page 5: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/5.jpg)
Flash Sales Business Founded in 2007
Top 50 Internet-Retailer~150 Engineers
WHAT IS GILT?
![Page 6: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/6.jpg)
![Page 7: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/7.jpg)
ANOTHER WAY TO LOOK AT GILT
Three day traffic pattern
![Page 8: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/8.jpg)
THE CLASSICSTARTUP STORY
![Page 9: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/9.jpg)
THE EARLY DAYS2007 - Ruby on Rails the hottest new thing
The goal was to get to market fast
![Page 10: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/10.jpg)
![Page 11: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/11.jpg)
WE WERE ABLE TO HANDLE OURTRAFFIC PRETTY WELL
![Page 12: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/12.jpg)
UNTIL LOUBOUTIN CAME TO GILT
![Page 13: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/13.jpg)
TECHNOLOGY PAIN POINTS - 2009Spike required to launch 1,000s of ruby processesPostgres was overloadedRouting traffic between ruby processes sucked
|Note to self| - hide from the ruby fan boys
![Page 14: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/14.jpg)
DEV PAIN POINTS1000 Models/Controllers, 200K LOC, 100s of jobsLots of contributors + no ownershipDifficult deployments with long integration cyclesHard to identify root causes
![Page 15: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/15.jpg)
WE NEEDED TO SOLVETHE PROBLEM FAST
![Page 16: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/16.jpg)
THREE THINGS HAPPENEDStarted the transition to the JVMM(a/i)cro-Service Era StartedDedicated data stores
![Page 17: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/17.jpg)
WHY JVM?Widely adoptedStableBetter support for concurrencyBetter GC vs MRI
![Page 18: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/18.jpg)
FIRST 10 SERVICES
![Page 19: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/19.jpg)
![Page 20: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/20.jpg)
We solved 90% of our arch scaling problemBut not the Dev points
![Page 21: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/21.jpg)
PAIN POINTSSpike required to launch 1,000s of ruby processesPostgres was overloadedRouting traffic between ruby processes suckedNew services became semi-monolithic1000 Models/Controllers, 200K LOC, 100s of jobsLots of contributors + no ownershipDifficult deployments with long integration cycles
![Page 22: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/22.jpg)
WHY WE DOUBLED DOWN ON MICRO-SERVICES
Empower teams and ownershipSmaller scopeSimpler and Easier deployments and rollbacks
![Page 23: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/23.jpg)
MICRO SERVICE ARCHITECTURESTARTED TO GET TRACTION
![Page 24: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/24.jpg)
AS OF LAST WEEK WE HAVE MORETHAN
450 SERVICES
![Page 25: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/25.jpg)
APP BOOTSTRAPrake bootstrap:admin-web # Bootstrap a admin-web service rake bootstrap:babylon-docs # Bootstrap a babylon-docs service rake bootstrap:client-server-core # Bootstrap a client-server-core service rake bootstrap:jersey-java # Bootstrap a jersey-java service rake bootstrap:jersey-scala # Bootstrap a jersey-scala service rake bootstrap:play # Bootstrap a play service rake bootstrap:play-ui-build # Bootstrap a play-ui-build service rake bootstrap:sbt-library # Bootstrap a sbt-library service rake bootstrap:schema # Bootstrap a schema service
![Page 26: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/26.jpg)
WE BEGAN THE TRANSITION TO SCALAAND PLAY
LOSA - Lots Of Small AppsSame motivation and benefits of Micro-Service
Architecture
![Page 27: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/27.jpg)
![Page 28: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/28.jpg)
NEW CHALLENGESDev/Integration EnvironmentsWho owns this service!?MonitoringDeployments and Testing (Functional/Integration)
![Page 29: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/29.jpg)
ON DEV/INTEGRATION ENVIRONMENTSThe hardware is not strong enoughNo one wants to compile 20 services
![Page 30: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/30.jpg)
EACH TEAM HAS A STAGING ENVSERVICE_PORTS=[ 4001, #listing-service 8235, #svc-user-set 9420, #svc-free-fall 7895, #svc-Loyalty 8155, #web-loyalty 9410, #web inventory status 7898, #admin-loyalty 7899, #notification 7102, #rouge 9530, #svc-component 6802, #svc-waitlist-submit 4066, #svc-action-sale ....
PORT_FORWARD_ARGS=SERVICE_PORTS.map { |port| ['-L', "#{port}:localhost:#{port}"] }
exec(*[%w{ssh -a -C -N -n}, PORT_FORWARD_ARGS, GW_HOST].flatten)
![Page 31: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/31.jpg)
STAGING DIFFICULTIES:Hard to keep all the services up to dateMaxed our staging env capacitiesRequires to have internet connection for some of theservices (e.g LOSA-apps)
![Page 32: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/32.jpg)
The Future
![Page 33: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/33.jpg)
DOCKERAn extension to Linux Containers (LXC)
DecentralizationSimple ConfigurationsMuch lighter than a VMImmutableSupports services and platforms
![Page 34: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/34.jpg)
ON OWNERSHIP "code stays much longer than people" - SB
![Page 35: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/35.jpg)
CODE OWNERSHIP
![Page 36: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/36.jpg)
CURRENT APPROACHCode Review!Code Review!Code Review!Team owns services, not individual developersOwnership transfer
![Page 37: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/37.jpg)
![Page 38: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/38.jpg)
![Page 39: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/39.jpg)
DATA OWNERSHIP
![Page 40: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/40.jpg)
WE TRANSITIONED TO MICRO-DBSThird of the services have their own
MongoDB
Postgres
Voldemort
![Page 41: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/41.jpg)
MANAGE MICRO-RELATIONAL DBS SCHEMA EVOLUTION MANAGER
https://github.com/gilt/schema-evolution-manager
![Page 42: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/42.jpg)
PRINCIPLES OF SCHEMA EVOLUTION MANAGER
Can manage the schema evolutions in a Git repoSchema changes are deployed as tar fliesNo rollbacksSchema changes are required to be incremental
![Page 43: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/43.jpg)
echo "create table releases (id integer)" > new.sql sem-add ./new.sql #Created a git commit sem-dist # generates the tar e.g schema-ion-cannon0.0.2.tar.gz # Scp and untar on your server cd schema-ion-cannon-0.0.2 sem-apply host --localhost --name ion-cannon --user ion-cannon
![Page 44: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/44.jpg)
ON MONITORING
![Page 45: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/45.jpg)
![Page 46: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/46.jpg)
THE TOOLS WE USE
graphite / openTSDB
![Page 47: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/47.jpg)
![Page 48: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/48.jpg)
![Page 49: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/49.jpg)
![Page 50: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/50.jpg)
![Page 51: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/51.jpg)
![Page 52: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/52.jpg)
ON DEPLOYMENTS AND TESTING
(FUNCTIONAL/INTEGRATION) "Testing is HARD" - the dev that sits on your left
![Page 53: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/53.jpg)
THE CHALLENGES THAT WE FACED:Hard to execute functional tests between servicesFrustrating to deploy semi-manually (Capistrano)Scary to deploy other teams services
![Page 54: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/54.jpg)
SBTMotivation: Scala adaptionComplex Scala syntaxCool features: ~test, shell, consoleHard to debug
![Page 55: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/55.jpg)
GILT-SBT-BUILDSimple config for all the servicesPulls many plugins: [nexus, testing, RPMs, run scripts, Monitoring,SemVer, ...]Custom commands (e.g 'sbt release')
![Page 56: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/56.jpg)
object Build extends ClientServerCoreProject with Dependencies { val name = 'svc-sale-activation' val coreDeps = .... val serverDeps = ... val clientDeps = ...
override val ioncannonTrack = IonCannon.FastTrack }
![Page 57: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/57.jpg)
ION-CANNON + SBTRun functional/Selenium tests on dedicated EnvSupports Canary releasesEasy rollbacksIntegrated health checks
![Page 58: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/58.jpg)
![Page 59: Gilt from monolith ruby app to microservice scala service architecture](https://reader034.vdocuments.us/reader034/viewer/2022051818/5496ec59b479597e6a8b633b/html5/thumbnails/59.jpg)
MAIN TAKEAWAYSSimplicity - Do you really need it?We feel that it was the right choice for usMicroServices promise works for most casesAs of 2014 - You will need to invest in Tools!