Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Nodepb - Breaking Down the Monolith

Nodepb - Breaking Down the Monolith

How we broke down our monolith and what we learned from it.

http://www.meetup.com/nodebp/events/229220584/

1e2275ae49fccaa79d88fa6539492640?s=128

Peter Marton

March 30, 2016
Tweet

Transcript

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

  2. whoami - work: CTO, Co-founder of RisingStack, Inc. - twitter:

    slashdotpeter - email: peter@risingstack.com - blog: https://blog.risingstack.com
  3. Agenda - Monolith and Microservices - Advantages of Microservices -

    Disadvantages of Microservices - How we did
  4. Monolith - Self-contained - Responsible for multiple task - Independent

    from other services
  5. 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/
  6. What is ? - Our product (RisingStack) - Microservice monitoring

    tool - With distributed stack traces - Built with Node.js - Built as a monolith in MVP phase
  7. Why we moved?

  8. Microservices at RisingStack - Growing engineering team - Fault tolerance

    - Well focused service teams - Easier to scale - Well separated features
  9. Fault tolerance

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

  11. Fault tolerance - Separated services - Single point of failure

    should be cached - Event sourcing
  12. ~Event sourcing

  13. Complexity

  14. Where we started

  15. Where we are

  16. What if it breaks?

  17. Lot’s of logs

  18. Where is the issue?

  19. ...there

  20. Response time

  21. Even with very fast services

  22. ...you can have a slow app :(

  23. Because of network delays

  24. That’s why we are leaving PaaS - AWS Elastic Beanstalk

    - VPC -> internal routing - Docker - Etcd with confd - $$$ efficient?
  25. 600 ms -> 200 ms

  26. Network delay is evil in microservices

  27. “Smart” proxy

  28. Proxy - Route requests to services - Authorize requests via

    access-service - Decorate flippers (feature flag) - Rewrite urls - Evolutionary design - Everything is stateless REST between services
  29. Request signing

  30. 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
  31. Service teams

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

  33. Service principles

  34. 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...
  35. Documented API - Enforce documentation - Create service mocks from

    docs - Auto update docs from GitHub repository - Make it available for everyone
  36. Documented API - apiary

  37. Project management

  38. Changes - Multiple teams - Cross dependencies - Sprints

  39. None
  40. None
  41. Thanks! trace.risingstack.com