728x90
MicroService Architecture(MSA)
MSA
MSA is an architectural style
to build large application with separated independent parts like Lego blocks.
When is the time to think of MSA
- when hard and slow to deploy changes
- when common data model is becoming too complicated
- different parts have different load/scale requirements
Characteristics of MSA
- Each part have its own service with different tech stack, language, DB, etc
- communicate via REST APIs, event stream, message brokers
Pros of MSA
- Easy update without touching entire application
- Team can use diversed stacks or langs
- precise scaling -> save money
- Independently deployable
- fault isolation and better resilience
- Good for teamwork
Cons of MSA
- management complexity
- much logging data
- more network connections -> more latency and connection issues
MSA - DevOps
- MSA needs investment to DevOps(CI/CD, monitoring, lifecycle automation, ...)
essential tools for MSA
1. Containers, Docker, Kubernetes
- Containers are smaller and lighter than traditional virtual machines -> easy and quick to implement
2. API gateways
- API gateway works as a reverse proxy for clients.
- It routes requests, send request to multiple services, and also give security and authentication.
- ex) Kubernetes + Ingress, Istio
essential tools for MSA
3. Messaging and event streaming
- state-establishing API calls -> can tell changes in state
- ex) Apache Kafka
4. Serverless
- The unit of execution is small service and also a function
MSA + Cloud service
- good for cost optimization
- small scalable components(MSA) + on-demand, pay-per-use infra(Cloud)
Common patterns
- BFF(Backend-for-frontend) pattern
- Entity and aggregate pattern
- Service discovery pattern
- Adapter microservice pattern
- Strangler application pattern
Anti-patterns
- Don't start with microservices. It is for large application not small one
- Don't do MSA without DevOps and cloud services
- Don't make too many small microservices.
other options?
- MSA
- Monolithic architecture
- SOA
Monolithic architecture vs. MSA
Monlithic
Server-side system based on single application
- pros : easy to develop, deploy, manage
- cons
- share common stacks(lang, frameworks, db) in entire application
- scaling
- more growth -> more complexity
MSA
application with lousely coupled components
SOA(Service-Oriented Architecture) vs. MSA
Different scope
- SOA : focus on enterprise to standardize how web services communicate
- MSA : focus on application
Reference
728x90
'Research > Computer Science' 카테고리의 다른 글
List, Set, Map, HashMap (0) | 2023.03.30 |
---|---|
Parameter와 Argument의 차이 (0) | 2023.03.30 |
DB 인덱스 (0) | 2023.03.28 |
Dependency Injection (0) | 2023.03.28 |
REST API (0) | 2023.03.27 |
댓글