Explain gRPC Streaming vs Unary Calls.

A unary gRPC call sends one request and gets one response, like a normal function call over the network. A streaming call keeps the connection open and sends many messages over it. gRPC has four call types: unary, server streaming, client streaming, and bidirectional streaming.

Use unary for ordinary operations such as fetching a profile or creating a record. Use streaming when one side has many messages to send over time, or when the result arrives in pieces.

The four gRPC call types

Call typeRequestResponseTypical use
UnaryOne messageOne messageGet a user, create an order, log in
Server streamingOne messageMany messagesLarge result sets, live price feeds, log tails
Client streamingMany messagesOne messageFile upload in chunks, batched sensor readings
BidirectionalMany messagesMany messagesChat, collaborative editing, voice transcription

All four run over a single HTTP/2 connection. HTTP/2 carries many independent streams at once, so gRPC does not open a new connection per call.

How a unary call behaves

The client sends one message and waits. The server does its work and returns one message plus a status code.

service UserService { rpc GetUser(GetUserRequest) returns (User); }

Unary calls are stateless from the server's point of view. Each one stands alone, so any instance can serve it. That makes load balancing simple. A proxy can send each call to a different backend.

Unary is the right default. Most endpoints in a real service are unary.

How streaming calls behave

A streaming call opens one HTTP/2 stream and keeps it open. Messages flow over that stream until one side closes it.

service PriceService { rpc WatchPrices(WatchRequest) returns (stream PriceUpdate); rpc UploadFile(stream Chunk) returns (UploadResult); rpc Chat(stream ChatMessage) returns (stream ChatMessage); }

The word stream in front of the type is the whole difference in the contract.

Streaming saves the setup cost of repeated calls. It also lets the server push data the client did not ask for again. The cost is that the connection is now stateful. The client stays pinned to one backend instance for the life of the stream.

What streaming changes for your system

Load balancing gets harder. A long stream stays on one backend. If you deploy or scale during that time, some clients keep talking to an old instance until their stream ends. Connection level load balancers cannot rebalance mid stream.

Flow control matters. HTTP/2 has built in backpressure, which means a slow reader can tell the sender to slow down. A fast producer with a slow consumer will fill buffers if you ignore it.

Cleanup is on you. A stream that is never closed holds memory and a connection slot on both sides. Set deadlines on every call, and cancel streams when the work is abandoned.

Errors arrive differently. A unary call fails once, with one status. A stream can deliver 500 good messages and then fail. The client needs to know what it already processed, so design for resume, not just retry.

When to pick each one

Choose unary when the operation has a clear start and end. Use it when the response fits in one message. It also keeps retries and scaling simple.

Choose server streaming when the result is large or open ended. Sending 100,000 rows as one response forces both sides to hold it all in memory. Streaming lets the client process rows as they arrive.

Choose client streaming when the client produces data over time and the server only needs to answer once. Chunked uploads are the common case.

Choose bidirectional when both sides talk at the same time and order matters within each direction. Chat and live transcription fit here.

gRPC compared to REST

This question usually follows the streaming one, so it helps to have a short answer ready.

gRPC uses HTTP/2 and Protocol Buffers, a binary format defined by a schema file. REST usually uses HTTP/1.1 or HTTP/2 with JSON, a text format. Binary messages are smaller and faster to parse, and the schema gives you generated client code in many languages.

REST wins on reach and on tooling. Any browser, any curl command, and any proxy understands it. gRPC needs a proxy layer such as gRPC Web to reach a browser at all.

The usual split is gRPC between internal services, REST at the public edge. Streaming is one of the main reasons teams pick gRPC internally, because REST has no native equivalent that is as cheap.

Common mistakes

  • Using streaming for a simple request and response. It adds state for no gain.
  • Forgetting to close or cancel a stream, which leaks memory and connections.
  • Assuming streaming is always faster. For short calls the setup dominates and unary wins.
  • Ignoring deadlines. Every call should carry one, streaming calls most of all.
  • Treating a stream failure like a unary failure and replaying the whole thing.
  • Putting long lived streams behind a load balancer that cannot handle them.

Frequently asked questions

What is the difference between unary and streaming in gRPC?

Unary sends one request and returns one response. Streaming keeps the connection open so many messages can flow in one or both directions. Unary is stateless and easy to balance. Streaming is stateful and pins the client to one backend.

What are the four types of gRPC calls?

Unary, server streaming, client streaming, and bidirectional streaming. The stream keyword in the .proto file marks which side sends many messages.

Is gRPC streaming faster than unary?

For many messages in a row, yes, because it avoids repeating the call setup. For a single short request, unary is usually faster, since the stream setup is pure overhead.

When should I use gRPC over REST?

Use gRPC for internal service to service traffic where you control both sides, want a strict schema, and need streaming or low latency. Use REST at the public edge, where browser support and familiar tooling matter more.

Does gRPC streaming need WebSockets?

No. gRPC streaming uses HTTP/2 streams directly. WebSockets solve a similar problem for browsers, which is why gRPC Web exists as a bridge.

How do I handle errors in a streaming call?

Treat a partial stream as partial progress. Track what you consumed, then resume from that point rather than starting over. Send a status code and a clear message when you close the stream early.

How to prepare

Design the contract, not just the call. Choosing unary or streaming is a contract decision, and interviewers grade the reasoning. Grokking Modern API Design Interview covers gRPC contract design and the rules for choosing between REST, gRPC, and GraphQL.

Say the trade off out loud. Practice with Mock Interviews with ex-FAANG engineers so the reasoning sounds natural under time pressure.

TAGS
System Design Interview
System Design Fundamentals
CONTRIBUTOR
Arslan Ahmad
Arslan Ahmad
ex-FAANG engineering manager and author or Grokking series.
-

GET YOUR FREE

Coding Questions Catalog

Design Gurus Newsletter - Latest from our Blog
Boost your coding skills with our essential coding questions catalog.
Take a step towards a better tech career now!
Explore Answers
What is the role of Okta?
What is API architecture?
Which is the best coding interview preparation course?
What is a mock schedule?
What’s the right way to draw diagrams in a system design interview?
Learn how to draw diagrams in a system design interview. Discover simple frameworks, flow structures, and visual best practices that help you communicate complex architectures clearly and confidently.
What is the minimum salary in Cisco?
Related Courses
New
Grokking the AI System Design Interview course cover
Grokking the AI System Design Interview
Learn to design AI systems the way interviewers expect: classic ML products, LLM and RAG architectures, and agentic systems, all through the lens of the system design interview.
4.6
(3,192 learners)
Discounted price for Your Region

$123

Grokking the Coding Interview: Patterns for Coding Questions course cover
Grokking the Coding Interview: Patterns for Coding Questions
The 24 essential patterns behind every coding interview question. Available in Java, Python, JavaScript, C++, C#, and Go. The most comprehensive coding interview course with 543 lessons. A smarter alternative to grinding LeetCode.
4.6
Discounted price for Your Region

$197

Grokking Modern AI Fundamentals course cover
Grokking Modern AI Fundamentals
Master the fundamentals of AI today to lead the tech revolution of tomorrow.
4.1
Discounted price for Your Region

$72

Design Gurus logo
One-Stop Portal For Tech Interviews.
Copyright © 2026 Design Gurus, LLC. All rights reserved.