Microservices

62
μServices

description

Just sharing our experience with building Microservice systems.

Transcript of Microservices

Page 1: Microservices

μServices

Page 2: Microservices
Page 3: Microservices
Page 4: Microservices

28 000 000 page views per week

*Google Analytics v.17 2014

18 MINUTER time spend per visit*

55% 45%

Page 5: Microservices
Page 6: Microservices
Page 7: Microservices

A monolithic design is characterised by such a tight coupling among modules that they have no independent existence.

Page 8: Microservices

challenges• If one things fails, everything fails

• Can’t scale the database any further

• Expensive hardware

• Maintenance is scary

• Platinum support contract costs

Page 9: Microservices

Goals

• Scaling individual parts of the system

• Lower hardware costs

• No platinum support

• Environment to quickly evaluate ideas

Page 10: Microservices
Page 11: Microservices

Top inspirations• Larry Constantine - Structured Design (1960)

• Douglas McIlroy - Programs (1965)

• Ken Thompson - Unix (1973)

• Antony Williams - COM (1987)

• Udi Dahan - Autonomous Components (2004)

• Greg young - CQRS (2008)

• Fred George - Micro Services (2013)

Page 12: Microservices

–Ken Thompson, Unix Philosophy

“Write simple parts connected by clean interfaces.”

!

“Design programs to be connected to other

programs. “

Page 13: Microservices

–Mc Mcllroy, Unix Time-Sharing System Forward”. 1978

“Make each program do one thing well. To do a new job, build afresh rather than complicate old

programs by adding new features.” !

“Expect the output of every program to become the input to another, as yet unknown, program.”

Page 14: Microservices

–Greg Young

“A model can either be optimised for reading or for writing”

Page 15: Microservices

–Rob Pike

“Depend on others and fail together”

Page 16: Microservices

simple: easily understood or done

Page 17: Microservices

autonomous: acting independently

Page 18: Microservices

coupling is the degree to which each module relies on each one of the other modules.

Page 19: Microservices

“μServices should be made as small as possible, but not smaller”

Page 20: Microservices

Event Storming is a workshop format for quickly exploring complex business domains.

Page 21: Microservices
Page 22: Microservices

where does online status come from?

Page 23: Microservices
Page 24: Microservices

“No μService should ever depend on another being available”

Page 25: Microservices

“every view should be served by a single to one μService”

Page 26: Microservices

{!! name: bob ross,!! text: …!! portrait: {!! ! url: /m/f.jpg,!! ! isLiked: true,! ! }!! isOnline: true!! publicPhotos: … ! privatePhotos: [{!! ! url: /m/f.jpg!! ! hasAccess: true!! }]!}

GET /profile

Page 27: Microservices
Page 28: Microservices

where does the member live?

Page 29: Microservices
Page 30: Microservices

“No μService represents an business entity, but rather serves an expect of one”

Page 31: Microservices

μServices architecture

service

subscribe to events

publish events

accept http requests

GET /profile

event bus

storage

reads and write to own storage

Page 32: Microservices

“An μService is the smallest consistency boundary”

Page 33: Microservices

“μServices depends more on how the service fit into the environment than on how they are designed internally.”

Page 34: Microservices
Page 35: Microservices

“Polyglot developers still hate context switching”

Page 36: Microservices

“Clarity is better than cleverness”

Page 37: Microservices
Page 38: Microservices
Page 39: Microservices
Page 40: Microservices

“An μService is the smallest part of the system that can scale independently”

Page 41: Microservices
Page 42: Microservices
Page 43: Microservices
Page 44: Microservices
Page 45: Microservices
Page 46: Microservices
Page 47: Microservices
Page 48: Microservices
Page 49: Microservices
Page 50: Microservices
Page 51: Microservices
Page 52: Microservices
Page 53: Microservices

Shipping

Page 54: Microservices
Page 55: Microservices

“An μService doesn’t provide any value on its own”

Page 56: Microservices

“a μService is to μ to treat as a single product”

Page 57: Microservices
Page 58: Microservices
Page 59: Microservices

0

1750

3500

5250

7000

13:00 13:15 13:30 13:45

v13.like.count v14.like.count

Page 60: Microservices

ETCD• Simple, curl-able API (HTTP +

JSON)

• Benchmarked 1000s of writes/s per instance

• Properly distributed using Raft protocol

• Atomic test and set

• Easily listen for changes to a prefix via HTTP long-polling

Page 61: Microservices

Summary

Page 62: Microservices

You've been a great audience!already knew that when creating this slide