micro services - files.meetup.com · communication! • mostly over http and pass json between...

Post on 07-Jul-2020

5 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Micro Services

Prasanna N Venkatesan Developer with ThoughtWorks

http://prasans.info/blog @pvenk

Expect for…

Expect for…

•  What are Micro services?

•  Why we need a new pattern?

•  Implementing a Micro Service

•  When to use Micro Services

•  Implications of using Micro Services

Write programs that do one

thing and do it well.

Micro Services should be…

Small

• aka Simple

• In terms of LOC.

• In terms of memory footprint.

Micro Services should be…

Portable

Should be independent to deploy and run

Micro Services should be…

Performs one thing

Adding many functionality to one service

will break the other 2 characteristics.

Move the complexity to

Infrastructure

We've  pushed  a  lot  of  the  old  applica2on  complexity  down  to  infrastructure  level.  We  are  no  longer  bound  to  a  single  stack  or  language.      

Micro Services

A new Paradigm?

Small is beautiful

Make each program do one

thing well.

Build a prototype as soon as possible.

Choose portability over efficiency.

Use software leverage to your

advantage.

Make every program as filter.

UNIX Philosophy

Consumer-Driven Contracts

Read  more  on:  h?p://mar2nfowler.com/ar2cles/consumerDrivenContracts.html  

• Provider Contracts

• Consumer Contracts

• Consumer Driven Contracts

• Closed and complete

•  Singular and non­authoritative

• Bounded stability and

immutability

Domain Driven Design

•  Project's  primary  focus  on  the  core  domain  and  domain  logic.  

•  Complex  designs  based  on  a  model  of  the  domain.  

•  Itera2vely  refine  a  conceptual  model  that  addresses  par2cular  domain  problems.  

Communication      

•  Mostly over HTTP and pass JSON between services.

•  If serialization or de-serialization is expensive try

something like ProtoBuf/MessagePack

•  ProtoBuf - Google uses Protocol Buffers for almost

all of its internal RPC protocols and file formats.

Monitoring

•  More possibility of small services to

just fail and fade away.

•  Make sure services are running always

•  Monitor usage and increase instances

Monitoring Tools

Testing Strategy

•  Tes2ng  Micro  Services  are  not  so  cri2cal.  

•  Preferably  have  health-­‐check  tests    in  CI.  

Where to use Micro Services

•  Independent, small process worthy to try out in

different stack.

•  Don’t want to break a legacy system.

Implications

•  Understanding how everything fits together

•  Deployment

•  Interactions between components

•  Duplication of code across the services

top related