In a microservices architecture, what is the main purpose of service discovery?
Think about how services know where to send requests when their locations can change.
Service discovery allows microservices to locate each other dynamically, avoiding hardcoded IPs or ports, which can change due to scaling or failures.
In a microservices system, which component is responsible for keeping track of all available service instances?
This component holds the list of active services and their locations.
The service registry maintains a dynamic list of service instances and their network locations, enabling service discovery.
When multiple instances of a microservice are added to handle more load, how does service discovery assist?
Think about how new service instances become discoverable without manual intervention.
Service discovery updates the registry dynamically as new instances start or stop, allowing clients to find all available instances automatically.
Client-side and server-side service discovery are two common patterns. What is a key tradeoff when using client-side discovery?
Consider who manages the discovery logic and the impact on system components.
Client-side discovery pushes the responsibility to clients, increasing their complexity but reducing dependency on central servers, which can improve scalability.
Assuming each of the 100 microservice instances sends a heartbeat or registration update every 30 seconds, how many updates does the service registry receive per minute?
Calculate how many updates each instance sends per minute and multiply by the number of instances.
Each instance sends 2 updates per minute (60/30). With 100 instances, total updates = 100 * 2 = 200 per minute.