Talking To An Unknown Service
Because gRPC uses binary messages, you normally need the schema to call a service. Server reflection is a built in service that lets a client ask the server to describe its own methods at runtime.
What Reflection Enables
Reflection turns an opaque binary endpoint into something explorable.
- Command line tools can list available methods.
- Clients can fetch the message definitions without the original files.
- Debugging tools can build requests on the fly.
Reflection is great for development but is often disabled in production so the surface is not advertised.
The Health Service
gRPC also defines a standard health checking service. A client or load balancer asks for the status of a named service and gets back one of a few states.
- A serving status means the service is ready for traffic.
- A not serving status means it should be taken out of rotation.
- The health service can be watched for status changes.
Load balancers and orchestration systems use these health checks to decide which backends should receive calls.
Key idea
Server reflection lets clients discover a gRPC service description at runtime, while the standard health service reports a serving status that load balancers use to route traffic to ready backends.