MicroservicesAugust 10, 20267 min read

gRPC vs. REST for Internal Microservices: Real-World Latency and Throughput Comparison

Nguyen Dai Long

Nguyen Dai Long

Backend Lead & Software Engineer

In microservice architectures where a single customer request triggers dozens of internal RPC calls, inter-service communication overhead compounds rapidly. While JSON-over-HTTP/1.1 REST is the industry standard for public APIs, its text-based serialization and repeated TCP handshake overhead make it sub-optimal for internal service meshes.

1. Protocol Buffers vs. JSON Serialization

JSON is human-readable but computationally expensive to parse and serialize. Protocol Buffers (Protobuf) serialize data into compact binary representations with strict schema contracts. In our benchmarks, encoding a complex user profile with nested permissions took 4.2ms in JSON vs. 0.6ms in Protobuf.

protobuf
syntax = "proto3";

package auth;

service UserService {
  rpc GetUser (UserRequest) returns (UserResponse);
}

message UserRequest {
  int64 user_id = 1;
}

message UserResponse {
  int64 id = 1;
  string email = 2;
  repeated string roles = 3;
  bool is_active = 4;
}

Key Implementation Takeaways:

  • Protocol Buffers binary serialization is 5x to 10x faster than JSON.
  • Strict .proto schemas eliminate API contract drift between frontend and backend teams.
  • HTTP/2 multiplexing allows hundreds of concurrent requests over a single TCP connection.

Summary & Final Thoughts

Keep REST for public client-facing APIs where developer accessibility is paramount; adopt gRPC for internal service-to-service communication to optimize latency and throughput.

Engineering Feedback0 likes

Was this technical breakdown helpful for your production workflow?

Nguyen Dai Long

Written by Nguyen Dai Long

Backend Engineer & Backend Lead with 4+ years of hands-on experience building production systems, RESTful APIs, and cloud infrastructure using Python (Django), Laravel, PostgreSQL, and Google Cloud Platform.

Technical Discussion0

Ask questions, challenge architectures, or share your own production insights.

Join the Technical Community Discussion

Sign in via GitHub or Google in 5 seconds to comment, exchange architecture insights, and build your engineering presence.

Loading discussion...
NDL Ecosystem

Explore Free Web Tools & Games

View All Tools & Apps