Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between keepAliveTimeout and timeout?

Tags:

node.js

Reading Node's doc about server.keepAliveTimeout:

If the server receives new data before the keep-alive timeout has fired, it will reset the regular inactivity timeout, i.e., server.timeout.

How is that different from server.timeout?

It sounds like they are both about socket timeout which only start to tick on inactivity.

like image 504
lakeskysea Avatar asked Jun 15 '19 00:06

lakeskysea


2 Answers

Keep-Alive is a header part of the Http Protocol. The Keep-Alive header will allow multiple Http Requests to be send over a single connection instead of using multiple.

So setting the keepAliveTimeout will decide how long these Keep-Alive connections are allowed to stay open. The timeout decides the maximum amount of time the server will wait for a client's response.

more info about Keep-Alive can be found here: https://blog.stackpath.com/glossary-keep-alive/

like image 166
Software Person Avatar answered Nov 17 '22 02:11

Software Person


server.timeout is time (in ms) of inactivity allowed once request received ( need not set always , default is 5 mins )

server.keepAliveTimeout is time (in ms) server will wait and keep the connection open after last response. ( need not set always , default is 5sec )

like image 7
parveen Avatar answered Nov 17 '22 00:11

parveen