Top Banner
μServices Architecture @ EPAM WOW 2015
80

µServices Architecture @ EPAM WOW 2015

Jul 16, 2015

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: µServices Architecture @ EPAM WOW 2015

μServices Architecture@ EPAM WOW 2015

Page 2: µServices Architecture @ EPAM WOW 2015

● SA at EPAM Systems

● primary skill is Java

● hands-on-coding with Groovy, Ruby

● trying to get in touch with Erlang/Elixir

● passionate about agile, clean code and devops

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

Page 3: µServices Architecture @ EPAM WOW 2015

Agenda● What is this?

● Architecture

● Case study

● Existing tools

● Summary

● How to get there?

● Q&A

Page 4: µServices Architecture @ EPAM WOW 2015
Page 5: µServices Architecture @ EPAM WOW 2015
Page 6: µServices Architecture @ EPAM WOW 2015

● Small (100s LOC)*

Overview

Page 7: µServices Architecture @ EPAM WOW 2015

● Small (100s LOC)*

● Lightweight (run several per box)

Overview

Page 8: µServices Architecture @ EPAM WOW 2015

● Small (100s LOC)*

● Lightweight (run several per box)

● Takes strength of platform/language (polyglot)

Overview

Page 9: µServices Architecture @ EPAM WOW 2015

● Small (100s LOC)*

● Lightweight (run several per box)

● Takes strength of platform/language (polyglot)

● Independent (development/deployment)

Overview

Page 10: µServices Architecture @ EPAM WOW 2015

● Small (100s LOC)*

● Lightweight (run several per box)

● Takes strength of platform/language (polyglot)

● Independent (development/deployment)

● Stateless (everything persisted/not persisted)

Overview

Page 11: µServices Architecture @ EPAM WOW 2015

● Small (100s LOC)*

● Lightweight (run several per box)

● Takes strength of platform/language (polyglot)

● Independent (development/deployment)

● Stateless (everything persisted/not persisted)

● Monitored (health and business value)

Overview

Page 12: µServices Architecture @ EPAM WOW 2015

● Design● Implementation● Delivery● Operation

Architecture

Page 13: µServices Architecture @ EPAM WOW 2015

Design● What ab SOA?● Domain-Driven Design● Versioning● Integration ● Reusability● Scalability● Availability● Asynchronicity● Externalization of Configuration

Page 14: µServices Architecture @ EPAM WOW 2015

What about SOA?

● Sensible idea● Lack of guidance● Combat challenges of large monolithic

applications

Page 15: µServices Architecture @ EPAM WOW 2015

Domain-Driven Design

Set of principles and patterns that● are closed to business● are closed to developers● to craft elegant object systems

Page 16: µServices Architecture @ EPAM WOW 2015

Versioning

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

Page 17: µServices Architecture @ EPAM WOW 2015

Integration

● Own service - own client● Client load balancer● Thin and efficient transport/protocol

Page 18: µServices Architecture @ EPAM WOW 2015

Reusability

● Cohesive logic● Usage of Components/Frameworks

Page 19: µServices Architecture @ EPAM WOW 2015

● Statelessness● Independency

Scalability

Page 20: µServices Architecture @ EPAM WOW 2015

● Fault-tolerance● Fast and small failures

Availability

Page 21: µServices Architecture @ EPAM WOW 2015

Asynchronicity

● Non-blocking operations● Reactive principles● Messaging

Page 22: µServices Architecture @ EPAM WOW 2015

Externalization of Configuration

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

Page 23: µServices Architecture @ EPAM WOW 2015

● Separation of Concerns● Caching

Implementation

Page 24: µServices Architecture @ EPAM WOW 2015

Separation Concerns

● Inverse Conway’s law – teams own service groups

Page 25: µServices Architecture @ EPAM WOW 2015

Separate Concerns

● Inverse Conway’s law – teams own service groups

● Each service is it’s own build

Page 26: µServices Architecture @ EPAM WOW 2015

Separate Concerns

● Inverse Conway’s law – teams own service groups

● Each service is it’s own build

● Lightweight mocked dependencies

Page 27: µServices Architecture @ EPAM WOW 2015

Separate Concerns

● Inverse Conway’s law – teams own service groups

● Each service is it’s own build

● Lightweight mocked dependencies

● Easy to run locally

Page 28: µServices Architecture @ EPAM WOW 2015

Caching

● Stateful cached data access layer

Page 29: µServices Architecture @ EPAM WOW 2015

Caching

● Stateful cached data access layer

● Expensive computational data

Page 30: µServices Architecture @ EPAM WOW 2015

Caching

● Stateful cached data access layer

● Expensive computational data

● Static resources/CDN/Mirroring

Page 31: µServices Architecture @ EPAM WOW 2015

● Immutability● Disposability● Containerisation● Zero-down-time● Frequency

Delivery

Page 32: µServices Architecture @ EPAM WOW 2015

● Build● Infrastructure● Infrastructure-as-code

Immutability

Page 33: µServices Architecture @ EPAM WOW 2015

● Build● Run ● Destroy

Disposability

Page 34: µServices Architecture @ EPAM WOW 2015

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

Containerisation

Page 35: µServices Architecture @ EPAM WOW 2015

● Blue-green● Multi-phased ● Feature toggle● Database migration/versioning

Zero-down-time

Page 36: µServices Architecture @ EPAM WOW 2015

Frequency

● Fast rollouts● Fast rollbacks

Page 37: µServices Architecture @ EPAM WOW 2015

● Service Discovery● Technical Monitoring● Business Monitoring● Stats

Operation

Page 38: µServices Architecture @ EPAM WOW 2015

● Services use services● Each service has own version● Decoupling still matters ● One-the-fly parameterisation

Service discovery

Page 39: µServices Architecture @ EPAM WOW 2015

● Hardware monitoring● Resources utilisation● Health checking

Technical monitoring

Page 40: µServices Architecture @ EPAM WOW 2015

● Business aware metrics● A/B testing metrics

Business monitoring

Page 41: µServices Architecture @ EPAM WOW 2015

● Increased traffic velocity makes individual events less important

● More vertical components require more measurement

● Failure Rate is more informative than individual failures

Stats matter on scale

Page 42: µServices Architecture @ EPAM WOW 2015

Benefits

Page 43: µServices Architecture @ EPAM WOW 2015

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

Toolset unchained

Page 44: µServices Architecture @ EPAM WOW 2015

● Independent provisioning ● Fine tuning ● Elasticity

Scalability

Page 45: µServices Architecture @ EPAM WOW 2015

● Development● Testing● Deployment● Reliability

Independence

Page 46: µServices Architecture @ EPAM WOW 2015

Shortcomings

Page 47: µServices Architecture @ EPAM WOW 2015

● More responsibility from Devs to support Ops

Shortcomings

Page 48: µServices Architecture @ EPAM WOW 2015

● More responsibility from Devs to support Ops

● Polyglot infrastructure (if any)

Shortcomings

Page 49: µServices Architecture @ EPAM WOW 2015

● More responsibility from Devs to support Ops

● Polyglot infrastructure (if any)

● Orchestration

Shortcomings

Page 50: µServices Architecture @ EPAM WOW 2015

● More responsibility from Devs to support Ops

● Polyglot infrastructure (if any)

● Orchestration

● Costs

Shortcomings

Page 51: µServices Architecture @ EPAM WOW 2015

● More responsibility from Devs to support Ops

● Polyglot infrastructure (if any)

● Orchestration

● Costs

● Dependency management

Shortcomings

Page 52: µServices Architecture @ EPAM WOW 2015

● More responsibility from Devs to support Ops

● Polyglot infrastructure (if any)

● Orchestration

● Costs

● Dependency management

● Distributed applications are complicated

Shortcomings

Page 53: µServices Architecture @ EPAM WOW 2015
Page 54: µServices Architecture @ EPAM WOW 2015

Twitter before

Page 55: µServices Architecture @ EPAM WOW 2015
Page 56: µServices Architecture @ EPAM WOW 2015

Twitter now*

Page 57: µServices Architecture @ EPAM WOW 2015

Twitter requests

Page 58: µServices Architecture @ EPAM WOW 2015

● Speed wins in the marketplace

Lessons learned

Page 59: µServices Architecture @ EPAM WOW 2015

● Speed wins in the marketplace

● Remove friction from product development

Lessons learned

Page 60: µServices Architecture @ EPAM WOW 2015

● Speed wins in the marketplace

● Remove friction from product development

● High trust, low process

Lessons learned

Page 61: µServices Architecture @ EPAM WOW 2015

● Speed wins in the marketplace

● Remove friction from product development

● High trust, low process

● Freedom and responsibility culture

Lessons learned

Page 62: µServices Architecture @ EPAM WOW 2015

● 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 63: µServices Architecture @ EPAM WOW 2015

● 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 64: µServices Architecture @ EPAM WOW 2015

● 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 65: µServices Architecture @ EPAM WOW 2015

Toolset

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

Page 66: µServices Architecture @ EPAM WOW 2015

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 67: µServices Architecture @ EPAM WOW 2015

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 68: µServices Architecture @ EPAM WOW 2015

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 69: µServices Architecture @ EPAM WOW 2015

More...

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

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

● Spark http://sparkjava.com/

● Compojure https://github.com/weavejester/compojure

● 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 70: µServices Architecture @ EPAM WOW 2015

Summary

Page 71: µServices Architecture @ EPAM WOW 2015

Summary● Speed wins in the marketplace

Page 72: µServices Architecture @ EPAM WOW 2015

Summary● Speed wins in the marketplace

● Separated concerns at app level

Page 73: µServices Architecture @ EPAM WOW 2015

Summary● Speed wins in the marketplace

● Separated concerns at app level

● Focused and automated

Page 74: µServices Architecture @ EPAM WOW 2015

Summary● Speed wins in the marketplace

● Separated concerns at app level

● Focused and automated

● Elastically scalable

Page 75: µServices Architecture @ EPAM WOW 2015

Summary● Speed wins in the marketplace

● Separated concerns at app level

● Focused and automated

● Elastically scalable

● Polyglot infrastructure

Page 76: µServices Architecture @ EPAM WOW 2015

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

How to get there?

Page 78: µServices Architecture @ EPAM WOW 2015

Q&A

Page 79: µServices Architecture @ EPAM WOW 2015
Page 80: µServices Architecture @ EPAM WOW 2015

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