单体架构将应用程序构建为单个统一的单元,而微服务架构将其构建为许多小的独立服务。每种架构都在复杂性、可扩展性、部署和团队组织方面有重大的权衡。
单体 vs 微服务
text
MONOLITH → the whole application as ONE deployable unit (one codebase, one process):
✓ SIMPLE → easier to develop, test, deploy, and debug initially; no distributed complexity
✗ at scale → harder to scale parts independently; large codebase gets complex; one
deploy for everything; a bug can affect all
MICROSERVICES → many small, INDEPENDENT services (each owns a capability + its data):
✓ independent SCALING, DEPLOYMENT, and teams; tech flexibility; fault isolation
✗ DISTRIBUTED COMPLEXITY → network calls, data consistency across services, deployment/
operations complexity, debugging across services, more infrastructure
