May we use cookies so Meta, Google, LinkedIn and ChatGPT see your visit and we learn which ads work? PrivacyMay we use cookies to see which pages help, and let Meta, Google, LinkedIn and ChatGPT see your visit, so we know which of our ads work? That way we spend less on ads that do not work. We do not sell your data, and the site works the same if you decline. You can change your answer at any time under Cookie settings at the foot of the page. Privacy policy
Loading...
System Design Masterclass · Core Fundamentals
Free preview: the first 2 parts of this 6-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$35 once, by card or PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$35 once, by card or PayPal
See the System Design coursein Core Fundamentals
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
It is easy and good
“It is really nice and good Please join the course”
Last lesson, you learned about connection timeouts, the time to establish a connection. The handshake. The "hello, are you there?"
But the key point is that establishing a connection and getting an answer are two very different things. You can call a restaurant, someone can pick up the phone, and then put you on hold for 45 minutes. The connection was established instantly. The response never came.
A request timeout is the maximum time your client waits for the server to send back a complete response after the connection is already established.
Here's a real scenario I've seen multiple times: a backend service accepts a connection just fine, the handshake completes in 2ms. But then the service tries to run a database query that takes a lock, and the lock is held by another query, and that query is waiting on yet another lock. Deadlock. The service never responds. Without a request timeout, your client sits there forever, connected to a server that has absolutely nothing to say.
This is more insidious than a connection failure. At least when a connection fails, you get an error quickly. A service that connects but never responds is a silent killer.
Once the connection is established, the actual request-response cycle begins:
The request timeout (also called read timeout or socket timeout depending on the library) covers steps 2 through 5. It starts ticking the moment your client finishes sending the request and stops when the complete response is received.
| Timeout | Typical Range | Why |
|---|---|---|
| Connection timeout | 1-5 seconds | TCP handshake is fast. If it doesn't happen quickly, the server is unreachable. |
| Request timeout | 5-30 seconds | Server legitimately needs time to process. A database query, an ML inference, a third-party API call, these take real time. |
A connection timeout of 2 seconds with a request timeout of 15 seconds is a very common configuration. It says: "I expect to connect within 2 seconds, and I'll give the server up to 15 seconds to respond."