- Published on
Top key points from the book Building Microservice by Sam Newman
- Authors
- Name
- Gary Huynh
- @huynhthienthach
Microservices are an architectural approach to building large, complex software systems that are composed of small, independent services that communicate with each other through
APIs
.Microservices are designed to be loosely coupled, independently
deployable
, andscalable
.Microservices offer several benefits, including increased
agility
,flexibility
, andscalability
.Microservices also present several challenges, including increased
complexity
, distributed systems management, and testing.Microservices should be designed around
business capabilities
, rather than technical concerns.Each microservice should have a
single responsibility
, and should besmall enough
to be easily understood and maintained.Communication between microservices should be done through
APIs
, using lightweight protocols such as HTTP and REST.Microservices
should be deployed independently
of one another, usingautomated deployment
and testing tools.Monitoring and logging are critical for managing microservices, as they provide visibility into the system and can help identify issues.
Microservices can be implemented using a variety of programming languages and technologies, including
Java
,Python
,Node.js
, andDocker
.Microservices should be designed with fault tolerance and resilience in mind, using techniques such as
circuit breakers
andbulkheads
.Testing is critical for ensuring the
reliability
andscalability
of microservices, and should be done at all levels of the system.Microservices should be
versioned
anddocumented
to ensure that they can be easily understood and maintained.Containerization
, using tools such asDocker
, can simplify the deployment and management of microservices.Service discovery and registration are important for managing
the dynamic nature of microservices
, and can be done using tools such asConsul
andZooKeeper
.Polyglot persistence
is an approach to data storage that allows different microservices to use different databases or data storage technologies.Microservices can be orchestrated using tools such as
Kubernetes
andApache Mesos
.Event-driven architecture
can be used to decouple microservices and enable asynchronous communication between them.Microservices can be monitored using a variety of tools, including
Prometheus
andGrafana
.API gateways
can be used to provide a single entry point for clients to access multiple microservices.DevOps practices, such as continuous integration and deployment, are critical for managing the complexity of microservices.
Microservices can be secured using techniques such as
OAuth
andJWT
.Microservices should be designed with scalability in mind, using techniques such as
horizontal scaling
andload balancing
.Performance testing
is critical for ensuring that microservices can handle the expected load.Microservices can be designed to be
resilient to failure
, using techniques such asretries
andtimeouts
.Microservices should be designed to be easily deployable and maintainable, using tools such as
Ansible
andChef
.Monitoring and logging are critical for managing the complexity of microservices, and can be done using tools such as
ELK stack
andSplunk
.Microservices can be designed to be
fault-tolerant
, using techniques such ascircuit breakers
andbulkheads
.Deployment automation is critical for managing the complexity of microservices, and can be done using tools such as
Jenkins
andTravis CI
.Microservices are not a silver bullet, and should only be used when they provide a clear benefit over other architectural approaches.