Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Migrating to microservices.


Published on

A practical example of how to scale a monolithic application and the path to change it to a microservices infrastructure.

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

Migrating to microservices.

  1. 1. Migrating to microservices. What happens next will shock you. (Clickbait free) Raúl Marrero Rodríguez PyDayTF18 La Laguna, Tenerife (Spain)
  2. 2. Any resemblance to actual persons, living or dead, or actual events is purely coincidental.
  3. 3. This could be anyone This is Marcos Zucorbel CS Student Social App using Django The name of the site will be `FlakeBooth`
  4. 4. User registration and login Upload texts and share them with other users Upload pictures User profile page
  5. 5. Server
  6. 6. Friends (Social life) Chat (WS) Events Pages Notifications
  7. 7. Too many requests (Part 1)
  8. 8. Too many requests (Part 2)
  9. 9. DB queries get slow
  10. 10. What can Marcos do?
  11. 11. Microservices
  12. 12. Sure, I can be like Netflix!
  13. 13. Hint: no
  14. 14. Starting the migration For simplicity: Only chat, notifications, and posts features will be available.
  15. 15. Ok, let’s see what happens if we scale up
  16. 16. Chat pipeline complete!
  17. 17. Let’s go with HTTP (posts)
  18. 18. Ok, now we are Netflix!
  19. 19. What about authentication? We need a way to add auth to WS We need a way to add auth to HTTP
  20. 20. Introducing: API Gateway Unique entrypoint (routing) Adds authentication Service Discovery High scalable High available
  21. 21. First approach
  22. 22. Yay! Are we Netflix yet?
  23. 23. Interesting tools Our system is more complex. We need to debug, log, monitorize, etc.
  24. 24. Logging (ELK Stack)
  25. 25. Monitoring (Prometheus) Logs are nice, but metrics can help
  26. 26. Monitoring (Grafana)
  27. 27. We can add TVs in the office, and that’s cool!
  28. 28. Alerts (alertmanager) Because sleeping is for noobs
  29. 29. Docker Microservices in containers are easier to maintain
  30. 30. Container orchestration (Docker Swarm)
  31. 31. Container orchestration (Kubernetes)
  32. 32. Common mistakes
  33. 33. Not thinking in a distribute way Scale up / Scale Down Database race conditions Functionality isolation Scalability level (http interface)
  34. 34. Ok, now. We are Netflix, right?
  35. 35. Well, you don’t have to be Netflix
  36. 36. Conclusion Pros High scalability (and independent) Polyglot applications Parallel development Feature isolation Frequent deployment Failure tolerance Cons Increased operations efforts (monitoring, etc) Less safe (multiple entry points) More people needed Independent pipeline per microservice Transaction safety
  37. 37. Interesting references ● ● ● ●
  38. 38. Thank you! Questions?