23
Micro Services

Microservices

Embed Size (px)

DESCRIPTION

My talk on Jozi JUG about MicroServices on June 24th 2013. http://www.meetup.com/Jozi-JUG/events/118708272/

Citation preview

Page 1: Microservices

Micro Services

Page 2: Microservices

Prasanna N Venkatesan Developer with ThoughtWorks

http://prasans.info/blog @pvenk

Page 3: Microservices

Expect for…

Page 4: Microservices

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: Microservices

Write programs that do one

thing and do it well.

Page 6: Microservices

Micro Services should be…

Small

• aka Simple

• In terms of LOC.

• In terms of memory footprint.

Page 7: Microservices

Micro Services should be…

Portable

Should be independent to deploy and run

Page 8: Microservices

Micro Services should be…

Performs one thing

Adding many functionality to one service

will break the other 2 characteristics.

Page 9: Microservices

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: Microservices

Micro Services

A new Paradigm?

Page 11: Microservices

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: Microservices

Consumer-Driven Contracts

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

Page 13: Microservices
Page 14: Microservices

• Provider Contracts

• Consumer Contracts

• Consumer Driven Contracts

Page 15: Microservices

• Closed and complete

•  Singular and non­authoritative

• Bounded stability and

immutability

Page 16: Microservices

Domain Driven Design

Page 17: Microservices

•  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: Microservices

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: Microservices

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: Microservices

Monitoring Tools

Page 21: Microservices

Testing Strategy

•  Tes2ng  Micro  Services  are  not  so  cri2cal.  

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

Page 22: Microservices

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: Microservices

Implications

•  Understanding how everything fits together

•  Deployment

•  Interactions between components

•  Duplication of code across the services