Microservices Interview Questions
Microservices Interview Questions Monolith vs microservices trade-offs? Monolith: simpler dev/deploy, one DB, lower latency. Micro: independent scaling/deploy, …
Microservices Interview Questions
Monolith vs microservices trade-offs? Monolith: simpler dev/deploy, one DB, lower latency. Micro: independent scaling/deploy, tech diversity, team autonomy — but distributed systems complexity, network overhead, operational burden
How do you handle distributed transactions? Saga pattern (choreography or orchestration) with compensating transactions. Avoid 2PC — it's slow and creates tight coupling
How to ensure data consistency across services? Eventual consistency via events. Outbox pattern for reliable publishing. Idempotent consumers (deduplicate by event ID)
What is the circuit breaker pattern? Stops calling a failing downstream service after threshold; enters open state. After timeout, half-open state tests if service recovered. Implemented by Resilience4j (Java), opossum (Node)
How do you handle service discovery? Client-side (Eureka) or server-side (AWS ALB, Kubernetes service DNS). In K8s, services resolve by name: http://user-service:3001
How do you propagate auth across services? Pass JWT in Authorization header between services. API Gateway validates token; downstream services trust the gateway or re-verify the token
How to debug distributed systems? Distributed tracing (OpenTelemetry, Jaeger, Zipkin) — propagate trace ID across all service calls. Centralized logging with correlation IDs
When NOT to use microservices? Early-stage products (YAGNI), small teams, tight deadline. Start with a modular monolith; extract services when boundaries are clear and scaling needs justify complexity