A Clock On Every Call
In gRPC a caller can set a deadline, an absolute point in time by which the call must finish. If the deadline passes, the call fails fast instead of hanging forever.
Deadline Versus Timeout
A deadline is an absolute moment, while a timeout is a duration. gRPC uses deadlines because they propagate cleanly through a chain of calls.
- The client sets a deadline and includes the remaining time in the request.
- Each downstream service sees how much time is left.
- A service should not start work it cannot finish before the deadline.
Cancellation Flows Down
When a call is cancelled or its deadline expires, that signal travels through the call tree.
- The server learns the context is done and can stop work.
- Downstream calls inherit the cancellation and stop too.
- Resources like database queries can be aborted early.
Without deadlines, a slow dependency can pile up requests until the whole system stalls. Setting and respecting deadlines is how you keep failures bounded rather than letting them spread.
Key idea
gRPC deadlines bound how long a call may run and propagate the remaining time and any cancellation down the call tree, so a slow dependency fails fast instead of stalling the whole system.