Many presentations on Microservices offer a high-level view; rarely does one hear what it’s like to work in such an environment. Individual services are somewhat trivial to develop, but now you suddenly have countless others to track. You’ll become obsessed over how they communicate. You’ll have to start referring to the whole thing as “the Platform”. You will have to take on some considerable DevOps work and start learning about deployment pipelines, metrics, and logging.
Don’t panic. In this presentation we’ll discuss what we learned over the past four years by highlighting our mistakes. We’ll examine what a development lifecycle might look like for adding a new service, developing a feature, or fixing bugs. We’ll see how team communication is more important than one might realize. Most importantly, we’ll show how - while an individual service is simple - the infrastructure demands are now much more complicated: your organization will need to introduce and become increasingly dependent on various technologies, procedures, and tools - ranging from the ELK stack to Grafana to Kubernetes. Lastly, you’ll come away with the understanding that your resident SREs will become the most valued members of your team.
Surviving in a Microservices environment -abridged
1. Surviving In A Microservices
Environment
Steve Pember
DevOps Days, Boston 2018
@svpember
2. @svpember
Microservice Blog Posts & Presentations
• Microservices: Yay!
• Microservices: Boo!
• Smashing The Monolith (and here’s how we did it)
• Microservices + Technology X
• Microservices + Methodology Y
6. @svpember
Why Choose Microservices?
• Reduce Coupling!
• Right Tool for the Job
• Continuous Delivery
• Smaller codebases are easier to reason about
• Easy to replace old services
• Efficient Scaling
• Can move quickly (once you’re up and running)
32. @svpember
Infrastructure
• How do we manage the logs?
• How about metrics / telemetry?
• How/where are our builds done?
• How do we deploy our code?
35. @svpember
Infrastructure
• How do we manage the logs?
• How about metrics / telemetry?
• How/where are our builds done?
• How do we deploy our code?
• Do we have any coding conventions?
41. @svpember
Infrastructure
• How do we manage the logs?
• How about metrics / telemetry?
• How/where are our builds done?
• How do we deploy our code?
• Do we have any coding conventions?
• Can I generate a Service template?
43. @svpember
Infrastructure
• How do we manage the logs?
• How about metrics / telemetry?
• How/where are our builds done?
• How do we deploy our code?
• Do we have any coding conventions?
• Can I generate a Service template?
• How do we share code?
46. @svpember
Sharing Code
• It’s OK to reimplement functionality within each service
• Setup your own internal Artifactory!
• DO share infrastructure libraries (e.g. communications)
• NEVER share business logic
• NEVER share Domain objects, Models
47. @svpember
Infrastructure
• How do we manage the logs?
• How about metrics / telemetry?
• How/where are our builds done?
• How do we deploy our code?
• Do we have any coding conventions?
• Can I generate a Service template?
• How do we share code?
• How do we manage our (multiple) environments?
65. @svpember
Architecture
• Do we have an overall design vision?
• What technologies do we use?
• How much freedom do we have in choosing new technologies?
69. @svpember
Architecture
• Do we have an overall design vision?
• What technologies do we use?
• How much freedom do we have in choosing new technologies?
• How do we test an individual service?
71. @svpember
Architecture
• Do we have an overall design vision?
• What technologies do we use?
• How much freedom do we have in choosing new technologies?
• How do we test an individual service?
• How do we test the platform as a whole?
72. @svpember
Test Environment
• Run periodically (e.g. nightly)
• Each service generates fixture data
• Service data reset after EACH test
75. @svpember
Architecture
• Do we have an overall design vision?
• What technologies do we use?
• How much freedom do we have in choosing new technologies?
• How do we test an individual service?
• How do we test the platform as a whole?
• How do our services communicate?
78. @svpember
Architecture
• Do we have an overall design vision?
• What technologies do we use?
• How much freedom do we have in choosing new technologies?
• How do we test an individual service?
• How do we test the platform as a whole?
• How do our services communicate?
• Do we follow an overall architectural style?
82. @svpember
Architecture
• Do we have an overall design vision?
• What technologies do we use?
• How much freedom do we have in choosing new technologies?
• How do we test an individual service?
• How do we test the platform as a whole?
• How do our services communicate?
• Do we follow an overall architectural style?
• When do we create new services?
83. @svpember
New Service?
• Initially: design platform around Bounded Contexts, create services from inner
Contexts
• Don’t create services ‘just because’
• Don’t create services that are basically CRUD-wrappers
• Do make an effort to identify boundaries
• Ensure a service has/will have proper context boundaries before creating
• If two services need to communicate synchronously or frequently, good
candidates for MERGING
92. @svpember
Miscellaneous Advice
• Don’t get cute with the naming of services
• New Feature -> walk backwards from what the user will see
• Release when a feature is ready, but don’t be afraid of bugs
93. @svpember
Miscellaneous Advice
• Don’t get cute with the naming of services
• New Feature -> walk backwards from what the user will see
• Release when a feature is ready, but don’t be afraid of bugs
• If a service A has another service B as a dependency => release B first
94. @svpember
Miscellaneous Advice
• Don’t get cute with the naming of services
• New Feature -> walk backwards from what the user will see
• Release when a feature is ready, but don’t be afraid of bugs
• If a service A has another service B as a dependency => release B first
• How to bootstrap a new service?
95. @svpember
Miscellaneous Advice
• Don’t get cute with the naming of services
• New Feature -> walk backwards from what the user will see
• Release when a feature is ready, but don’t be afraid of bugs
• If a service A has another service B as a dependency => release B first
• How to bootstrap a new service?
• API or Message Versioning is just.. blech.. a Big Thing
96. @svpember
Miscellaneous Advice
• Don’t get cute with the naming of services
• New Feature -> walk backwards from what the user will see
• Release when a feature is ready, but don’t be afraid of bugs
• If a service A has another service B as a dependency => release B first
• How to bootstrap a new service?
• API or Message Versioning is just.. blech.. a Big Thing
• Don’t release Friday afternoons