The keepAliveTimeout
in a NestJS application (or any Node.js application) is a crucial configuration setting that controls how long an idle connection is kept open before it is closed. Understanding keepAliveTimeout
and its implications can help you configure your server for better performance and stability, especially when dealing with long-running requests or integrations with load balancers.
- Definition: The
keepAliveTimeout
is a setting on the HTTP server that specifies how long to keep an idle connection open before closing it. - Idle Connection: An idle connection is one where no data is being transferred between the client and the server after the initial request has been fulfilled.
- Persistent Connections: HTTP/1.1 introduced the concept of persistent connections (or keep-alive connections), where a single TCP connection can be reused for multiple HTTP requests/responses between a client and ser