Best Practices in Microservices Architecture
Mohammad Kamruzzaman
Servant Leader | Software Architect | E-Commerce | E-Ticketing | Health Tech | Delivery Tech | Team Building & Management | Director of Engineering @Shohoz
I am trying to summarize the best practices in microservices architecture. Please check the followings and try to follow most out of them:
Design philosophy: The granularity of microservices should be based on following design principles:
Governance: We should define standards for development, deployment and functionality/performance validation.
Distributed Design: As the system is composed of multiple microservices, we need to have optimal service decomposition, clean interfaces for services and appropriate databases for each service.
Naming Conventions: The microservices’ URL is usually a noun that represents a resource. We will use the schema to perform the appropriate actions. For example:
领英推荐
Versioning: The microservice releases are managed through versions, which are a part of the microservices endpoint.
DevOps setup: We need to set up the DevOps ecosystem to include the build and deployment pipeline.
Automation: To reduce the operational complexity of microservices architecture, we need to automate operational tasks such as build, deployment, error reporting, alerting, monitoring, auto-scaling and others.
Design for failure: We need to implement features such as the following to handle failures:
Logging: Logging must be enabled to capture the errors using centralized dashboard tools such as Kibana, Splunk to monitor the logs and errors. We should design and log unique request ids that can help us to trace a user transaction end to end.
Monitoring and alerting: Monitoring tools should be used to observe the performance and availability of the microservices. Additional monitoring services can be configured to monitor the disk space, CPU utilization and others. Appropriate thresholds should be configured to alert the operations teams in case of SLA violation.