The document discusses various topics related to surviving in a microservices environment. It begins by outlining some benefits of microservices such as reduced coupling, continuous delivery, and efficient scaling. It then covers infrastructure topics like managing logs, metrics, deployments, builds, and environments. Architecture topics discussed include overall design, technologies, testing approaches, communication methods, and data persistence. The document also addresses team communication and processes. It concludes by providing some miscellaneous advice for working with microservices.
1. Surviving In A Microservices
Environment
Steve Pember
CTO, ThirdChannel
Greach, 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)
27. @svpember
Infrastructure
• How do we manage the logs?
• How about metrics / telemetry?
• How do we deploy our code?
• How/where are our builds done?
31. @svpember
Infrastructure
• How do we manage the logs?
• How about metrics / telemetry?
• How do we deploy our code?
• How/where are our builds done?
• Do we have any coding conventions?
37. @svpember
Infrastructure
• How do we manage the logs?
• How about metrics / telemetry?
• How do we deploy our code?
• How/where are our builds done?
• Do we have any coding conventions?
• Can I generate a Service template?
39. @svpember
Infrastructure
• How do we manage the logs?
• How about metrics / telemetry?
• How do we deploy our code?
• How/where are our builds done?
• Do we have any coding conventions?
• Can I generate a Service template?
• How do we share code?
42. @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 Domain or business logic libraries
43. @svpember
Infrastructure
• How do we manage the logs?
• How about metrics / telemetry?
• How do we deploy our code?
• How/where are our builds done?
• Do we have any coding conventions?
• Can I generate a Service template?
• How do we share code?
• How do we manage our (multiple) environments?
46. @svpember
Infrastructure
• How do we manage the logs?
• How about metrics / telemetry?
• How do we deploy our code?
• How/where are our builds done?
• Do we have any coding conventions?
• Can I generate a Service template?
• How do we share code?
• How do we manage our (multiple) environments?
• Do our Devs get time to work on Infrastructure?
52. @svpember
Architecture
• Do we have an overall design vision?
• What technologies do we use?
• How much freedom do we have in choosing new technologies?
56. @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?
59. @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?
60. @svpember
Test Environment
• Run periodically (e.g. nightly)
• Each service generates fixture data
• Service data reset after EACH test
63. @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?
65. @svpember
HTTP
• Well Established
• Built In libraries
• Existing structure for response codes (2**, 4**, 5**, etc)
• Synchronous
• Increases coupling
• Requires services to know which others require their data
• Has dependency on Service Discovery mechanism
• Susceptible to Data Loss
66. @svpember
Events
• Asynchronous
• Pub-sub / Fire and forget
• Loose Coupling
• Prevents Data Loss
• Allows for Reactive systems
• No existing structure for response error handling
• Dependency on Message Broker technology
• Can be difficult for Junior folks to understand
70. @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?
• How/where is our data persisted?
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?
• How/where is our data persisted?
• Do we follow an overall architectural style?
89. @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?
• How/where is our data persisted?
• Do we follow an overall architectural style?
• When do we create new services?
92. @svpember
New Service?
• Initially: design platform around Bounded Contexts, create services from
inner Contexts
• Don’t create services ‘just because’
• 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
103. @svpember
Team Communication
• How are our teams structured?
• Who owns which Service?
• What’s our process for merging code?
• What’s our process for releasing code?
105. @svpember
Team Communication
• How are our teams structured?
• Who owns which Service?
• What’s our process for merging code?
• What’s our process for releasing code?
• What’s our process for monitoring code in production? Dealing with bugs?
108. @svpember
Team Communication
• How are our teams structured?
• Who owns which Service?
• What’s our process for merging code?
• What’s our process for releasing code?
• What’s our process for monitoring code in production? Dealing with bugs?
• Do we add more process if something goes wrong?
115. @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
116. @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
• If a service A has another service B as a dependency => release B first
117. @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
• If a service A has another service B as a dependency => release B first
• How to bootstrap a new service?
118. @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
• If a service A has another service B as a dependency => release B first
• How to bootstrap a new service?
• Don’t release Friday afternoons