Microservices: Principles and in Practice

42
December 11th Microservices Principles and In Practice

Transcript of Microservices: Principles and in Practice

Page 1: Microservices: Principles and in Practice

December 11thMicroservices

Principles and In Practice

Page 2: Microservices: Principles and in Practice

Definition

“Small autonomous services that work together,

modelled around a business domain”- Sam Newman -

Building Microservices

Page 3: Microservices: Principles and in Practice

Microservices vs Monolithic services

- Martin Fowler -

Page 4: Microservices: Principles and in Practice

Microservices vs Monolithic services

- Philip Hauer -

When scaling.

Page 5: Microservices: Principles and in Practice

Principles of microservices

Page 6: Microservices: Principles and in Practice

Principle 01

Small Autonomous Services

Page 7: Microservices: Principles and in Practice

Principle 01 -Small autonomous services that work together

Merchant API

Admin API

Consumer API

Payment API

Page 8: Microservices: Principles and in Practice

Principle 01 -Small autonomous services that work together

Merchant API

Admin API

Consumer API

Payment API

Small??Autonomous Services?Work together

Page 9: Microservices: Principles and in Practice

Principle 01 -Small autonomous services that work together

Merchant API

Wallet API

Notifications APIEmployee Mgt API

CINCO Onboarding API Menu Related API

Rewards API

Page 10: Microservices: Principles and in Practice

Definition

“Small autonomous services that work together,

modelled around a business domain”- Sam Newman -

Building Microservices

Page 11: Microservices: Principles and in Practice

Principle 02

Business Domain BasedModelling

Page 12: Microservices: Principles and in Practice

Merchant API

Wallet API

Notifications APIEmployee Mgt API

CINCO Onboarding API Menu Related API

Rewards API

Principle 02 - Business Domain Based Modelling

Page 13: Microservices: Principles and in Practice

Principle 03

Culture of Automation

Page 14: Microservices: Principles and in Practice

Principle 03 - Culture of Automation

Automated TestingContinuous Delivery

Lot of upfront work for a transition

Page 15: Microservices: Principles and in Practice

Principle 04

Hide Implementation Details

Page 16: Microservices: Principles and in Practice

Principle 04 - Hide implementation Details

Merchant API

LEAPSET DB PROFILE

DB

Consumer API

Admin API

Payment API

Drastically impacts the ability to change

Page 17: Microservices: Principles and in Practice

Principle 04 - Hide implementation Details

Data Level APIs

LEAPSET DB

PROFILE DB

Merchant API

Easier said than done, of course.Especially for startups and where time to market is critical

Authentication Services

You need to make a request to get the data.People who manage these data level services can do their job

Page 18: Microservices: Principles and in Practice

Decentralization

Principle 05

Page 19: Microservices: Principles and in Practice

Microservices architecture boasts about autonomyMicroservices architecture optimizes around autonomy

Principle 05 - Decentralization

Page 20: Microservices: Principles and in Practice

● Do we still need to rely on another party to create a new server instances?

○ I know.. I know … checks and balances are required.. that’s fine.○ Practical issues...shush!

● Do we still rely on another party for deployment?○ Deserves a separate section on its own - Mr Mumtaz will cover it

● Do we have to communicate to all other teams in the Cake ecosystem for us to push a release

● Is it a one man show? What happens if “that man” is done and dusted?○ One centralized architect? Is he the guru for everything or is to

the team that comes together..Where is brainstorming? collective decision making? Many brains against one?

● Decentralization does not mean decentralizing everything

Principle 05 - Decentralization

Page 21: Microservices: Principles and in Practice

Principle 05 - Dumb Pipes

ESB

Merchant API Admin API Payment API IDM Other APIS

Clients

● Should not be domain aware● Cannot become too smart

Page 22: Microservices: Principles and in Practice

Principle 06

Consumer First

Page 23: Microservices: Principles and in Practice

Principle 06 - Consumer First

● Api Blueprint● Raml● Swagger

○ Features;■ Industry Standard - Open API Initiative (OAI) - Has announced

an open governance model around the Swagger Specification under the Linux Foundation.

■ Largest community and has been around since 2011. ■ Stub generators and Live documentation demo. Can be used

as interactive sandbox■ Open source 100%

○ Platform Swagger Url■ https://plat1-api.leapset.com:8343/sandbox/

Page 24: Microservices: Principles and in Practice

Principle 06 - Consumer First

Page 25: Microservices: Principles and in Practice

Principle 06 - Consumer First

● Service Discovery tools

Page 26: Microservices: Principles and in Practice

Principle 07

Isolate FailureObserve and Debug Failure

Page 27: Microservices: Principles and in Practice

Principle 07

● Log aggregation tools - make it highly observable.○ Logstash○ Just imagine logging into 40 servers to debug issues

● Tools that can be used for monitoring○ Cacti○ Nagios○ Graphite○ Grafana

Page 28: Microservices: Principles and in Practice

Principle 07

● AWS Autoscaling

● Correlation Ids

Page 29: Microservices: Principles and in Practice

Principle 08

Deploy Independently

Page 30: Microservices: Principles and in Practice

Virtual Machine vs Containers

Page 31: Microservices: Principles and in Practice

Docker

Docker allows you to package an application with all of its dependencies into a standardized unit for software development.

Page 32: Microservices: Principles and in Practice

Docker

● Lightweight● Open● Secure● Accelerate Developer Onboarding

○ Eliminate Environment Inconsistencies● Easily Share and Collaborate on Applications

○ Ship More Software Faster○ Portable○ Fast

Page 33: Microservices: Principles and in Practice

AWS Elastic Beanstalk

● An AWS Product● Infrastructure manager● Reduces management complexity without restricting choice or

control● Quickly deploy and manage applications in the AWS cloud

Page 34: Microservices: Principles and in Practice

Demo

Demo

Page 35: Microservices: Principles and in Practice

Demo

SF ConnectorCAKE Platform

Page 36: Microservices: Principles and in Practice

AWS Elastic Beanstalk

Page 37: Microservices: Principles and in Practice

Do we have a problem?

Page 38: Microservices: Principles and in Practice

Do we have a problem?

Page 39: Microservices: Principles and in Practice

Do we have a problem?

Page 40: Microservices: Principles and in Practice

A Solution

Amazon ECSAmazon EC2 Container Service

Page 42: Microservices: Principles and in Practice