[http] accept and document rest of params for agentkeepalive
This commit is contained in:
@ -128,22 +128,29 @@ Default::: `60000`
|
||||
Default::: `3000`
|
||||
|
||||
|
||||
`maxSockets`[[config-keep-alive-max-sockets]]:: `Number` -- Maximum number of sockets to allow per host.
|
||||
|
||||
Default::: `Infinity`
|
||||
|
||||
|
||||
`keepAlive`[[config-keep-alive]]:: `Boolean` -- Should the connections to the node be kept open forever? This behavior is recommended when you are connecting directly to Elasticsearch.
|
||||
|
||||
Default::: `true`
|
||||
|
||||
|
||||
`keepAliveInterval`[[config-keep-alive-interval]]:: `Number` -- How often, in milliseconds, should TCP KeepAlive packets be sent over sockets being kept alive. Only relevant if `keepAlive` is set to `true`.
|
||||
|
||||
`maxSockets`[[config-max-sockets]]:: `Number` -- Maximum number of concurrent requests that can be made to any node.
|
||||
|
||||
Default::: `10`
|
||||
Default::: `1000`
|
||||
|
||||
|
||||
`keepAliveMaxFreeSockets`[[config-keep-alive-max-free-sockets]]:: `Number` -- Maximum number of inactive sockets to keep connected to a node. Only relevant if `keepAlive` is set to `true`.
|
||||
|
||||
`minSockets`[[config-min-sockets]]:: `Number` -- Minimum number of sockets to keep connected to a node, only applies when `keepAlive` is true
|
||||
Default::: `256`
|
||||
|
||||
Default::: `10`
|
||||
|
||||
`keepAliveFreeSocketTimeout`[[config-keep-alive-free-socket-timeout]]:: `Number` -- Sets inactive sockets to timeout after milliseconds of inactivity. Only relevant if `keepAlive` is set to `true`.
|
||||
|
||||
Default::: `60000`
|
||||
|
||||
|
||||
`suggestCompression`[[config-suggest-compression]]:: `Boolean` -- The client should inform Elasticsearch, on each request, that it can accept compressed responses. In order for the responses to actually be compressed, you must enable `http.compression` in Elasticsearch. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-http.html[these docs] for additional info.
|
||||
|
||||
@ -38,11 +38,11 @@ function HttpConnector(host, config) {
|
||||
this.useSsl = this.host.protocol === 'https';
|
||||
|
||||
config = _.defaults(config || {}, {
|
||||
maxSockets: Infinity,
|
||||
keepAlive: true,
|
||||
minSockets: 10,
|
||||
// 10 makes sense but 11 actually keeps 10 sockets around
|
||||
// https://github.com/mikeal/forever-agent/issues/8
|
||||
maxSockets: 11
|
||||
keepAliveInterval: 1000,
|
||||
keepAliveMaxFreeSockets: 256,
|
||||
keepAliveFreeSocketTimeout: 60000
|
||||
});
|
||||
|
||||
this.agent = config.createNodeAgent ? config.createNodeAgent(this, config) : this.createAgent(config);
|
||||
@ -90,8 +90,10 @@ HttpConnector.prototype.createAgent = function (config) {
|
||||
HttpConnector.prototype.makeAgentConfig = function (config) {
|
||||
var agentConfig = {
|
||||
keepAlive: config.keepAlive,
|
||||
keepAliveMsecs: config.keepAliveInterval,
|
||||
maxSockets: config.maxSockets,
|
||||
minSockets: config.minSockets
|
||||
maxFreeSockets: config.keepAliveMaxFreeSockets,
|
||||
freeSocketKeepAliveTimeout: config.keepAliveFreeSocketTimeout
|
||||
};
|
||||
|
||||
if (this.useSsl) {
|
||||
|
||||
Reference in New Issue
Block a user