microservices and distributed monoliths - ilm...microservices and distributed monoliths @davidboike....

Post on 28-May-2020

27 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

https://refractingreflections.wordpress.com/tag/2001-a-space-odyssey/

Microservices and Distributed Monoliths

@DavidBoike

HTTP/JSON/“REST”

It’s the microservices way®™©MMXVII David Boike, All Rights Reserved

Comic Sans totally used on purpose

http://montages.no/2009/09/begrepet-grafisk-likhet/

Hops 1 2 3 4 10

Uptime 99.999% 99.998% 99.997% 99.996% 99.990%

Downtime/Year 5.3m 10.5m 15.8m 21m 52.6m

Five Nines (99.999% Uptime)

Hops 1 2 3 4 10

Uptime 99.990% 99.980% 99.970% 99.960% 99.900%

Downtime/Year 52.6m 1h 45m 2h 37m 3h 30m 8h 45m

Four Nines (99.99% Uptime)

Hops 1 2 3 4 10

Uptime 99.950% 99.900% 99.850% 99.800% 99.501%

Downtime/Year 4h 22m 8h 45m 13h 8m 17h 30m 43h 42m

Azure Multi-Instance VM (99.95% Uptime)

Hops 1 2 3 4 10

Uptime 99.900% 99.800% 99.700% 99.601% 99.004%

Downtime/Year 8h 45m 17h 30m 1d 2h 15m 1d 10h 59m 3d 15h 4m

Azure Single-Instance VM (99.9% Uptime)

Hops 1 2 3 4 10

Uptime 99.000% 98.010% 97.030% 96.060% 90.438%

Downtime/Year 3.65 days 7.26 days 10.84 days 14.38 days 34.9 days

Azure 25% Refund (99% Uptime)

Series & Parallel (with 99.99% nodes)

3 (99.97%)

3…

3

x30(.99993) 30 = .999990 = .99104

3.27 days downtime

(99.95%)90 = 16.06 days

Hops 1 2 3 4 10

Latency 100ms 200ms 300ms 400ms 1 second

Latency

Does not count any processing time!

Latency Matters

http://highscalability.com/blog/2009/7/25/latency-is-everywhere-and-it-costs-you-sales-how-to-crush-it.html

Amazon found every 100ms of latency cost them 1% in sales. Google found an extra .5 seconds in search page generation time dropped traffic by 20%. A broker could lose $4 million in revenues per millisecond if their electronic trading platform is 5 milliseconds behind the competition.

Types of Coupling

•Afferent/Efferent

•Platform

•Spatial

•Temporal

API

DAL

BL

Follow the Coupling

DB

UI

DAL

BL

Follow the Coupling

UI

DB

API

ServiceBus

Sea ofService BusGoodness

PERFORMANCE – RPC vs MESSAGING

With RPC, threads are allocated with load

With messaging, threads are independent

Difference due to synchronous blocking calls

Memory, DB locks, held longer with RPC

Throughput

Load

RPC

Messaging

async/await

NOT A FIX!

Quick Review

DAL

BL

Layers/API not the answer

UI

DB

API

ServiceBus

Sea ofService BusGoodness

Which service owns this page?

NONE!

Divide it up

Product Catalog

Pricing

Inventory

Cross Sell

Product

Catalog

Product Ratings

Pricing

Product

Catalog

Shipping

Product Ratings

Pricing

Product Catalog

Page Composition

Server

Product Catalog

Pricing

Inventory

Cross Sell

Product Ratings

Shipping

Building a view

• Microservice components deployed in web tier

• Microservices register interest in routes

• Fetch data based on routes

• Populate dynamic view model

• HTML/CSS owned by Branding service

Composed ViewModel

View

model

Component fromproduct-catalog

Component from finance

Component from marketing

{“products”: [{

{“productName”,“productPrice”,“productRating”

},{ ... }

}]}

How to make a grid?

Microservice SELECT N+1

How to make a grid

client-side message broker

Component fromproduct-catalog

Component from finance

Component from marketing

View

model

Component fromproduct-catalog

Component from finance

http://mydomain.com/products/123

Component from marketing

ProductNameA

€ 20.00

cover image

A

AuthorNameA

ProductNameB

€ 20.00

cover image

B

AuthorNameB

ProductNameC

€ 20.00

cover image

C

AuthorNameC

ProductNameD

€ 20.00

cover image

D

AuthorNameD

load relatedproducts

How to make a grid

client-side message broker

Component fromproduct-catalog

Component from finance

Component from marketing

View

model

Component fromproduct-catalog

Component from finance

http://mydomain.com/products/123

Component from marketing

ProductNameA

€ 20.00

cover image

A

AuthorNameA

ProductNameB

€ 20.00

cover image

B

AuthorNameB

ProductNameC

€ 20.00

cover image

C

AuthorNameC

ProductNameD

€ 20.00

cover image

D

AuthorNameD

publish `RelatedProductsFound`

load relatedproducts

receive event

How to make a grid

Component fromproduct-catalog

Component from finance

Component from marketing

View

model

Component fromproduct-catalog

Component from finance

http://mydomain.com/products/123

Component from marketing

ProductNameA

€ 20.00

cover image

A

AuthorNameA

ProductNameB

€ 20.00

cover image

B

AuthorNameB

ProductNameC

€ 20.00

cover image

C

AuthorNameC

ProductNameD

€ 20.00

cover image

D

AuthorNameD

load relatedproducts

DAL

BL

Vertical Slices, not Horizontal Layers

UI

DB

API

ServiceBus

Sea ofService BusGoodness

Divide it up

Product Catalog

Pricing

Inventory

Cross Sell

Product

Catalog

Product Ratings

Pricing

Product

Catalog

Shipping

Product Ratings

Pricing

Product Catalog

Thank you!

Apply systems design with

microservices

Get free access to the Advanced Distributed Systems Design course

go.particular.net/mdc17

make-awesome.com @DavidBoike david.boike@particular.net

top related