Question: Explain MSA and compare it with monolithic architecture. Focus on loose coupling, inter-service communication, and data management strategies.
Key Terms
Term
Description
MSA
Architecture style organizing apps as independently deployable small services
Loosely Coupled
Services with minimal dependencies on each other
API Gateway
Single entry point routing client requests to each service
Service Discovery
Mechanism to dynamically locate service instances
Circuit Breaker
Pattern to block requests to a failing service and prevent cascade failures
Saga Pattern
Handles distributed transactions via event-driven compensation
Polyglot Persistence
Using different DB technologies per service based on needs
Monolithic vs Microservices
Monolithic: Microservices:
┌──────────────────────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
│ Single Application │ │ User │ │ Order │ │ Payment │
│ - User Service │ → │ Service │ │ Service │ │ Service │
│ - Order Service │ │ (Node.js)│ │ (Java) │ │ (Python) │
│ - Payment Service │ │ UserDB │ │ OrderDB │ │ PayDB │
│ - Single Database │ └──────────┘ └──────────┘ └──────────┘
└──────────────────────────┘ ↑ API Gateway ↑
Monolithic vs MSA Comparison
Aspect
Monolithic
Microservices
Deployment
Full redeploy required
Independent per service
Scaling
Vertical (Scale-Up)
Horizontal (Scale-Out)
Tech Stack
Single
Best-fit per service
Failure Impact
Entire system down
Only affected service
Early Development
Fast (simple)
Slow (infra setup needed)
Ops Complexity
Low
High (monitoring, tracing, logging)
Data Consistency
Strong (ACID)
Eventual (BASE)
Inter-Service Communication
Synchronous
REST API: Simple and intuitive. Risk of timeout and cascade failures.
gRPC: Fast with Protocol Buffers, Type-Safe. Harder to debug.
Asynchronous
Message Queue (Kafka, RabbitMQ): Full decoupling and fault isolation.