Intermediate · INTERACTIVE LESSON
Request timeouts
See why a client timeout does not stop server work, with multiple clients, exact deadlines and late responses.
The interactive player is loading. If it does not appear, you can still read the explanation below.
THE IDEA BEHIND THE STEPS
How it works
A request timeout limits how long a client waits for a response. Imagine submitting a payment: the app stops waiting after three seconds, but the payment service may still finish the transaction. A timeout does not prove the operation failed or that its side effects were cancelled.
Follow two independent states: the client is waiting, succeeded or timed-out; the server is processing or completed. A response arriving by the deadline succeeds. In this model, a response arriving exactly at the deadline counts as on time. A late response completes server work but leaves the client's timed-out result unchanged.
Each request starts processing immediately. Processing times repeat by request ID, not by client. Concurrent bursts are total requests assigned round-robin across clients. Sequential mode starts the next request after the previous client succeeds or times out, plus the interval. Because timeouts do not cancel work here, even sequential client calls can leave overlapping server operations.
At the same timestamp, process responses first, deadlines second and new dispatches last, ordered by request ID within each group. Network transport adds no simulated delay: server completion and response arrival are the same event. The animation is illustrative; its speed does not change the simulated clock.
Short timeouts reduce waiting but can reject slow successful operations. Long timeouts can tie up client resources. Production timeout choices depend on measured service latency, network overhead and the caller's overall deadline; these small simulated examples are not performance recommendations.
Retries after a timeout can duplicate side effects and amplify load while the original work is still running. Use operation-specific idempotency, bounded retry budgets and backoff where appropriate. This lesson sends no retries or cancellation messages. It does not model service capacity, queues, network loss, connection setup or separate connect/read timeouts. Cancellation requires explicit cooperation and is not a guarantee that work or side effects never occurred.