Microservices Service Discovery and Registry 3 — Questions and Answers
Question 1: In the self-registration pattern, who registers a service instance with the registry?
- A separate registrar process
- The service instance itself (Correct answer)
- The API gateway
- The DNS provider
Correct answer: The service instance itself
With self-registration, each instance is responsible for registering and deregistering itself.
Question 2: In the third-party registration pattern, registration is handled by:
- The service instance
- A separate registrar (service manager) that tracks instances (Correct answer)
- The end client
- The load balancer's cache
Correct answer: A separate registrar (service manager) that tracks instances
A dedicated registrar component watches instances and registers/deregisters them.
Question 3: A key advantage of third-party registration is that:
- Services contain no registration code (Correct answer)
- It removes the need for a registry
- It works only with monoliths
- It eliminates health checks
Correct answer: Services contain no registration code
Decoupling registration from service code keeps services focused on business logic.
Question 4: How does a registry typically detect that an instance has died without deregistering?
- It never detects it
- Through health checks or heartbeat timeouts (Correct answer)
- By restarting the instance
- By scanning source code
Correct answer: Through health checks or heartbeat timeouts
Missed heartbeats or failed health checks cause the registry to expire stale entries.
Question 5: What is a 'heartbeat' in the context of a service registry?
- A scheduled deployment
- A periodic signal an instance sends to renew its registration (Correct answer)
- A database backup
- A logging format
Correct answer: A periodic signal an instance sends to renew its registration
Heartbeats are periodic renewals that tell the registry an instance is still healthy.
Question 6: If a registry keeps stale entries for dead instances, the most likely result is:
- Faster responses
- Requests routed to unavailable instances and failures (Correct answer)
- Reduced memory usage
- Automatic scaling up
Correct answer: Requests routed to unavailable instances and failures
Stale entries cause callers to attempt connections to instances that no longer exist.
Question 7: Which tool provides registration via a sidecar agent and built-in health checking?
- HashiCorp Consul (Correct answer)
- Jenkins
- Grafana
- Logstash
Correct answer: HashiCorp Consul
Consul agents handle registration and run health checks for services.
In the self-registration pattern, who registers a service instance with the registry?