node-modules / agentkeepalive

Support keepalive http agent.
MIT License
579 stars 57 forks source link

Relevance in later versions of NODE #62

Closed tony-gutierrez closed 6 years ago

tony-gutierrez commented 6 years ago

I noticed that the benchmark script in this library really just compares keep-alive to non-keepalive.

Has any benchmarking been done against the normal http.Agent or https.Agent using keepalive and the same maxSockets?

Are there any performance benefits to using this library?

tony-gutierrez commented 6 years ago

So, found an answer to my own question. Node doesn't do socket timeouts in many versions. I use 8.9.4 and it doesn't do it there (No timeout option: https://nodejs.org/docs/latest-v8.x/api/http.html#http_new_agent_options). Version 10 does seem to have a timeout option that it passes into the socket, but apparently this does not close the socket (https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback).

So using this library will indeed add that functionality to certain versions of Node.

fengmk2 commented 6 years ago

agentkeepalive using the same code base as http.Agent. You can find the different between these two agents: What's different from original http.Agent?

killagu commented 6 years ago

Node 8.9.4 have time option in agent constructor but no documented.

If the socket is timeout, will emit timeout event.