Apache · Configuration and operations
Which Apache timeouts matter and how do you set them?
Short answer
Timeout, KeepAliveTimeout, ProxyTimeout and RequestReadTimeout control different phases. Set them from real latency and client behaviour, not defaults, and keep proxy timeouts aligned with the backend and load balancer.
Timeout is a broad default for network operations. KeepAliveTimeout controls idle reuse. ProxyTimeout controls how long Apache waits for a backend. RequestReadTimeout limits how slowly a client may send headers and body, which is important against slowloris-style exhaustion.
Timeout 60
KeepAliveTimeout 5
ProxyTimeout 30
<IfModule reqtimeout_module>
RequestReadTimeout header=20-40,MinRate=500
RequestReadTimeout body=20,MinRate=500
</IfModule>
ProxyPass /api http://127.0.0.1:3000/api retry=5
ProxyPassReverse /api http://127.0.0.1:3000/apiHow to choose values
- Base proxy timeouts on measured backend latency percentiles, not the fastest request
- Leave headroom for normal tail latency, but fail faster than the client gives up
- Set the load balancer timeout slightly longer than the backend timeout so errors are attributable
- Use RequestReadTimeout to reject slow header and body sends
- Do not set very low timeouts for uploads or long-running report endpoints
- Return a clear 504 rather than holding workers indefinitely
Timeouts are a capacity control as much as an error-handling control. A backend that hangs without a timeout consumes worker slots until clients disconnect. Bounded timeouts turn an outage into a visible error and free capacity for other requests.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What is the difference between Timeout and ProxyTimeout?
- 2How does RequestReadTimeout help against slow clients?
- 3Why should load balancer and backend timeouts be coordinated?
- 4When is a 504 preferable to a long wait?
Say it in the interview
Timeout is the general network default, ProxyTimeout bounds backend waits, KeepAliveTimeout controls idle reuse, and RequestReadTimeout limits slow clients. I set proxy timeouts from measured backend latency and coordinate them with the load balancer so failures are attributable. For genuinely long work I move it to a background job instead of raising every timeout.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Apache mock interview and get scored feedback on depth, clarity and confidence.