Quick revision
The short answer
An outgoing call has several separate timeouts. The connect timeout limits how long we wait to establish the TCP connection (and with HTTPS, the TLS handshake); the read or response timeout limits how long we wait for data or for the response after sending the request; the connection-acquire timeout limits how long we wait for a free connection from the client's pool; and an overall deadline limits the whole call, including retries, usually enforced above the client. Without them, a slow dependency holds our threads and connections, and the failure spreads upstream to every caller.
What to remember
In this answer, we split an outgoing call into its phases and saw that each has its own timeout: the connection-acquire timeout for waiting on our pool, the connect timeout for establishing TCP and TLS, and the read or response timeout for waiting on the server. We configured them on WebClient and RestClient, and saw why an overall deadline including retries is still needed, because a read timeout alone does not cap the total time. Without these limits, a slow dependency holds threads and connections until our service fails and the failure spreads to its callers.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
An outgoing call has several separate timeouts. The connect timeout limits how long we wait to establish the TCP connection (and with HTTPS, the TLS handshake); the read or response timeout limits how long we wait for data or for the response after sending the request; the connection-acquire timeout limits how long we wait for a free connection from the client's pool; and an overall deadline limits the whole call, including retries, usually enforced above the client. Without them, a slow dependency holds our threads and connections, and the failure spreads upstream to every caller.
Why this question is asked
Missing or wrong timeouts are behind a large share of cascading outages: one dependency becomes slow, every request waiting on it piles up, and soon the calling service is out of threads and fails too. Interviewers ask this question because many developers know "set a timeout" but not that there are several, each guarding a different phase of the call, and that the defaults are often infinite or very long. In this answer, we will walk through the phases of an HTTP call, name the timeout for each phase and what it protects against, configure them in a Spring service, and see why an overall deadline is still needed on top.
1The Phases of an Outgoing Call
An HTTP call is not one step. First the client needs a connection. Most clients keep a pool, a set of open connections reused across requests, so the first phase is borrowing a connection from it, which may mean waiting if all are in use. If no idle connection exists, the client opens a new one: a TCP handshake with the server, then for HTTPS a TLS handshake to agree on encryption. Then it writes the request, and then it waits for the server to process it and send the response, which arrives as a stream of bytes, possibly over several seconds for a large body.
Each phase can hang for a different reason. The pool can be exhausted by our own load. The connect can hang because the host is down or a firewall silently drops packets. The response can be slow because the server is overloaded. That is why one timeout is not enough.
- Borrow a connection from the poolconnection-acquire timeout
- Open TCP and do the TLS handshakeconnect timeout (TLS sometimes separate)
- Send the request
- Wait for the response and read the bodyread or response timeout
- Retry if allowedevery attempt counts against the overall deadline
5 steps in order. Play them, or step through them one at a time.
Each phase can hang for its own reason, so each has its own limit.
2Connect Timeout: Reaching the Server
The connect timeout limits how long we wait to establish the connection. It protects us against hosts that are down, unreachable networks, and firewalls that drop packets without answering, where the operating system might otherwise keep retrying the handshake for a minute or more. Connections inside a data centre normally open in a few milliseconds, so a connect timeout of 1 to 2 seconds is generous. Some clients count the TLS handshake inside the connect timeout and some have a separate setting for it, so check your client's documentation.
3Read and Response Timeouts: Waiting for the Answer
Once the request is sent, we wait for the server. A read timeout, also called a socket timeout, limits how long we wait between two pieces of data arriving. A response timeout, in clients that have one, limits how long we wait for the response to start or to complete, depending on the client. These protect against a server that accepted the connection but is overloaded, stuck on a lock, or waiting on its own slow dependency.
Notice the subtle difference. A read timeout of 5 seconds does not mean the call ends within 5 seconds. A server that sends one byte every 4 seconds never triggers it, and a 1 KB response could take over an hour. That is one reason we also need an overall deadline.
4Connection-Acquire Timeout: Waiting for the Pool
When every connection in the pool to a host is busy, new requests wait for one to be returned. The connection-acquire timeout, called connection request timeout in Apache HttpClient and pending acquire timeout in Reactor Netty, limits that wait. It protects us from our own load: without it, a burst of traffic or a slow dependency that holds connections longer makes requests queue silently inside our service, often for much longer than the dependency's own latency. With a short acquire timeout, say 200 ms, an exhausted pool fails fast and visibly, and we can shed the load or fall back.
5Configuring Them in a Spring Service
Here is a WebClient on Reactor Netty with all three client-level timeouts set, followed by the RestClient equivalent using the JDK's HttpClient.
Spring Boot 3.4 and later can also set connect and read timeouts for auto-configured clients through properties under spring.http.client, and newer versions add per-client settings; the property names have changed between versions, so check yours. Whatever the mechanism, we choose the values from the dependency's measured latency, for example a little above its p99, not round numbers.
6The Overall Deadline and Why Timeouts Matter
The client timeouts limit single phases of a single attempt. The caller cares about something else: the total time until it gets an answer or an error, including all retries and backoff. That is the overall deadline, and it is usually enforced above the client: with timeout() around the whole reactive chain, a time limiter such as Resilience4j's around the call, or a deadline passed down from our own caller. If our callers give up after 3 seconds, every attempt and every wait must fit inside those 3 seconds.
Without these limits, a slow dependency does more than slow one request. Each waiting call holds a thread and a connection. At 200 requests per second, a dependency that hangs for 30 seconds ties up 6,000 waiting calls, far more than any thread pool, so our service stops answering everything, including requests that never needed that dependency. Then our callers wait on us, and the failure spreads upstream. Timeouts turn a slow dependency into fast, contained errors that we can handle.
7Follow-up questions
Is a read timeout the same as a total request timeout?
No. A read timeout usually measures the gap between bytes, so a server that trickles data slowly can keep a call alive far beyond it. To cap the total time, we need a response timeout that covers the whole response, if the client offers one, or an overall deadline around the call.
What are typical default values?
It depends on the client and version, so check them. Several clients historically defaulted to no read timeout at all, or to a very long one, and some pools wait for a connection for minutes by default. That is why most platform teams require every client to set explicit values rather than trust defaults.
Should the timeout be the same for every endpoint of a dependency?
Not necessarily. A lookup by id may answer in 20 ms at p99, while a report endpoint takes 3 seconds. One timeout for both is either too tight for the report or too loose for the lookup. Per-endpoint or per-client settings let each match its own latency.
8Conclusion
In this answer, we split an outgoing call into its phases and saw that each has its own timeout: the connection-acquire timeout for waiting on our pool, the connect timeout for establishing TCP and TLS, and the read or response timeout for waiting on the server. We configured them on WebClient and RestClient, and saw why an overall deadline including retries is still needed, because a read timeout alone does not cap the total time. Without these limits, a slow dependency holds threads and connections until our service fails and the failure spreads to its callers.
Open with
I think of an outgoing call in phases, and each phase has its own timeout. First, the client borrows a connection from its pool, and the connection-acquire timeout, called connection request timeout in Apache HttpClient or pending acquire timeout in Reactor Netty, stops us queueing forever when the pool is exhausted by our own load.
Then, if they want more
If there is no idle connection, it opens one, and the connect timeout limits the TCP handshake, and in many clients the TLS handshake, which protects against hosts that are down or firewalls dropping packets.
Then, after sending the request, the read or response timeout limits how long we wait for the server, which protects against an overloaded or stuck dependency. A read timeout is often the gap between bytes, so a slow trickle can outlast it.
That is why I also want an overall deadline for the whole call including retries, usually enforced above the client with a timeout on the reactive chain or a time limiter, and it has to fit inside what my own caller is willing to wait. I set the values from measured latency, a bit above p99, not round numbers.
Without them, a slow dependency holds threads and connections, my service runs out of both, and the failure spreads upstream.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Spring Boot 3.4
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Framework reference, Spring Web MVC
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Name the different timeouts that apply to an outgoing HTTP call from a Spring service...": https://scrivio-interview-library.netlify.app/spring-boot/http-clients/2572c37ffc/