This Note contains:
- Microservices
Monolithic Development
All components are
Downside
Reliability
Need to redeploy the entire application on each update,
Difficulty in adopting new technology
Microservice
The system is decomposed into modules not only at development time, but also at runtime.
Changes in one module are less likely to cause problems in other modules.
Key characteristics
A large application built as a suite of modular services
Each service supports a specific business goal
Each service uses a simple, well-defined interface to communicate with ither service
Loosely coupled service
- Keep services intercommunication to minimum
micro services is label and not the description. –Martin Fowler
Granularity of services
Single-purpose service that does one thing, really well.
- Single Responsibility principle: a module should ne responsible to one, and only one, actor
Can a service be managed by a small, agile team?
Avoid the entity trap: database entities mapped to services
- Example: Sandwich - recipe and ingredient as dedicated services.
Experiment to find the right granularity for your context.
Topology
Every service has all it needs to realize its business goal
- Shared database increase coupling
API Gateway acts as a service-access facade
- Clients don’t need to know service endpoints.
- Can perform various functions:
- Authentication
- Authorization
- loading
- balancing
Front End Variety
Cross-cutting concerns
A concern applicable throughout the application and it affect the entire application.
Operational concerns like monitoring and logging benefit from coupling.
Sidecar Pattern
A single-node pattern made up to containers
- application container core logic for the application
- sidecar container: augment the application container with cross-cutting concerns
Service Mesh
A dedicated infrastructure layer to control how services communicate with one another,
- Each service forms a node in the overall mesh
- The service mesh itself forms a console allowing holistic access to services.
Scalability
Simple to scale horizontally by running multiple copies.
You can target scaling only microservices that need it
Load balancing mechanism is needed:
- Distributing a set of tasks over a set of resources to make the overall processing more efficient.
Elasticity
Microservices-based applications typically run in containerized environments.
- The number of instances of a service and its locations changes dynamically
Service discovery keeps track of the addresses of all instances.
- Based on demand new instances can be created
- Can be a dedicated service or part of a service mesh
Enabler of elasticity and on-demand provisioning of resources (cloud).
Benefit
Small services foster testability and maintainability.
Services are independently deployable and scalable
- Positively impacts elasticity and resilience
Enables modern SE practices
- Automation (CI/CD, DevOps),
Disadvantages
Performance can be an issue as many network calls are needed to complete work.
Developers must implement the inter-service
- Use cases that span multiple services without using distribute
- 本文作者: Depasinre
- 本文链接: https:/Depasinre.github.io/2024/02/02/18653-week3/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!