Timeouts
easy 30 minA timeout is the longest time you are willing to wait for something.
Check yourself
One question at a time. Each answer explains why.
Question 1 of 10
Why are timeouts essential in distributed systems?
What does a connect timeout limit?
What does a read timeout usually limit?
In a chain A to B to C, how should the limits relate?
What happens when a timeout fires in the caller?
A sensible connect timeout for an API across the internet?
60 calls a second, the dependency hangs, the limit is 3 s. Threads held at most?
B makes up to 3 attempts of 400 ms with no pause and 100 ms of its own work. A's limit for B should be at least
A service receives a request with 150 ms left and needs 400 ms. Best move?
Latency: p50 30 ms, p99 150 ms, p99.9 300 ms. You accept 0.1% wrong cuts. Limit?
Pick an answer to see why.
Not quite. Without them a slow service can hold threads and connections for ever, and the failure spreads.
Not quite. It covers the TCP handshake, which takes about one round trip when the server is healthy.
Not quite. In many clients it is the longest silence between two pieces of data.
Not quite. The caller must outlast what it calls, otherwise the inner service works for nobody.
Not quite. The caller is free. The server goes on unless it is cancelled and listens.
Not quite. 1 to 5 seconds is usual. Inside one region a few hundred milliseconds are enough.
Not quite. 60 x 3 = 180.
Not quite. 3 x 400 + 100 = 1,300 ms, plus a little room.
Not quite. The result would come after the caller has left. Refusing costs nothing and tells the caller early.
Not quite. 0.1% of calls are above p99.9.
Flashcards
Say your answer, then reveal it.
Card 1 of 11
What is a timeout?
The longest time a caller is willing to wait before it gives up and frees its resources.
Say your answer, then reveal it.
Name five limits of one call.
Pool, connect, write, read, total.
Say your answer, then reveal it.
Read timeout against total timeout?
Read often limits silence between bytes. Total limits the whole operation.
Say your answer, then reveal it.
How do you choose a value?
Measured latency: the percentile for the share of wrong cuts you accept, such as p99.9, plus room.
Say your answer, then reveal it.
Most threads a hanging call can hold?
Calls per second x timeout. 40 x 2 s = 80.
Say your answer, then reveal it.
Chain A, B, C: which limit is longest?
A's. Each covers its direct call times attempts, plus pauses, own work and room.
Say your answer, then reveal it.
What is deadline propagation?
The remaining time travels with the request, and every service respects it.
Say your answer, then reveal it.
What does a timeout tell you about a write?
Nothing certain. It may have been done.
Say your answer, then reveal it.
Does the server stop when the client times out?
Only if it is told (cancelled or given a deadline) and checks.
Say your answer, then reveal it.
Danger of a limit that is too short?
Good answers are cut, and retries add load to a service that is only slow.
Say your answer, then reveal it.
What does TIME OUT stand for?
TCP connect first, Individual limits, Monitor, Err on neither side, Order outer longer, Use deadlines, Test.
Say your answer, then reveal it.
These cards come back in Today, just before you would forget them.