17
Adventures with micro-Services Mohit Thatte (@mohitthatte) Jesal Mistry (@jesalnmistry) Thought Works Inc.

Adventureswith micro services

Embed Size (px)

Citation preview

Page 1: Adventureswith micro services

Adventures with

micro-ServicesMohit Thatte (@mohitthatte)

Jesal Mistry (@jesalnmistry)

ThoughtWorks Inc.

Page 2: Adventureswith micro services

What?

Why?

How?

When?

Page 3: Adventureswith micro services

Components

Library Service

Page 4: Adventureswith micro services

What are micro services?

small independent composable

services

that do one thing well

Page 5: Adventureswith micro services

Unix philosophyWrite programs that do one thing well.

Write programs that work together.

cat | grep | sed | awk | ...

HTTP is the new pipe!

Page 6: Adventureswith micro services

lots of legacy, no reuse

not flexible, high cost of change

no one knows how it works

concentrated complexity

independent small that do one thingcomposable

90 year old business

Page 7: Adventureswith micro services

“A 100k loc app is just 100 1k loc appswaiting to happen”

- Jeff Bay

Page 8: Adventureswith micro services

Adventure so far

25 VM’s in production

10+ micro-services

one click deployment

60+ VM’s acrossenvironments

Page 9: Adventureswith micro services

µService

DB

µService

DB

µService

DB

µService

DB

Page 10: Adventureswith micro services

Orders PaymentsCustomersLegacy ResultsOrderProcessing

Catalog(Games)

Page 11: Adventureswith micro services

Thumb Rules

1 top level resource (2 at most)

bounded contexts

focus on contracts

avoid coupling

idempotent jobs

extract cross cutting concerns

Page 12: Adventureswith micro services

Orders PaymentsCustomers

Communications

Legacy ResultsOrderProcessing

ScheduledJobs

Errorreporting

Catalog(Games)

Page 13: Adventureswith micro services

Continuous Delivery

Is my code good to go to production?

Can I deploy it in a single click?

Page 14: Adventureswith micro services

“we’re effectively pushing thecomplexity from the application

into the infrastructure...”

- James Lewis

Page 15: Adventureswith micro services

CI + DevOpsenables

single-click deployment

so easy, our product owner does it!

it just works™

3 mins to production (~25 servers)

Page 16: Adventureswith micro services

Puppet Solo

Provisioning begins at home - Vagrant

Puppet goes through CI just like app code

Our ideal : ImmutableServer

Provisioning

Page 17: Adventureswith micro services

Tradeoffs

benefit cost

small units of reuse/maintenance complex infrastructure

grow independently (**polyglot) network overhead

scale independently fragmented data

“easier” to grok “harder” to grok

isolated boundaries coarse-grained API

logging / tracing