Quick revision
The short answer
Measure before deciding: profile the busiest paths, and replay real payloads through Protobuf and through a tuned JSON setup (Jackson with the Blackbird module, streaming parsers on hot paths, smaller payloads) to estimate the real saving. Cheaper wins often come first: trimming oversized responses, compressing only where bandwidth matters, and fixing chatty call patterns. If Protobuf still saves substantial CPU, migrate the top services by traffic first, run gRPC and REST side by side (or JSON transcoding at a proxy) with contracts in a shared schema registry and breaking-change checks in CI, and count the costs of HTTP/2-aware load balancing, new debugging tools, retraining and keeping REST for browsers and partners.
What to remember
In this answer, we saw that the decision to move internal calls to gRPC starts with measurement: profile the hot paths, benchmark real payloads against tuned JSON and Protobuf, and take cheaper wins such as trimming payloads, careful compression and fixing chatty calls. If Protobuf still saves substantial CPU, we migrate the top services by traffic first, run both protocols side by side with contracts in a shared registry and breaking-change checks in CI, and count the costs of load balancing, tools, training and keeping REST.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Measure before deciding: profile the busiest paths, and replay real payloads through Protobuf and through a tuned JSON setup (Jackson with the Blackbird module, streaming parsers on hot paths, smaller payloads) to estimate the real saving. Cheaper wins often come first: trimming oversized responses, compressing only where bandwidth matters, and fixing chatty call patterns. If Protobuf still saves substantial CPU, migrate the top services by traffic first, run gRPC and REST side by side (or JSON transcoding at a proxy) with contracts in a shared schema registry and breaking-change checks in CI, and count the costs of HTTP/2-aware load balancing, new debugging tools, retraining and keeping REST for browsers and partners.
Why this question is asked
A profile showing a quarter of CPU in JSON handling makes a gRPC migration look obvious. But a migration across 120 services is a multi-quarter programme, and the number in the profile does not tell us how much a different encoding would actually save, or whether simpler changes would save more. Interviewers ask this to see whether a senior engineer can turn a tempting idea into a measured decision and a safe rollout. In this answer, we will read the profile critically, measure the real saving, look for cheaper wins, decide, roll out gradually, and count the costs.
1Reading the Profile Critically
Serialisation is the work of turning objects into bytes (JSON text here) and parsing is the reverse. Spending 25 to 30 percent of CPU on it is high but not unusual, and the cause matters. It may be the format itself, text that must be scanned character by character. It may be the library setup: Jackson reflecting over classes, an ObjectMapper created per request, or dates formatted through slow paths. It may be payload size, services returning 200 KB documents when callers use 2 KB. Or it may be call patterns: a request that fans out into 40 internal calls serialises the same data 40 times.
Only the first cause is fixed by switching to Protobuf. The others follow us to gRPC, which is why we measure before we migrate.
2Measuring the Real Saving
We take the busiest call paths, perhaps the top ten by traffic, and capture real request and response payloads. Then we benchmark them three ways with JMH, the Java microbenchmark harness: our current JSON setup, a tuned JSON setup, and Protobuf with equivalent messages.
Notice the middle line. Tuning JSON, reusing ObjectMapper and ObjectWriter instances, adding the Blackbird module (which replaces reflection with generated accessors in Jackson 2; check what your Jackson version offers), and using the streaming API on the hottest paths often removes a large part of the cost without changing any contract. The honest comparison for gRPC is against tuned JSON, not against today's setup. Multiplying the per-call difference by real call volumes gives an estimate of CPU, and money, saved per service.
3Looking for Cheaper Wins First
Three changes often matter more than the encoding. Trimming oversized responses, returning only the fields callers use, reduces serialisation, network and parsing all at once; a 200 KB response cut to 10 KB beats any binary format. Compression trades CPU for bandwidth, so it should be enabled only where bandwidth is the constraint, such as cross-region links, and switched off on fast internal links where it simply burns CPU. And chatty call patterns, where a request makes dozens of small calls that could be one batch call, multiply every per-call cost; fixing one hot N+1 pattern can save more than migrating ten services.
4Deciding and Choosing Where to Start
With measurements in hand, the decision is a comparison of numbers. If tuned JSON and payload fixes bring serialisation down to, say, 10 percent of CPU, a protocol migration may not be worth it. If Protobuf still saves a large share, for example 15 percent of CPU on the busiest services, the saving can pay for the migration.
- Profile the busiest pathswhere exactly is serialisation CPU spent?
- Benchmark real payloadscurrent JSON, tuned JSON, Protobuf
- Apply cheap winstune Jackson, trim payloads, fix chatty calls
- Does Protobuf still save substantial CPU?YesMigrate top services by trafficNoStop: keep tuned JSON
- Measure after each migrationCPU per request on the same traffic
5 steps in order. Play them, or step through them one at a time.
Benefit is rarely spread evenly. In most platforms, a small share of call paths carries most of the traffic, so migrating the top five or ten services by traffic captures most of the saving. The long tail of low-traffic services may never be worth migrating.
5Rolling Out Side by Side
No big-bang switch. Each migrated service offers gRPC and REST together for a while, so callers move one at a time and can fall back. Alternatively, a proxy such as Envoy can transcode JSON to gRPC, letting the service implement only gRPC while REST callers keep working. Contracts move into a shared schema registry of .proto files, and CI runs breaking-change checks, for example with the Buf tool, so nobody renumbers a field or changes a type in a way that breaks older clients.
Migration order follows traffic: the busiest caller-callee pairs first, each move measured before the next. A small team owns the shared pieces, stub generation, interceptors for deadlines, auth and tracing, and the load balancing setup, so each service team does not reinvent them.
6Counting the Costs
The costs are real and should be in the decision. gRPC uses long-lived HTTP/2 connections, so load balancing must work per request, through a proxy, a service mesh or client-side balancing, otherwise one client pins all its calls to one server. Debugging changes: binary messages are not readable in logs or with curl, so teams need tools such as grpcurl and payload logging that decodes Protobuf. Engineers need training on deadlines, status codes and schema evolution. And REST stays anyway for browsers and partners, so we run two stacks for the foreseeable future.
7Follow-up questions
How would you measure the saving after the first services move?
Compare CPU per request, or per thousand requests, on the same traffic before and after, ideally by running old and new side by side as a canary with a share of traffic on each, so traffic mix and time of day do not distort the result. Then turn the CPU difference into instances and money at current volume. I would also watch p50 and p99 latency and error rates, because a saving that comes with worse latency or new failure modes is not a saving.
Is Protobuf always faster than JSON?
Usually for encoding and decoding, because it is binary and schema-driven, but the gap depends on the payload. For small messages or string-heavy data the difference can be modest, which is why we benchmark our own payloads rather than rely on general numbers.
What about other binary formats for REST, such as Smile or CBOR with Jackson?
They keep the REST endpoints and Jackson code while cutting parsing cost, which can be a cheaper middle step for internal calls. They lack gRPC's generated clients, streaming and deadlines, so they solve only the encoding part.
8Conclusion
In this answer, we saw that the decision to move internal calls to gRPC starts with measurement: profile the hot paths, benchmark real payloads against tuned JSON and Protobuf, and take cheaper wins such as trimming payloads, careful compression and fixing chatty calls. If Protobuf still saves substantial CPU, we migrate the top services by traffic first, run both protocols side by side with contracts in a shared registry and breaking-change checks in CI, and count the costs of load balancing, tools, training and keeping REST.
Open with
I would not decide from the profile alone, because 25 to 30 percent in JSON can come from the format, from how Jackson is set up, from oversized payloads or from chatty call patterns, and only the first is fixed by gRPC.
Then, if they want more
So first I measure: take the busiest paths, capture real payloads, and benchmark current JSON, tuned JSON, meaning reused ObjectMapper and ObjectWriter, the Blackbird module and streaming parsing on hot paths, and Protobuf. The fair comparison is tuned JSON against Protobuf.
I would also look for cheaper wins: trimming responses to what callers use, enabling compression only where bandwidth matters, and batching chatty calls, which often save more than changing encoding. If Protobuf still saves a lot of CPU, I migrate the top services by traffic first, because most of the benefit sits in a few paths.
During the migration both protocols run side by side, gRPC plus REST, or JSON transcoding at an Envoy proxy, with the proto files in a shared schema registry and breaking-change checks in CI. And I count the costs: HTTP/2-aware load balancing, new debugging tools, training, and keeping REST for browsers and partners.
After each service moves, I compare CPU per request on the same traffic to confirm the saving is real.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "How do you decide whether moving internal calls to gRPC is worth it, and how would you...": https://scrivio-interview-library.netlify.app/architecture/api-design-at-scale/cee79d7b4a/