Robyn supports comprehensive timeout configuration to handle high-concurrency scenarios and prevent resource exhaustion like the "Too many open files" error.
Maximum time (seconds) to wait for the client to transmit the complete request headers. This does not limit handler execution time or overall request duration — it only guards against slow or stalled clients during the initial header-reading phase. Maps to actix-web's client_request_timeout.
ROBYN_CLIENT_TIMEOUT
keep_alive_timeout
20
Time (seconds) to keep idle connections alive before closing them
# Optimized for high-traffic scenariosapp.start( host="0.0.0.0", port=8080, client_timeout=60, # More time for clients on slow networks to send headers keep_alive_timeout=15# Shorter keep-alive for faster turnover)
CopyCopied!
Development Setup
# Development-friendly settingsapp.start( client_timeout=300, # Generous header-read timeout for debugging keep_alive_timeout=60# Longer keep-alive for testing)
CopyCopied!
Load Testing Configuration
# Optimized for load testing with tools like wrkapp.start( client_timeout=10, # Quick header-read timeout keep_alive_timeout=5# Fast connection turnover)
Higher client_timeout (60-120s) so slow clients have time to send headers
Standard keep_alive_timeout (20-30s)
Note:client_timeout only controls how long the server waits for request headers — it does not cap handler execution time. If you need to limit how long a handler can run, implement that logic within the handler itself (e.g. with asyncio.wait_for).