Protobuf's field-numbering system (each field has a unique numeric tag, not just a name) is specifically designed for backward/forward compatibility: adding a new field with a new, previously unused number is safe (old clients simply ignore it, new clients see a default value from old servers), removing a field requires marking its number as reserved (via the reserved keyword) to prevent future reuse causing data corruption, and field numbers/types must never be changed or reused for existing fields once deployed -- following these rules lets services and clients be deployed and upgraded independently without coordinated releases.
message Item {
reserved 3; // formerly "legacy_price" field, now permanently retired
reserved "legacy_price";
int32 id = 1;
string name = 2;
// field 3 intentionally skipped/reserved
int32 price_cents = 4; // new field, added safely with an unused number
}
Real-world example
A payments service adds a new price_cents field (replacing a deprecated legacy_price field, whose number 3 is marked reserved) to its protobuf contract, allowing older client versions still expecting the old schema to keep working unaffected while newer clients adopt the new field, all without requiring a coordinated simultaneous deployment.
Likely follow-ups
What happens if you accidentally reuse a reserved field number in the future?
How does protobuf handle enum evolution compatibility differently from message field evolution?
API VersioningAPI Documentation with Swagger/OpenAPI
Since gRPC requires HTTP/2 end-to-end (not just to the reverse proxy but ideally through it), the reverse proxy (nginx, YARP, Envoy) must be explicitly configured to support HTTP/2 pass-through rather than downgrading to HTTP/1.1, and load balancers must support connection-level (not just request-level) awareness since a single HTTP/2 connection can multiplex many concurrent gRPC calls -- naive round-robin load balancing at the TCP connection level can cause uneven load distribution since all calls on one long-lived HTTP/2 connection go to the same backend instance.
# nginx.conf -- gRPC requires HTTP/2 pass-through
server {
listen 443 ssl http2;
location / {
grpc_pass grpcs://backend_service;
}
}
// Kestrel must also be configured for HTTP/2
builder.WebHost.ConfigureKestrel(options => {
options.ListenAnyIP(5001, listenOptions => listenOptions.Protocols = HttpProtocols.Http2);
});
Real-world example
A team deploying gRPC services behind an AWS Application Load Balancer discovers uneven load distribution across backend instances, tracing the issue to the ALB's connection-level (not request-level) load balancing combined with long-lived HTTP/2 connections concentrating traffic on whichever instance received the initial connection.
Likely follow-ups
What's the specific configuration needed for gRPC to work correctly through YARP as a reverse proxy?
How does client-side load balancing (as an alternative to a proxy-based approach) address the connection-concentration problem?
The Grpc.HealthCheck package implements the standard gRPC Health Checking Protocol (a defined, language-agnostic protobuf service contract), registered via AddGrpcHealthChecks() and integrated with ASP.NET Core's HealthCheckService so existing IHealthCheck implementations automatically feed into the gRPC health status -- this lets gRPC-aware infrastructure (like Kubernetes readiness probes configured for gRPC, or a service mesh) query health using the standard gRPC health protocol rather than an HTTP-based health endpoint.
A Kubernetes-deployed gRPC service exposes its health via the standard gRPC Health Checking Protocol, letting Kubernetes readiness probes (configured with the grpc-health-probe binary) natively query gRPC health status rather than requiring the service to also expose a separate HTTP health endpoint just for probing.
Likely follow-ups
How does this integrate with existing IHealthCheck implementations already used for REST health endpoints?
What's the difference between the overall service health status and per-gRPC-service health status in this protocol?
Health ChecksHosting Models: KestrelIIS & Reverse Proxies
gRPC JSON transcoding (via the Microsoft.AspNetCore.Grpc.JsonTranscoding package) lets a single gRPC service automatically also be callable as a conventional RESTful JSON API, by annotating .proto methods with HTTP binding options (google.api.http) specifying the REST route/verb mapping -- this lets you write and maintain one service implementation while supporting both efficient internal gRPC calls and REST/JSON calls for external clients or browsers that can't easily consume native gRPC, without hand-writing a separate REST facade.
import "google/api/annotations.proto";
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {
option (google.api.http) = {
get: "/v1/greet/{name}"
};
}
}
// Program.cs
builder.Services.AddGrpc().AddJsonTranscoding();
// Now callable BOTH as a native gRPC call AND as GET /v1/greet/World returning JSON
Real-world example
A service team maintains a single gRPC service implementation but enables JSON transcoding so external partner integrations (unable to easily adopt gRPC) can call the exact same underlying logic via familiar REST/JSON requests, avoiding the need to build and keep in sync a separate REST API layer.
Likely follow-ups
How does JSON transcoding handle streaming RPC methods, which don't map cleanly to typical REST semantics?
How does this compare to just building a separate REST API that internally calls the gRPC service?
RESTful Web APIs & ControllersAPI Documentation with Swagger/OpenAPI
gRPC imposes default maximum message sizes (4MB for both send and receive by default in the .NET implementation) to guard against unbounded memory usage from oversized messages -- for legitimate use cases involving larger payloads, these limits can be raised via MaxReceiveMessageSize and MaxSendMessageSize options on both the server (AddGrpc) and client (channel options) sides, though raising them significantly should be weighed against the same memory-pressure concerns that motivated the default limit.
A data-sync gRPC service raises its default 4MB message size limit to 16MB on both server and client to accommodate occasional larger batch payloads, after initially hitting RESOURCE_EXHAUSTED errors under the unmodified default limit.
Likely follow-ups
What error is returned when a message exceeds the configured limit?
Would streaming be a better fit than raising the size limit for very large payloads?
Diagnostics & PerformanceFile Uploads & Streaming Large Files