Scaling APIs with Microservices: The Platform.sh Experience

Scaling APIs with Microservices: The Platform.sh Experience

Babdf467dac04e2ca41be014f2e95169?s=128

Chris Skene

March 23, 2017
Tweet

Transcript

  1. Scaling APIs with Microservices: The Platform.sh experience Christopher Skene Regional

    Manager, APAC with Ori Pekelman
  2. This is Ori

  3. Monolithic, all in one service API linked services Consistency and

    reproducibility
  4. REST

  5. APIs bridge gaps between two sets of semantics

  6. None
  7. Opacity & semantics

  8. Imagine an imaginary menagerie… (of services)

  9. Cafe-as-a-Service waiter

  10. Simple API barista makeCoffee

  11. Not so Simple after all barista makeCoffee Queue

  12. Public API barista makeCoffee waiter orderCoffee

  13. Service API barista makeCoffee waiter orderMeal kitchen sommelier getWine cook

    Food
  14. Hydra API barista orderWine kitchen sommelier orderCoffee orderFood cashier updateBill

  15. Applications built with APIs evolve and get messy... barista makeCoffee

    waiter orderDrinks sommelier getWine kitchen orderMeal updateStock storeroom
  16. Challenges of API-based architectures

  17. Operational Complexity barista makeCoffee waiter orderDrinks sommelier getWine kitchen orderMeal

    updateStock storeroom
  18. Dependency and version management barista makeCoffee waiter orderDrinks sommelier getWine

    kitchen orderMeal updateStock storeroom sommelier storeroom barista
  19. Testability barista makeCoffee waiter orderDrinks getWine kitchen orderMeal updateStock storeroom

    sommelier storeroom
  20. Latency barista makeCoffee waiter orderDrinks getWine kitchen orderMeal updateStock storeroom

    sommelier
  21. How we solve these challenges at Platform.sh

  22. A bit of background... At Platform.sh, Git is our API

  23. Continuous deployment cloud hosting for web applications

  24. Complete development to production lifecycle Opinionated but flexible, integrates with

    any toolchain, any workflow Multiple applications/containers per project Complete environment for every git branch On-the-fly cloning of production into staging clusters in less than a minute Zero admin chores (it’s not DevOps, its NoOps)
  25. Text Production is an artifact of deployment Describe your environment

    in .platform.app.yaml Commit to Git Push to platform.sh We run your packaging scripts, build your environments, network them, run deploy hooks, and serve the result.
  26. None
  27. Supported service types

  28. Git-driven orchestration infrastructure • Software changes • Git semantics are

    great for change • When your software changes, your git hash changes • With Platform.sh, when your infrastructure OR software changes, your git hash changes. • Your infrastructure is ALWAYS consistent with your application
  29. Git as Hypermedia APIDays Paris 2014 by Ori Pekelman https://youtu.be/fT52GtCzkqQ

  30. Advantages 1. Test in isolation 2. All builds are repeatable

    3. No “production only” bugs 4. Inspect the entire history of your production system 5. Build and release faster 6. Less bugs, less rework*
  31. Monolithic, all in one Microservices Real world API problems

  32. Operational Complexity barista makeCoffee waiter orderDrinks sommelier getWine kitchen orderMeal

    updateStock storeroom
  33. barista makeCoffee waiter orderDrinks sommelier getW ine kitchen orderMeal updateStock

    storeroom Dependency & testability
  34. makeCoffee waiter orderDrinks getW ine kitchen orderMeal updateStock barista barista

    makeCoffee waiter orderDrinks sommelier getW ine kitchen orderMeal updateStock storeroom master barista_feature sommelier storeroom Dependency & testability
  35. barista makeCoffee waiter orderDrinks getW ine kitchen orderMeal updateStock sommelier

    storeroom makeCoffee waiter orderDrinks getW ine kitchen orderMeal updateStock barista barista makeCoffee waiter orderDrinks sommelier getW ine kitchen orderMeal updateStock storeroom master barista_feature sommelier_feature sommelier storeroom Dependency & testability
  36. barista makeCoffee waiter orderDrinks getW ine kitchen orderMeal updateStock sommelier

    storeroom makeCoffee waiter orderDrinks getW ine kitchen orderMeal updateStock barista makeCoffee waiter orderDrinks getW ine kitchen orderMeal updateStock sommelier storeroom barista barista makeCoffee waiter orderDrinks sommelier getW ine kitchen orderMeal updateStock storeroom master barista_feature sommelier_feature integration_test sommelier storeroom Dependency & testability
  37. Everything is a microservice barista makeCoffee waiter orderDrinks sommelier getWine

    kitchen orderMeal updateStock storeroom
  38. Redis makeCoffee PHP 7.0 orderDrinks getWine NodeJS orderMeal updateStock MySQL

    PHP 5.6 Everything is a microservice
  39. What does that look like? /project_root /.plaform services.yaml routes.yaml /kitchen

    .platform.app.yaml … code /sommelier .platform.app.yaml … code /waiter .platform.app.yaml … code
  40. But wait, there’s more...

  41. Add a secondary API to an existing application, on a

    subdomain CMS API Database
  42. Split an API into multiple sub-APIs microcontainers with different dependencies

    and runtimes, all testable User API PHP 5.6 Database Content API PHP 5.7 Image API NodeJS Front controller - NodeJS
  43. Run background tasks from a secondary container API Task runner

    Database RabbitMQ
  44. Christopher Skene Regional Manager, APAC chris.skene@platform.sh 0422 969 899 https://platform.sh