Slide 1

Slide 1 text

Scaling APIs with Microservices: The Platform.sh experience Christopher Skene Regional Manager, APAC with Ori Pekelman

Slide 2

Slide 2 text

This is Ori

Slide 3

Slide 3 text

Monolithic, all in one service API linked services Consistency and reproducibility

Slide 4

Slide 4 text

REST

Slide 5

Slide 5 text

APIs bridge gaps between two sets of semantics

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Opacity & semantics

Slide 8

Slide 8 text

Imagine an imaginary menagerie… (of services)

Slide 9

Slide 9 text

Cafe-as-a-Service waiter

Slide 10

Slide 10 text

Simple API barista makeCoffee

Slide 11

Slide 11 text

Not so Simple after all barista makeCoffee Queue

Slide 12

Slide 12 text

Public API barista makeCoffee waiter orderCoffee

Slide 13

Slide 13 text

Service API barista makeCoffee waiter orderMeal kitchen sommelier getWine cook Food

Slide 14

Slide 14 text

Hydra API barista orderWine kitchen sommelier orderCoffee orderFood cashier updateBill

Slide 15

Slide 15 text

Applications built with APIs evolve and get messy... barista makeCoffee waiter orderDrinks sommelier getWine kitchen orderMeal updateStock storeroom

Slide 16

Slide 16 text

Challenges of API-based architectures

Slide 17

Slide 17 text

Operational Complexity barista makeCoffee waiter orderDrinks sommelier getWine kitchen orderMeal updateStock storeroom

Slide 18

Slide 18 text

Dependency and version management barista makeCoffee waiter orderDrinks sommelier getWine kitchen orderMeal updateStock storeroom sommelier storeroom barista

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

Latency barista makeCoffee waiter orderDrinks getWine kitchen orderMeal updateStock storeroom sommelier

Slide 21

Slide 21 text

How we solve these challenges at Platform.sh

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

Continuous deployment cloud hosting for web applications

Slide 24

Slide 24 text

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)

Slide 25

Slide 25 text

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.

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

Supported service types

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

Git as Hypermedia APIDays Paris 2014 by Ori Pekelman https://youtu.be/fT52GtCzkqQ

Slide 30

Slide 30 text

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*

Slide 31

Slide 31 text

Monolithic, all in one Microservices Real world API problems

Slide 32

Slide 32 text

Operational Complexity barista makeCoffee waiter orderDrinks sommelier getWine kitchen orderMeal updateStock storeroom

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

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

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

Everything is a microservice barista makeCoffee waiter orderDrinks sommelier getWine kitchen orderMeal updateStock storeroom

Slide 38

Slide 38 text

Redis makeCoffee PHP 7.0 orderDrinks getWine NodeJS orderMeal updateStock MySQL PHP 5.6 Everything is a microservice

Slide 39

Slide 39 text

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

Slide 40

Slide 40 text

But wait, there’s more...

Slide 41

Slide 41 text

Add a secondary API to an existing application, on a subdomain CMS API Database

Slide 42

Slide 42 text

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

Slide 43

Slide 43 text

Run background tasks from a secondary container API Task runner Database RabbitMQ

Slide 44

Slide 44 text

Christopher Skene Regional Manager, APAC [email protected] 0422 969 899 https://platform.sh