Email copiado — support@tuurt.com
Cargando experiencia
dotnet · October 23, 2026 · 6 min

gRPC vs REST Between .NET Microservices: When the Internal Protocol Switch Pays Off

We moved part of our internal .NET microservice communication from REST to gRPC. We gained safer contracts and real streaming; we paid for it in debugging, load balancing and new versioning rules.

By Tuurt Team

gRPC vs REST Between .NET Microservices: When the Internal Protocol Switch Pays Off

We had a .NET microservices architecture where internal service-to-service communication was REST over JSON, the same as the communication exposed to external clients. It worked, but as the number of internal calls between services grew -an orders service querying three different services to assemble a single response- we started asking whether gRPC, designed specifically for service-to-service communication, would give us something REST wasn't. The answer turned out to be yes, for part of the system, and not worth it for the rest, and the line between those two parts is what's worth explaining.

What gRPC solves that REST doesn't solve the same way

gRPC runs over HTTP/2 and uses Protocol Buffers as its serialization format. That brings three concrete things REST over JSON doesn't give you natively.

The first is the contract. With REST, the contract between two .NET services usually lives in an OpenAPI spec generated after the fact, or in documentation someone wrote once and that drifts out of date. With gRPC, the contract is the .proto file, and it's the starting point, not a derivative:

syntax = "proto3";

service CatalogService {
  rpc GetProduct (ProductRequest) returns (ProductResponse);
  rpc ListAvailability (AvailabilityRequest) returns (stream AvailabilityUpdate);
}

message ProductRequest {
  string product_id = 1;
}

message ProductResponse {
  string product_id = 1;
  string name = 2;
  int32 stock = 3;
}

From that file, the gRPC toolchain for .NET generates the client and the server stub at compile time. If a service changes the contract in an incompatible way, the other service won't compile against the new .proto until someone updates the code that consumes it. That turns a kind of error that shows up in production with REST -a field that changed type, an endpoint that no longer exists- into a compile-time error, which is exactly where we'd rather find it.

The second is bidirectional streaming. REST over HTTP/1.1 has no native model for a server to push multiple responses over the same connection as updates happen; you have to fake something similar with polling or a separate WebSocket. gRPC, running over HTTP/2, supports server streaming, client streaming, and bidirectional streaming as part of the protocol itself. In our case, an inventory service that needs to notify a catalog service of stock changes in near real time went from polling every few seconds to keeping an open stream that pushes updates only when something actually changes.

The third is using a binary format instead of text. Protobuf serializes to binary with a fixed schema, while JSON serializes to text with field names repeated in every single message. For large payloads or very frequent calls, that shrinks the size of each message and the parsing work on both ends, without us needing to measure a number to know that serializing and deserializing a strongly typed structure with the official gRPC generator for .NET is, case by case, cheaper than going through System.Text.Json on the same object.

What the initial demo doesn't show you: the cost that shows up later

The part where a gRPC prototype looks great and production reality gets complicated isn't the protocol itself, it's everything around the protocol.

Debugging stops being trivial. With REST, anyone on the team opens Postman, pastes a URL, and sees the response. With gRPC, a payload in transit is binary: you can't inspect it with curl or read it in a proxy's logs without specific tooling. We ended up depending on grpcurl and on enabling the gRPC reflection service in development and staging environments -never in production, because reflection exposes the full API surface to anyone with network access- just to be able to call services manually during development:

builder.Services.AddGrpc();
builder.Services.AddGrpcReflection();

app.MapGrpcReflectionService().RequireHost("*:5001");

That's an extra step that simply didn't exist with REST, and for someone new to the team it's a real learning curve before they can debug a problem on their own.

Load balancing changes model. HTTP/2 multiplexes many calls over a single long-lived TCP connection, which is part of why gRPC is efficient. But a layer-4 load balancer -which distributes by connection, not by request- sees one long connection and sends all of its traffic to the same backend instance for as long as that connection stays open, no matter how many gRPC calls travel inside it. The result is a silent imbalance that never shows up in a test with a single client instance, and that only becomes visible once real traffic hits several replicas of the service and one ends up overloaded while the others sit idle. We fixed this with client-side load balancing using DNS resolution through Kubernetes headless services, so each call can land on a different instance instead of depending on the load balancer to distribute by request.

The error model isn't a copy of REST's. gRPC defines its own status codes (NOT_FOUND, UNAVAILABLE, DEADLINE_EXCEEDED, among others), which aren't the same as HTTP status codes and don't always map one-to-one in an obvious way onto what the team already knew from REST. We had to write an explicit translation layer between the service's domain exceptions and gRPC's RpcException, instead of assuming the generated code would do the right thing by default:

public override async Task<ProductResponse> GetProduct(
    ProductRequest request, ServerCallContext context)
{
    var product = await _repository.FindAsync(request.ProductId);
    if (product is null)
    {
        throw new RpcException(new Status(
            StatusCode.NotFound, $"Product {request.ProductId} does not exist"));
    }
    return MapResponse(product);
}

Versioning the contract has its own rules. Protobuf lets you evolve a message without breaking compatibility, but only if you follow its rules: never reuse a field number that existed before, mark removed fields as reserved, and never change an existing field's type. Those are different rules from the ones the team had already internalized for versioning a REST contract with JSON, and we had to document them and enforce them in code review until they became habit.

Where we decided it wasn't worth it

We didn't migrate every internal endpoint to gRPC, and the decision of what stays on REST wasn't arbitrary. An internal endpoint that's called a handful of times per minute, that doesn't need streaming, and that a new developer is going to need to debug by hand fairly often while learning the system, stays on REST: gRPC's extra tooling cost doesn't pay for itself at that low a traffic volume. The same goes for any endpoint that still needs to be reachable directly from an external monitoring tool or an ad-hoc script, without going through a generated client.

What we migrated to gRPC specifically were the high-volume, sustained communication paths between services -the hot path of a user request that crosses several internal services before responding- and the cases where bidirectional streaming solves a real problem, like the inventory-change notifications, instead of forcing it where REST with polling was already good enough.

What we check before moving an internal endpoint from REST to gRPC

Before migrating an internal communication path, we confirm that the call volume or the need for streaming justifies the extra tooling cost -reflection for debugging, client-side load balancing, an error-translation layer- because that cost is fixed regardless of how much traffic flows through it. We check that the team has, or is willing to build, the habit of versioning .proto files by protobuf's compatibility rules, not REST's. And we ask whether someone outside the team that owns both services -an ops script, an external monitoring tool- still needs to call that endpoint directly, because if the answer is yes, gRPC adds friction REST didn't have, and that friction outweighs the efficiency gained.

dotnet grpc microservices architecture
← Back to blog