1. Scenario: A microservice is failing frequently. How will you detect and recover it?
Answer
Detect with health checks, monitoring (Prometheus, App Insights).
Recover with Kubernetes auto-restart, circuit breakers, and retries.
Use dead-letter queues for failed async messages.
2. Scenario: Two services (Order & Payment) must complete together or rollback. How will you ensure consistency?
Answer
Use the Saga Pattern.
Choreography → Payment emits event, Order reacts.
Orchestration → Orchestrator coordinates both.
Compensating transaction cancels payment if the order fails.
3. Scenario: Your product catalog service is very read-heavy. How do you optimize it?
Answer
Apply CQRS: separate read/write models.
Add caching (Redis, CDN).
Use read replicas in the database.
4. Scenario: A user-facing API takes too long because it calls five microservices. How do you optimize latency?
Answer
Use API Gateway aggregation to reduce multiple calls.
Use GraphQL for flexible data fetching.
Implement parallel calls + async messaging.
Add caching at API Gateway.
5. Scenario: One microservice is getting overloaded with requests. How do you scale it?
Answer
Enable horizontal auto-scaling (Kubernetes HPA).
Use load balancer.
Queue requests with message broker.
6. Scenario: Your monolith e-commerce app must migrate to microservices. What’s your approach?
Answer
Identify bounded contexts (Cart, Order, Payment).
Apply Strangler Fig Pattern → build new services around monolith.
Slowly cut dependencies and route traffic to microservices.
7. Scenario: You deployed a new version, and some users are facing issues. How do you roll back?
Answer
Use Blue-Green Deployment → switch back to Blue.
Use Canary Deployment to limit blast radius.
Keep database backward compatibility for rollback.

Join the conversation! Your thoughts help the community grow.