microservice architecture

44

Upload: xavier-fornes

Post on 10-May-2015

1.599 views

Category:

Technology


3 download

DESCRIPTION

Microservice architecture definition and common characteristics when using this architecture style

TRANSCRIPT

Page 1: Microservice architecture
Page 2: Microservice architecture
Page 3: Microservice architecture

Hello, my name is ...

Xavier Fornés (@xfornesa)

http://www.xavierfornes.com

Page 4: Microservice architecture

myTaste.com

Page 5: Microservice architecture

myTaste - World Wide

Page 6: Microservice architecture

About the content...

Page 7: Microservice architecture

New blog use case

Page 8: Microservice architecture

What’s the problem?

Problem● Shared functionality across two applications

Solution● Duplicate implementation● Share a library

Page 9: Microservice architecture

Our CTO said...

Page 10: Microservice architecture

What’s the problem?

Problem● Shared functionality across two applications● Independently deployable

Solution● Duplicate implementation● Share a library● Implement a micro-Service

Page 11: Microservice architecture

Hands on...

Specialist team (focused on technology layer):● UI Teams● Server-side logic teams● Database teams

Page 12: Microservice architecture

...

Page 13: Microservice architecture

Conways law

Page 14: Microservice architecture

Conways law

Any organization that designs a system (defined broadly) will procedure a design whose structure is a copy of the organization’s communication structure.

-- Melvyn Conway, 1967

Page 15: Microservice architecture

Cross-functional teams

Page 16: Microservice architecture

Development Build Deploy Maintenance

A-Team Ops-Team M-Team

Project model

Page 17: Microservice architecture

Develop products

Page 18: Microservice architecture

Development Build Deploy Maintenance

A-Team

Product model

Page 19: Microservice architecture

It’s about freedom

Tip: Use the right tool for the job

But…Just because you CAN do something, doesn’t

mean you should!

Page 20: Microservice architecture

Service boundaries

It’s useful thinking on bounded contexts from DDD

Let’s each service manage its own database

Page 21: Microservice architecture

Decentralizing data

Page 22: Microservice architecture

Downsides: Manage updates

Shared model● Use transactions● Temporal coupling of data

Decentralized model● Transaction less coordination between

services● Compensating operations

Page 23: Microservice architecture

Downside: Allocating responsibility

Problems● No clear boundary responsibilities● Move responsibilities across components

Page 24: Microservice architecture

Communication patterns

Change of mentality

Problem● Naive conversion from in-memory method

calls to RPC leads to chatty communications● Remote calls costly

Solution● Coarser-grained communication

Page 25: Microservice architecture

Pipeline

Page 26: Microservice architecture

Design for failure

MonitoringTo be sure all is working fine

Types:● Architecture elements (# queries to db)● Business metrics (#users registered)

Page 27: Microservice architecture

Evolutionary design

Problems● Versioning problems● Evolute monolith core to micro-services● Service cohesion

Page 28: Microservice architecture

Summary

Page 29: Microservice architecture

Micro-service architecture

A no definition:

“A particular way of designing software applications as suites of independently deployable services.”

Page 30: Microservice architecture

Monolith apps vs micro-service

Single logical executableThree parts:● Client-site (UI)● Server-side (app)● Database (data)Problems:● One change => Full app deployment● Good modular structure hard to keep● Scaling full application

Page 31: Microservice architecture

Characteristics

Common characteristics:● Componentization via services● Organization around Business capabilities● Products not projects● Smart endpoints and dump pipes● Decentralized Governance● Decentralized Data Management● Infrastructure automation● Design for failure● Evolutionary Design

Page 32: Microservice architecture

Componentization via services

Something independently replaceable & upgradeable

Remote calls are expensive

Micro-service:● Own services● Own domain● Own database

Page 33: Microservice architecture

Teams organized around Business capabilities

Segregation of teams:● Specialists teams (by technology)● Cross-functional

Application architecture:● When siloed application architecture● When cross-functional teams

Page 34: Microservice architecture

Products not projects

Team responsible of one product in each step:● Development● Build● Deployment● Maintenance

“You built it, you run it”

Page 35: Microservice architecture

Smart endpoints & dump pipes

Communication patterns

Avoid chatty communications

Unix approach => Well defined services

Pipes act as filters

Page 36: Microservice architecture

Decentralized Governance

Choose best technology for each problem

“It’s about freedom”

Page 37: Microservice architecture

Decentralized Data Management

Bounded Contexts

Each micro-service with its own database

Avoid transactions (distributed trans.)

Compensation operations instead

Page 38: Microservice architecture

Infrastructure automation

Deployment should be boring

Trust your pipeline:● Unit & functional tests [dev]● Acceptance tests [build]● Integration tests [staging]● User acceptance tests [UAT]● Performance tests [Pre-prod]

Page 39: Microservice architecture

Design for failure

Monitoring● Architecture elements

○ ex: # of database queries● Business metrics

○ ex: # users registered

Page 40: Microservice architecture

Evolutionary design

Versioning problem, as a last resource

Monolith core but evolution with micro-services

Split components into services

Service cohesion => merge services when changing together

Page 42: Microservice architecture

What about Silex?

Sorry, no time left

No code, no mentions, but I promise to publish something on github :)

But ...http://www.slideshare.net/hhamon/silex-meets-soap-resthttp://sleep-er.co.uk/blog/2013/Creating-a-simple-REST-application-with-Silex/https://github.com/vesparny/silex-simple-rest… and so on ...

Page 43: Microservice architecture

Thank you

Questions?

Don’t you prefer a beer instead?

Page 44: Microservice architecture