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.

Microservices - Peixe Urbano Tech Talks

540 views

Published on

Microservices brief presentation for Peixe Urbano's internal tech presentations promoted by its employees.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Microservices - Peixe Urbano Tech Talks

  1. 1. Microservices PU Tech Talks
  2. 2. What is a microservice?
  3. 3. " (...) an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API." Microservices Architecture Definition Martin Fowler Source: http://martinfowler.com/articles/microservices.html
  4. 4. What problems microservices can solve ?
  5. 5. Microservices help us to componentize our application avoiding the problems created by monolith architectures. Microservices Architecture Definition
  6. 6. But what is a component ?
  7. 7. A component is: Something independently replaceable. Something independently upgradeable.
  8. 8. How to identify a monolith design?
  9. 9. In a monolith architecture, our components are defined as libraries.
  10. 10. deployed into a single application. All pieces of your code organized as libraries ... Componentization via Libraries
  11. 11. Classic Monolithic Architecture
  12. 12. And what are the problems with a monolith design?
  13. 13. What happens when we need to scale this?
  14. 14. Node 1 Node 2 Node 3 Node N We got this! x N = ...
  15. 15. Scaling costs All resources need to be deployed into each new node. Code complexity You need to work on a large code base. Application availability You need to shut down all resources every deploy. Coupling code Easy to violate code boundaries. Long QA cycles Each change in the code needs to be tested throughout the application. Monolithic Architecture Problems
  16. 16. How to identify a microservice design?
  17. 17. In a microservices architecture, our components are defined as services.
  18. 18. All pieces of your code organized as services. Componentization via Services
  19. 19. Microservices Architecture
  20. 20. Are microservices just about a clean code?
  21. 21. NO. Microservices are about teams organization. Microservices rethink data organization. Microservices allow technology plurality.
  22. 22. Teams organized around functions turn into ... Microservices are about teams organization
  23. 23. … teams organized around business capabilities. Microservices rethink teams organization
  24. 24. Source: http://martinfowler.com/articles/microservices.html Microservices rethink data organization
  25. 25. Source: Yow Conference Dec 2013 Netflix Workshop http://pt.slideshare.net/adrianco/yowworkshop-131203193626phpapp01-1 Microservices allow technology plurality
  26. 26. But be careful: Just because you can use a complex stack of technologies, doesn't mean you should.
  27. 27. Why not?
  28. 28. Matt Ranney, Chief Systems Architect at Uber - souce: https://www.infoq.com/articles/podcast-matt-ranney Multiple techs come at a price "A lot of things in engineering is a trade of. A lot of trade of were not obvious. (...) I hadn't expected the cost of using multiple languages for microservices to be so high"
  29. 29. How to manage multiple microservices at the same time ?
  30. 30. First: Infrastructure Automation
  31. 31. Allows automated deployment into: Instances Virtual Machines Containers Infrastructure Automation Tests Continuous Integration Continuous Delivery Simple to launch Hard to isolate from other resources Consumes all available resources Easy to scale - just add more VMs VMs have slow startups Easy CPU and memory control Easy to scale - just add more containers Insanely fast to build and start. Easy CPU and memory control
  32. 32. Second: Sophisticated monitoring
  33. 33. Services can fail anytime. With problems that were not anticipated.
  34. 34. Your monitoring must be: Realtime Instance level Service level on: Architectural elements Business elements Requests per second Disc I/O CPU usage Sales per minute received Number of sessions alive Users navigation stats
  35. 35. What if I need to process something through multiple services?
  36. 36. Monoliths usually solve this problem with orchestration
  37. 37. Order Service new order Orchestration design Payment Service Stock Service Delivery Service One service orchestrates a process flow throughout the application.
  38. 38. But microservices usually prefer choreography over orchestration
  39. 39. Workflow service Choreography design new order Order Service Payment Service Stock Service Delivery Service Publishes Subscribes Subscribes Subscribes
  40. 40. With multiple services we need to be prepared to fail.
  41. 41. What happens if we have a network failure here ? Or a timeout here ? Or an internal error here ? Design for failure Workflow service Order Service Payment Service Stock Service Delivery Service
  42. 42. Ok, let's be honest: What problems could a microservice design bring?
  43. 43. Microservices general criticism it's complex to manage due to its distributed nature. It's hard to keep transactional control over your data. Inter-service calls over a network have a higher cost in terms of latency and message processing time than in-process calls. Multiple message formats. Moving responsibilities between services is more difficult.
  44. 44. QA?
  45. 45. Thanks.

×