In my recent articles, I covered the core building blocks of DevOps in Microservices and Pitfalls of each building block in Monolithic architecture. As part of this article, I highlight the major best practices of each building block – that need to follow while working with Microservices environment.
As we already know that the following are the core building blocks of DevOps-
- Continuous Integration
- Continuous Deployment
Let’s understand the best practices of each one of them below.
- We should maintain the separate code repository for each service.
- It is recommended that there should be a separate Continuous Integration build for each service
- As many commits as possible to the main trunk in a day
- Good test suite which will validate the results immediately
- Highest priority for the broken build, we need to address the build issues and fix them on priority.
- CD covers all the stages ( Dev, Staging, Production) of Service.
- Use specific CD tools
- Identify technology agnostic CD tools
- Maintain the Single artifact for all the stages
- Having configuration server which takes care of all configurations
- Image generation for each release of the service.
- Mandatory versioning of artifacts for each release of the Service.
- Effective Containerization to scale the service instances based on the load
- Comprehensive Image management
- Linking of metrics with scaling
- Auto-updating of load balancer on the scale up and down
- Must be automated ( both up and down ) of scale up and scale down based on the load
- Design services to expose basic metrics themselves( Like response time & error rate)
- Aggregation of service level metrics
- Aggregation of host-level metrics
- Drill down option for metrics at service as well as host level
- Metric storage platform must be elastic enough to store data which can allow you to create and observe trends
- Synthetic events and Semantic Monitoring
- Standardization of logs
- Aggregated logging
- Correlation IDs
- The mechanism to track the health of Downstream dependencies
The impact of the continuous software delivery model is widespread, especially in the enterprises that work on Agile for their software implementation since it has proven to be scalable and cost-efficient. The Best Practices of core building blocks highlighted in this blog are helpful to follow them in the Microservices architecture.