Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Configure keepAliveTimeout/timeout on HTTP server (Node 8+) to prevent increased delay after idling #1542

Closed
aloker opened this issue Feb 18, 2018 · 1 comment

Comments

@aloker
Copy link

aloker commented Feb 18, 2018

See https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_server_keepalivetimeout

As described in #1368, starting from Node v8, the server will disconnect the socket after 5 seconds of idling. Re-establishing the socket seems to take something in the order of tenths of seconds, making SPA prerendering requests with more than 5 seconds in between taking considerably longer than necessary (e.g. >1 second).

I suggest setting the keepAliveTimeout to a higher value, or to 0 or to make it configurable.

Update: also, the timeout property (https://nodejs.org/api/http.html#http_server_timeout) should be configurable. By default, the server-socket will timeout after 2 minutes, even if the keepAliveTimeout is set to 0.

@aloker aloker changed the title Configure keepAliveTimeout on HTTP server (Node 8+) Configure keepAliveTimeout on HTTP server (Node 8+) to prevent increased delay after 5 seconds Feb 18, 2018
@aloker aloker changed the title Configure keepAliveTimeout on HTTP server (Node 8+) to prevent increased delay after 5 seconds Configure keepAliveTimeout/timeout on HTTP server (Node 8+) to prevent increased delay after idling Feb 18, 2018
@SteveSandersonMS
Copy link
Member

Thanks for the info! Would you be willing to submit a PR that makes this configurable?

I'll close this pending any PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants