scaling gilt
play

SCALING GILT From Monolith Ruby App to Distributed Scala - PowerPoint PPT Presentation

SCALING GILT From Monolith Ruby App to Distributed Scala Micro-Services QCon - Brooklyn - 2014 Yoni (Jonathan) Goldberg - GiltDirect, Sale Personalization, Loyalty, SEO, Post-purchase, Login/Registration - MIT CS BS/Meng | Google | IBM | IDF


  1. SCALING GILT From Monolith Ruby App to Distributed Scala Micro-Services QCon - Brooklyn - 2014 Yoni (Jonathan) Goldberg

  2. - GiltDirect, Sale Personalization, Loyalty, SEO, Post-purchase, Login/Registration - MIT CS BS/Meng | Google | IBM | IDF - Israel | Brooklyn | Coffee | JS/Node | Arduino | Running | Kite Surfing | Poker

  3. The lessons and challenges that we had/have with micro-service architecture

  4. WHAT IS GILT? Flash Sales Business Founded in 2007 Top 50 Internet-Retailer ~150 Engineers

  5. ANOTHER WAY TO LOOK AT GILT

  6. THE CLASSIC STARTUP STORY

  7. THE EARLY DAYS 2007 - Ruby on Rails the hottest new thing The goal was to get to market fast

  8. We were able to handle our traffic pretty well

  9. UNTIL LOUBOUTIN CAME TO GILT

  10. TECHNOLOGY PAIN POINTS - 2009 Spike required to launch 1,000s of ruby processes Postgres was overloaded Routing traffic between ruby processes sucked |Note to self| hide from the ruby fans

  11. DEV PAIN POINTS 1000 Models/Controllers, 200K LOC, 100s of jobs Lots of contributors + no ownership Difficult deployments with long integration cycles Hard to identify root causes

  12. WE NEEDED TO SOLVE THE PROBLEM FAST

  13. THREE THINGS HAPPENED Started the transition to the JVM M(a/i)cro-Service Era Started Dedicated data stores

  14. WHY JVM? Widely adopted Stable Better support for concurrency Better GC vs MRI

  15. FIRST 10 SERVICES

  16. We solved 90% of our arch scaling problem But not the Dev points

  17. SOLVED PAIN POINTS Spike required to launch 1,000s of ruby processes Postgres was overloaded Routing traffic between ruby processes sucked

  18. STILL OPEN PAIN POINTS New services became semi-monolithic 1000 Models/Controllers, 200K LOC, 100s of jobs Lots of contributors + no ownership Difficult deployments with long integration cycles

  19. WHY WE DOUBLED DOWN ON MICRO-SERVICES Empower teams and ownership Smaller scope Simpler and Easier deployments and rollbacks

  20. As of last week we have around 400 services in Prod

  21. We began the transition to Scala and Play LOSA - Lots Of Small (Web) Apps Same as micro-services but for web-apps

  22. DEMO

  23. why the increase?

  24. APP BOOTSTRAP rake 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

  25. HOW TO DEFINE A MICROSERVICE? Functionality scope Number of devs involved

  26. NEW CHALLENGES Deployments and Testing (Functional/Integration) Dev/Integration Environments Who owns this service!? Monitoring

  27. ON DEPLOYMENTS AND TESTING "Testing is HARD" - the dev that sits on your left

  28. THE CHALLENGES THAT WE FACED: Hard to execute functional tests between services Frustrating to deploy semi-manually (Capistrano) Scary to deploy other teams services

  29. SBT Motivation: Scala adaption Complex Scala syntax Cool features: ~test, shell, console Hard to debug

  30. GILT-SBT-BUILD Simple config for all the services Pulls many plugins: [nexus, testing, RPMs, run scripts, Monitoring, SemVer, ...] Custom commands (e.g 'sbt release')

  31. ION-CANNON + SBT Run tests on dedicated Env Supports Canary releases Easy rollbacks Integrated health checks

  32. On Dev/Integration Environments The hardware is not strong enough No one wants to compile 20 services Service Dependencies

  33. EACH TEAM HAS A STAGING ENV SERVICE_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 ....

  34. STAGING DIFFICULTIES: Hard to keep all the services up to date Maxed our staging env capacities Requires to have internet connection for some of the services (e.g LOSA-apps)

  35. Dependency Fun [Demo]

  36. THE FUTURE GO Reactive

  37. Docker An extension to Linux Containers (LXC) Decentralization Simple Configurations Much lighter than a VM Immutable Supports multiple platforms

  38. ON OWNERSHIP "code stays much longer than people" - SB

  39. CODE OWNERSHIP

  40. CURRENT APPROACH Code Review!Code Review!Code Review! Team owns services, not individual developers Ownership transfer

  41. DATA OWNERSHIP

  42. WE TRANSITIONED TO MICRO- DBS Third of the services have their own MongoDB | Postgres | Voldemort

  43. MANAGE MICRO-RELATIONAL DBS SCHEMA EVOLUTION MANAGER https://github.com/gilt/schema- evolution-manager

  44. PRINCIPLES OF SCHEMA EVOLUTION MANAGER Can manage the schema evolutions in a Git repo Schema changes are deployed as tar flies No rollbacks Schema changes are required to be incremental

  45. ON MONITORING

  46. THE TOOLS WE USE graphite / openTSDB

  47. Cheat Sheet Your organization has > 30 developers Deployments and integrations are difficult [You need a team for that] You can abstractly separate features and parts of your site Special hardware or performance needs for some features

  48. MAIN TAKEAWAYS Simplicity - Do you really need it? MicroServices promise works for most cases As of 2014 - You will need to invest in Tools! We feel that it was the right choice for us

  49. WHAT'S NEXT ? BUILD YOUR NEXT FEATURE IN A NEW SERVICE

  50. QUESTION TIME We are hiring... @yoni_goldberg jgoldberg@gilt.com www.yonigoldberg.com

  51. SCALA BREAK

  52. Why switch to Scala from Java Object-Functional Programming Akka Immutability that leads to easier concurrency Great libraries: like Salat, Scalaz Less boilerplate code - e.g Case classes, App Scala's Collections

  53. Traits Cake Pattern Console SBT (in scala, release process) Option

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend