Microservice_Architecture_Interview_Problems
Microservice_Architecture_Interview_Problems
What strategies would you use for service discovery and load balancing?
Service discovery enables services to find each other dynamically.
Options:
Client-side discovery: service queries a registry (e.g., Eureka, Consul) and decides which
instance to call.
Server-side discovery: API gateway or service mesh routes requests (e.g., NGINX, Istio).
Load balancing strategies:
Round-robin, least connections, or custom rules.
Use health checks and circuit breakers to avoid failed instances.
In Kubernetes:
Leverage built-in DNS-based discovery and kube-proxy/IPTables for load balancing.
How do you design microservices to minimize coupling and maximize cohesion?
Cohesion refers to how focused a service is on a single domain responsibility.
Loose coupling ensures services can evolve independently.
Design principles:
Align service boundaries with bounded contexts from Domain-Driven Design (DDD).
Encapsulate data within the service and expose operations via clear APIs.
Use asynchronous messaging to reduce temporal coupling.
Best practices:
Avoid shared databases or direct access between services.
Favor contracts and versioned APIs for stable communication.
Treat each service as independently deployable and replaceable.