1. What are microservices, and how do they differ from monolithic architecture?
Microservices are small, independent services that communicate over network protocols like HTTP.
- Microservices: Decoupled, independently deployable, focus on a single function.
- Monolithic: All features tightly integrated into one large application.
2. What are the advantages and challenges of using microservices?
Advantages:
- Scalability
- Flexibility in tech stack
- Easier deployments
- Fault isolation
Challenges:
- Complex deployments
- Service discovery
- Data consistency
- Network latency
3. How do microservices communicate with each other?
- Synchronously using REST or gRPC.
- Asynchronously using message queues (Kafka, RabbitMQ).
4. What is service discovery, and how is it implemented in a microservices architecture?
Service discovery allows services to find each other dynamically.
Implemented via tools like Consul, Eureka, or Kubernetes DNS-based discovery.
5. How do you handle database management in a microservices ecosystem?
- Each microservice should own its own database (Database per Service pattern).
- Avoid shared databases to ensure loose coupling.
6. What is the role of an API Gateway in microservices?
API Gateway acts as a single entry point to multiple services.
Functions:
- Routing
- Authentication
- Rate limiting
- Aggregation of responses.
7. How do you ensure fault tolerance and resiliency in microservices?
- Circuit Breaker pattern
- Retry mechanism
- Timeouts
- Bulkhead pattern
- Fallback logic
8. What strategies do you use for deploying microservices?
- Blue-Green Deployment
- Canary Releases
- Rolling Updates
- Feature Toggles
9. How do you secure communication between microservices?
- Mutual TLS (mTLS)
- API Gateway security
- OAuth2/JWT
- Service Mesh (e.g., Istio)
10. What are sidecars, and how are they used in microservice deployments?
Sidecars are helper containers deployed alongside main service containers (e.g., in Kubernetes
pods).
Used for logging, service mesh proxying (like Envoy), monitoring, etc.