Microservices
- Small services
- Independently deployable units
- For scalability and availability
- Fault isolation
Microservice Architecture
Image: microservices.io
Monoliths vs Microservices
Image: martinfowler.com
Image: pivotal.io
Scale cube
Image: microservices.io
Service
Service-oriented architecture (SOA) - A service is a discrete unit of functionality that can be accessed remotely and acted upon and updated independently
Philosophy
- Continuous integration and delivery/deployment (CI/CD)
- Cloud native
- Enterprise application
- Loosely coupled, collaborating services
- Expose an API for 3rd parties to consume
- Integrate with other applications, external services
- Support web, mobile web, native mobile applications
Do one thing and do it well - Unix philosophy
- Decomposition
- Single responsibility principle (SRP) - a responsibility of a class as a reason to change, and states that a class should only have one reason to change.
- Common closure principle (CCP) - classes that change for the same reason should be in the same package.
- Decompose by business capability
- Decompose by Domain-driven design (DDD) subdomain.
- Decompose by verbs / nouns / usecases
- Representational state transfer (REST)
- Create, read, update and delete (CRUD)
- REST constraints
- Atomicity, consistency, isolation, durability (ACID)
- Cross-cutting concern
- Persistence
- Caching
- Security
- Logging