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

23
Micro Services

Upload: others

Post on 07-Jul-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Micro Services

Page 2: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Prasanna N Venkatesan Developer with ThoughtWorks

http://prasans.info/blog @pvenk

Page 3: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Expect for…

Page 4: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

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

Page 5: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Write programs that do one

thing and do it well.

Page 6: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Micro Services should be…

Small

• aka Simple

• In terms of LOC.

• In terms of memory footprint.

Page 7: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Micro Services should be…

Portable

Should be independent to deploy and run

Page 8: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Micro Services should be…

Performs one thing

Adding many functionality to one service

will break the other 2 characteristics.

Page 9: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

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.      

Page 10: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Micro Services

A new Paradigm?

Page 11: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

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

Page 12: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Consumer-Driven Contracts

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

Page 13: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack
Page 14: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

• Provider Contracts

• Consumer Contracts

• Consumer Driven Contracts

Page 15: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

• Closed and complete

•  Singular and non­authoritative

• Bounded stability and

immutability

Page 16: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Domain Driven Design

Page 17: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

•  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.  

Page 18: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

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.

Page 19: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Monitoring

•  More possibility of small services to

just fail and fade away.

•  Make sure services are running always

•  Monitor usage and increase instances

Page 20: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Monitoring Tools

Page 21: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Testing Strategy

•  Tes2ng  Micro  Services  are  not  so  cri2cal.  

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

Page 22: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Where to use Micro Services

•  Independent, small process worthy to try out in

different stack.

•  Don’t want to break a legacy system.

Page 23: Micro Services - files.meetup.com · Communication! • Mostly over HTTP and pass JSON between services. • If serialization or de-serialization is expensive try something like ProtoBuf/MessagePack

Implications

•  Understanding how everything fits together

•  Deployment

•  Interactions between components

•  Duplication of code across the services