Many presentations on microservices offer a high-level view of the architecture; rarely do you hear what it’s like to work in such an environment. Stephen Pember shares his experience migrating from a monolith to microservices across several companies, highlighting the mistakes made along the way and offering advice.
8. @svpember
Why Choose Microservices?
• Reduce Coupling!
• Team Autonomy
• Forced Boundaries between Functional Areas
• 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)
14. @svpember
Topics
• Is it time for Microservices?
• Infrastructure / Operations
• Architecture
• Developer Productivity / Happiness
• People Communication
• Breaking off from the Monolith
• Random
36. @svpember
Infrastructure / Operations
• Do we have Centralized Logging?
• What do we use for Metrics?
• How are our builds performed?
• When are our builds performed?
43. @svpember
Infrastructure / Operations
• Do we have Centralized Logging?
• What do we use for Metrics?
• How are our builds performed?
• When are our builds performed?
• Can our CI keep up with the the team’s build demand?
46. @svpember
Infrastructure / Operations
• Do we have Centralized Logging?
• What do we use for Metrics?
• How are our builds performed?
• When are our builds performed?
• Can our CI keep up with the the team’s build demand?
• Do we have any coding conventions or quality gates?
49. @svpember
Infrastructure / Operations
• Do we have Centralized Logging?
• What do we use for Metrics?
• How are our builds performed?
• When are our builds performed?
• Can our CI keep up with the the team’s build demand?
• Do we have any coding conventions or quality gates?
• How are our services deployed?
55. @svpember
Service Mesh
• Likely don’t need in a small org with few services / Essential as you grow
• Aids in resiliency, can reroute traffic around failing nodes
• App Devs focus on building services vs wiring them up
• Sidecars can handle metric, log collection and auth between services
• Easy Canary Deploys
56. @svpember
Infrastructure / Operations
• Do we have Centralized Logging?
• What do we use for Metrics?
• How are our builds performed?
• When are our builds performed?
• Can our CI keep up with the the team’s build demand?
• Do we have any coding conventions or quality gates?
• How are our services deployed?
• Do we have multiple environments? How are our environments
managed?
67. @svpember
Architecture
• Do we have an overall design vision?
• What technologies do we use? How much freedom do we have in choosing
them?
• How do we share code between services?
70. @svpember
Shared code?
• Internal Commons (e.g. a custom String Utils) - OK!
• Styling, CSS - Go for it!
• Business Logic - You’re gonna have a bad time
• Domain Objects - Never!
72. @svpember
Architecture
• Do we have an overall design vision?
• What technologies do we use? How much freedom do we have in choosing
them?
• How do we share code between services?
• How do we test an individual service?
76. @svpember
Architecture
• Do we have an overall design vision?
• What technologies do we use? How much freedom do we have in choosing
them?
• How do we share code between services?
• How do we test an individual service?
• How do we test the platform as a whole?
77. @svpember
End-to-End tests are Difficult
1. Reset fixture / default state data on each service’s datastore
2. Execute test by performing some user action at the edge
3. Wait for test to complete
4. Make assertions on each service (e.g. look out for unknown side effects)
5. Repeat
80. @svpember
Architecture
• Do we have an overall design vision?
• What technologies do we use? How much freedom do we have in choosing
them?
• How do we share code between services?
• How do we test an individual service?
• How do we test the platform as a whole?
• Overall architectural style for services?
102. @svpember
Some DDD concepts
• Ubiquitous Language
• Entities
• Aggregates
• Bounded Contexts
• No Direct communications across Boundaries, communicate through some
single point of contact
107. @svpember
Architecture
• Do we have an overall design vision?
• What technologies do we use? How much freedom do we have in choosing
them?
• How do we share code between services?
• How do we test an individual service?
• How do we test the platform as a whole?
• Overall architectural style for services?
• When do we decide to create new services?
108. @svpember
New Service?
• Don’t make services ‘just because’
• Don’t make CRUD services
• Look for places where Eventual Consistency is acceptable
• A service should be thought as wrapping some functional business logic, not
the domain objects inside of it
• When new functionality is proposed: does it fall within the responsibilities of an
existing service?
110. @svpember
Architecture
• Do we have an overall design vision?
• What technologies do we use? How much freedom do we have in choosing
them?
• How do we share code between services?
• How do we test an individual service?
• How do we test the platform as a whole?
• Overall architectural style for a service?
• When do we decide to create new services?
• How do we bootstrap a new service?
118. Running a single Microservice
is easy.
Running all of them is
impossible.
119. @svpember
Developing against other Services
1. Every team publishes a mock service along with the real service
2. Only run services you need at the time
3. On-demand Environments
4. Keep buying bigger laptops
121. @svpember
Developer Productivity / Happiness
• Do we have a service template?
• What does it take to run our services?
• Do our Engineers know how our services are deployed?
123. @svpember
Developer Productivity / Happiness
• Do we have a service template?
• What does it take to run our services?
• Do our Engineers know how our services are deployed?
• How do our Engineers know about other Services?
124. @svpember
Topics
• Is it time for Microservices?
• Infrastructure / Operations
• Architecture
• Developer Productivity / Happiness
• People Communication
139. @svpember
People Communication
• How large are our teams?
• How are they structured?
• Are there clear functional boundaries between teams?
• Do we encourage cross-team socializing?
140.
141. @svpember
People Communication
• How large are our teams?
• How are they structured?
• Are there clear functional boundaries between teams?
• Do we encourage cross-team socializing?
• Do we have clear methods for engineers to share & publicize services
they’ve built?
142. @svpember
People Communication
• How large are our teams?
• How are they structured?
• Are there clear functional boundaries between teams?
• Do we encourage cross-team socializing?
• Do we have clear methods for engineers to share & publicize services they’ve
built?
• Do we add more process if something goes wrong?
144. @svpember
People Communication
• How large are our teams?
• How are they structured?
• Are there clear functional boundaries between teams?
• Do we encourage cross-team socializing?
• Do we have clear methods for engineers to share & publicize services they’ve
built?
• Do we add more process if something goes wrong?
• Do we have company ‘Core Values’? Do they include non-technical
skills?
147. @svpember
Topics
• Is it time for Microservices?
• Infrastructure / Operations
• Architecture
• Developer Productivity / Happiness
• People Communication
• Breaking off from the Monolith
148. @svpember
Breaking off from the Monolith
• Do we have a process / guideline for breaking functionality out of the
monolith?
149. @svpember
Breaking off from the Monolith
• Do we have a process / guideline for breaking functionality out of the monolith?
• Do we have a process / guideline for new services to interact w/ the
monolith?
150. @svpember
Breaking off from the Monolith
• Do we have a process / guideline for breaking functionality out of the monolith?
• Do we have a process / guideline for new services to interact w/ the monolith?
• So… how much functionality have we actually split off?
151. @svpember
Breaking off from the Monolith
• Do we have a process / guideline for breaking functionality out of the monolith?
• Do we have a process / guideline for new services to interact w/ the monolith?
• So… how much functionality have we actually split off?
• How’s the monolith doing?
152. All of your dependent systems
need to scale to meet the
demands of your services
154. @svpember
Slicing code from the Monolith
• Not that straightforward!
• Create programmatic boundaries around the departing code
• Measure traffic and operational load across those boundaries
• Any dependencies on original system?
• Has the monolith accounted for the backpressure from the new service?
• Roll out slowly
• How are the metrics looking?
157. @svpember
Topics
• Is it time for Microservices?
• Infrastructure / Operations
• Architecture
• Developer Productivity / Happiness
• People Communication
• Breaking off from the Monolith
• Random
160. @svpember
Random Advice
• API & Message versioning is a real issue
• Always have more than one cluster
• Don’t get cute with the naming of services
162. @svpember
Random Advice
• API & Message versioning is a real issue
• Always have more than one cluster
• Don’t get cute with the naming of services
• New Feature? Walk backwards from the End User UI
164. @svpember
Random Advice
• API & Message versioning is a real issue
• Always have more than one cluster
• Don’t get cute with the naming of services
• New Feature? Walk backwards from the End User UI
• Release when a feature is ready, don’t be afraid of bugs
165. @svpember
Random Advice
• API & Message versioning is a real issue
• Always have more than one cluster
• Don’t get cute with the naming of services
• New Feature? Walk backwards from the End User UI
• Release when a feature is ready, don’t be afraid of bugs
• But don’t release Friday afternoon.