Thihara Thihara - 1 month ago 18
Node.js Question

AWS-SDK for node js connection management

Does aws-sdk for node js manage it's connections through an internal pool?

Their documentation kind of leads me to believe that.


httpOptions (map) — A set of options to pass to the low-level HTTP
request. Currently supported options are:

proxy [String] — the URL to proxy requests through agent [http.Agent,
https.Agent] — the Agent object to perform HTTP requests with. Used
for connection pooling. Defaults to the global agent
(http.globalAgent) for non-SSL connections. Note that for SSL
connections, a special Agent object is used in order to enable peer
certificate verification. This feature is only available in the
Node.js environment.


But there's no way, at least none that I could find, that'd let me define any connection pool properties.

What are my options if I want to control the concurrent connections in use?

Is it better to let the SDK handle that?

Answer

can give the http.Agent with whatever settings you want for max sockets.

var AWS = require('aws-sdk');
var http = require('http');
AWS.config.update({
  httpOptions: {
    agent: new http.Agent(...)
  }
})