by default nodejs http module will establish new TCP connection to server with
dns resolution -> getaddr call in system
make tcp handshake connection
use that socket for communication
current implementation without agent results in lots of ENOTFOUND getaddr error in the dns module internally used by node.js due to the limitations of file descriptor in OS level. (this happens only if end user sends lots of request concurrently like use-cases of bulk import / high concurrency endpoints used in node.js servers).
using keepAlive agent should be a common practice in node.js sdks.
by default nodejs
http
module will establish new TCP connection to server withcurrent implementation without agent results in lots of
ENOTFOUND getaddr
error in thedns
module internally used by node.js due to the limitations of file descriptor in OS level. (this happens only if end user sends lots of request concurrently like use-cases of bulk import / high concurrency endpoints used in node.js servers).using
keepAlive
agent should be a common practice in node.js sdks.reference: https://github.com/stripe/stripe-node/blob/master/lib/net/NodeHttpClient.js#L8-L9 https://rakshanshetty.in/nodejs-http-keep-alive/
related PR: https://github.com/mixpanel/mixpanel-node/pull/185