Slide 1

Slide 1 text

Breaking Down the Monolith Péter Márton @slashdotpeter

Slide 2

Slide 2 text

whoami - work: CTO, Co-founder of RisingStack, Inc. - twitter: slashdotpeter - email: [email protected] - blog: https://blog.risingstack.com

Slide 3

Slide 3 text

Agenda - Monolith and Microservices - Advantages of Microservices - Disadvantages of Microservices - How we did

Slide 4

Slide 4 text

Monolith - Self-contained - Responsible for multiple task - Independent from other services

Slide 5

Slide 5 text

Microservice - Smaller services with separate DB - Split code by feature not by functionality - Feature teams (cross-functional) - More focused teams with distributed responsibility - Not for MVP! https://microserviceweekly.com/

Slide 6

Slide 6 text

What is ? - Our product (RisingStack) - Microservice monitoring tool - With distributed stack traces - Built with Node.js - Built as a monolith in MVP phase

Slide 7

Slide 7 text

Why we moved?

Slide 8

Slide 8 text

Microservices at RisingStack - Growing engineering team - Fault tolerance - Well focused service teams - Easier to scale - Well separated features

Slide 9

Slide 9 text

Fault tolerance

Slide 10

Slide 10 text

If Trace goes down... who knows that you are down?

Slide 11

Slide 11 text

Fault tolerance - Separated services - Single point of failure should be cached - Event sourcing

Slide 12

Slide 12 text

~Event sourcing

Slide 13

Slide 13 text

Complexity

Slide 14

Slide 14 text

Where we started

Slide 15

Slide 15 text

Where we are

Slide 16

Slide 16 text

What if it breaks?

Slide 17

Slide 17 text

Lot’s of logs

Slide 18

Slide 18 text

Where is the issue?

Slide 19

Slide 19 text

...there

Slide 20

Slide 20 text

Response time

Slide 21

Slide 21 text

Even with very fast services

Slide 22

Slide 22 text

...you can have a slow app :(

Slide 23

Slide 23 text

Because of network delays

Slide 24

Slide 24 text

That’s why we are leaving PaaS - AWS Elastic Beanstalk - VPC -> internal routing - Docker - Etcd with confd - $$$ efficient?

Slide 25

Slide 25 text

600 ms -> 200 ms

Slide 26

Slide 26 text

Network delay is evil in microservices

Slide 27

Slide 27 text

“Smart” proxy

Slide 28

Slide 28 text

Proxy - Route requests to services - Authorize requests via access-service - Decorate flippers (feature flag) - Rewrite urls - Evolutionary design - Everything is stateless REST between services

Slide 29

Slide 29 text

Request signing

Slide 30

Slide 30 text

Request signing - Trusted sources (services) on public channel - https://github.com/joyent/node-http-signature - Built-in in request and super-request npm modules POST /foo HTTP/1.1 Host: example.org Date: Tue, 07 Jun 2014 20:51:35 GMT Content-Type: application/json Digest: SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE= Content-Length: 18

Slide 31

Slide 31 text

Service teams

Slide 32

Slide 32 text

Your services are products for your customers and co-workers!

Slide 33

Slide 33 text

Service principles

Slide 34

Slide 34 text

Service principles - max 3 depth call chains - always backward compatible endpoints - Do not version services, only endpoints - use flippers heavily - https://github.com/Yelp/service-principles - In progress...

Slide 35

Slide 35 text

Documented API - Enforce documentation - Create service mocks from docs - Auto update docs from GitHub repository - Make it available for everyone

Slide 36

Slide 36 text

Documented API - apiary

Slide 37

Slide 37 text

Project management

Slide 38

Slide 38 text

Changes - Multiple teams - Cross dependencies - Sprints

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

Thanks! trace.risingstack.com