Microservices Architecture

75
μServices Architecture

description

Modern HA applications in nowadays are developed with set of small focused and discrete microservices. It's a trending concept and opens/solves questions like maintenance, scaling, live-deployments, security, fault-tolerance etc.

Transcript of Microservices Architecture

Page 1: Microservices Architecture

μServices Architecture

Page 2: Microservices Architecture

● SA at EPAM Systems

● primary skill is Java

● hands-on-coding with Groovy, Ruby

● trying to learn some Scala and Erlang

● passionate about agile, clean code and devops

Izzet Mustafayev@EPAM Systems@webdizz webdizz izzetmustafaievhttp://webdizz.name

Page 3: Microservices Architecture

Agenda● What is this?

● Architecture

● Case study

● Existing tools

● Summary

● How to get there?

● Q&A

Page 4: Microservices Architecture
Page 5: Microservices Architecture
Page 6: Microservices Architecture

● Small (10-100 LOC)

Overview

Page 7: Microservices Architecture

● Small (10-100 LOC)

● Lightweight (run several per box)

Overview

Page 8: Microservices Architecture

● Small (10-100 LOC)

● Lightweight (run several per box)

● Takes strength of platform/language (polyglot)

Overview

Page 9: Microservices Architecture

● Small (10-100 LOC)

● Lightweight (run several per box)

● Takes strength of platform/language (polyglot)

● Independent (development/deployment)

Overview

Page 10: Microservices Architecture

● Small (10-100 LOC)

● Lightweight (run several per box)

● Takes strength of platform/language (polyglot)

● Independent (development/deployment)

● Stateless (everything persisted in DB)

Overview

Page 11: Microservices Architecture

● Small (10-100 LOC)

● Lightweight (run several per box)

● Takes strength of platform/language (polyglot)

● Independent (development/deployment)

● Stateless (everything persisted in DB)

● Monitored (health and business value)

Overview

Page 12: Microservices Architecture

● Design● Implementation● Delivery● Monitoring

Architecture

Page 13: Microservices Architecture

Design

● What ab SOA?● Externalize Configuration● Versioning● Communication Contract● Asynchronicity● Reusability● Scalability● Availability

Page 14: Microservices Architecture

What ab SOA?

● Sensible idea● Combat challenges of large monolithic

applications● Lack of guidance

Page 15: Microservices Architecture

Externalize Configuration

● Support for X > 1 environments● Run-time changes

Page 16: Microservices Architecture

Versioning

● Leave multiple old microservice versions running● Fast introduction vs. slow retirement asymmetry

Page 17: Microservices Architecture

Communication Contract

● Own service - own client● Thin transport

Page 18: Microservices Architecture

Asynchronicity

● Non-blocking● Reactive model ● Messaging to send and forget

Page 19: Microservices Architecture

Reusability

● Each service does one dedicated thing● Utilize suitable components/frameworks

Page 20: Microservices Architecture

● Cohesive● Stateless● Independent

Scalability

Page 21: Microservices Architecture

● Fault-tolerance● Introduce failures

Availability

Page 22: Microservices Architecture

Implementation

● Separate Concerns

Page 23: Microservices Architecture

Separate Concerns

● Inverse Conway’s law – teams own service groups

Page 24: Microservices Architecture

Separate Concerns

● Inverse Conway’s law – teams own service groups

● One “verb” per single function microservice

Page 25: Microservices Architecture

Separate Concerns

● Inverse Conway’s law – teams own service groups

● One “verb” per single function microservice

● One developer independently produces a

microservice

Page 26: Microservices Architecture

Separate Concerns

● Inverse Conway’s law – teams own service groups

● One “verb” per single function microservice

● One developer independently produces a

microservice

● Each microservice is it’s own build

Page 27: Microservices Architecture

Separate Concerns

● Inverse Conway’s law – teams own service groups

● One “verb” per single function microservice

● One developer independently produces a

microservice

● Each microservice is it’s own build

● Stateful cached data access layer

Page 28: Microservices Architecture

Separate Concerns

● Inverse Conway’s law – teams own service groups

● One “verb” per single function microservice

● One developer independently produces a

microservice

● Each microservice is it’s own build

● Stateful cached data access layer

● Lightweight mocked dependencies

Page 29: Microservices Architecture

Separate Concerns

● Inverse Conway’s law – teams own service groups

● One “verb” per single function microservice

● One developer independently produces a

microservice

● Each microservice is it’s own build

● Stateful cached data access layer

● Lightweight mocked dependencies

● Easy to run locally

Page 30: Microservices Architecture

Delivery

● Disposability● Containerisation

Page 31: Microservices Architecture

● Build● Run ● Destroy

Disposability

Page 32: Microservices Architecture

● Container as deployment artifact● Environment agnostic● New version - new container● All dependencies built in

Containerisation

Page 33: Microservices Architecture

● Blue-green pattern● Feature toggle● Database migration/versioning

Zero-down-time

Page 34: Microservices Architecture

Frequency

● Fast rollouts● Fast rollbacks

Page 35: Microservices Architecture

● Technical● Business● Stats

Monitoring

Page 36: Microservices Architecture

● Hardware monitoring● Resources utilisation● Health checking

Technical monitoring

Page 37: Microservices Architecture

● Business aware metrics● A/B testing metrics

Business monitoring

Page 38: Microservices Architecture

● Increased traffic velocity makes individual events less important

● More vertical components requires more measurement

● Failure Rate is more informative than individual failures

Stats matter on scale

Page 39: Microservices Architecture

Benefits

Page 40: Microservices Architecture

● Polyglot technology stack● Polyglot persistence● Frameworks● Thin transport

Toolset unchained

Page 41: Microservices Architecture

● HTTP stack ● Independent provisioning ● Fine tuning ● Elasticity

Scalability

Page 42: Microservices Architecture

● Development● Testing● Deployment● Reliability

Independence

Page 43: Microservices Architecture

Shortcomings

Page 44: Microservices Architecture

● More responsibility from Devs to support Ops

Shortcomings

Page 45: Microservices Architecture

● More responsibility from Devs to support Ops

● Polyglot infrastructure (if any)

Shortcomings

Page 46: Microservices Architecture

● More responsibility from Devs to support Ops

● Polyglot infrastructure (if any)

● Orchestration

Shortcomings

Page 47: Microservices Architecture

● More responsibility from Devs to support Ops

● Polyglot infrastructure (if any)

● Orchestration

● Costs

Shortcomings

Page 48: Microservices Architecture
Page 49: Microservices Architecture

Twitter before

Page 50: Microservices Architecture
Page 51: Microservices Architecture

Twitter now*

Page 52: Microservices Architecture

Twitter requests

Page 53: Microservices Architecture

● Speed wins in the marketplace

Lessons learned

Page 54: Microservices Architecture

● Speed wins in the marketplace

● Remove friction from product development

Lessons learned

Page 55: Microservices Architecture

● Speed wins in the marketplace

● Remove friction from product development

● High trust, low process

Lessons learned

Page 56: Microservices Architecture

● Speed wins in the marketplace

● Remove friction from product development

● High trust, low process

● Freedom and responsibility culture

Lessons learned

Page 57: Microservices Architecture

● Speed wins in the marketplace

● Remove friction from product development

● High trust, low process

● Freedom and responsibility culture

● Simple patterns automated by tooling

Lessons learned

Page 58: Microservices Architecture

● Speed wins in the marketplace

● Remove friction from product development

● High trust, low process

● Freedom and responsibility culture

● Simple patterns automated by tooling

● Microservices for speed and availability

Lessons learned

Page 59: Microservices Architecture

● Speed wins in the marketplace

● Remove friction from product development

● High trust, low process

● Freedom and responsibility culture

● Simple patterns automated by tooling

● Microservices for speed and availability

● Use statistics to monitor behavior

Lessons learned

Page 60: Microservices Architecture

Toolset

● Dropwizard● Spring Boot● Vert.X● More...

Page 61: Microservices Architecture

Dropwizard http://dropwizard.github.io/dropwizard/

Java framework for developing ops-

friendly, high-performance, RESTful

web services.

- pulls together stable, mature libraries from

the Java ecosystem into a simple, light-weight

package

- has out-of-the-box support for sophisticated

configuration, application metrics, logging,

operational tools, and much more

Page 62: Microservices Architecture

Spring Boot http://projects.spring.io/spring-boot/

Takes an opinionated view of

building production-ready Spring

applications.

- favors convention over configuration and is

designed to get you up and running as quickly

as possible.

- production-ready features such as metrics,

health checks and externalized configuration

Page 63: Microservices Architecture

Vert.X http://vertx.io/

● Lightweight, reactive, application

platform

● Superficially similar to Node.js -

but not a clone!

● Inspired also from Erlang/OTP

● Polyglot

● High performance

● Simple but not simplistic

Page 64: Microservices Architecture

More...

● Ratpack http://www.ratpack.io/

● Sinatra http://www.sinatrarb.com/

● Webbit https://github.com/webbit/webbit

● Finagle http://twitter.github.io/finagle/

● Connect http://www.senchalabs.org/connect/

● XDropWizard https://github.com/timmolter/XDropWizard

Page 65: Microservices Architecture

Summary

Page 66: Microservices Architecture

Summary● Speed wins in the marketplace

Page 67: Microservices Architecture

Summary● Speed wins in the marketplace

● Separated concerns at app level

Page 68: Microservices Architecture

Summary● Speed wins in the marketplace

● Separated concerns at app level

● Focused and automated

Page 69: Microservices Architecture

Summary● Speed wins in the marketplace

● Separated concerns at app level

● Focused and automated

● Elastically scalable

Page 70: Microservices Architecture

Summary● Speed wins in the marketplace

● Separated concerns at app level

● Focused and automated

● Elastically scalable

● Polyglot architecture

Page 71: Microservices Architecture

● Automate repeating activities● “Run what you wrote” – root access and duty● Freedom and responsibility for developers

How to get there?

Page 73: Microservices Architecture

Q&A

Page 74: Microservices Architecture
Page 75: Microservices Architecture

Izzet Mustafayev@EPAM Systems@webdizz webdizz izzetmustafaievhttp://webdizz.name