[http] accept and document rest of params for agentkeepalive
This commit is contained in:
@ -128,22 +128,29 @@ Default::: `60000`
|
|||||||
Default::: `3000`
|
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.
|
`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`
|
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::: `1000`
|
||||||
|
|
||||||
Default::: `10`
|
|
||||||
|
|
||||||
|
|
||||||
|
`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.
|
`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';
|
this.useSsl = this.host.protocol === 'https';
|
||||||
|
|
||||||
config = _.defaults(config || {}, {
|
config = _.defaults(config || {}, {
|
||||||
|
maxSockets: Infinity,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
minSockets: 10,
|
keepAliveInterval: 1000,
|
||||||
// 10 makes sense but 11 actually keeps 10 sockets around
|
keepAliveMaxFreeSockets: 256,
|
||||||
// https://github.com/mikeal/forever-agent/issues/8
|
keepAliveFreeSocketTimeout: 60000
|
||||||
maxSockets: 11
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.agent = config.createNodeAgent ? config.createNodeAgent(this, config) : this.createAgent(config);
|
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) {
|
HttpConnector.prototype.makeAgentConfig = function (config) {
|
||||||
var agentConfig = {
|
var agentConfig = {
|
||||||
keepAlive: config.keepAlive,
|
keepAlive: config.keepAlive,
|
||||||
|
keepAliveMsecs: config.keepAliveInterval,
|
||||||
maxSockets: config.maxSockets,
|
maxSockets: config.maxSockets,
|
||||||
minSockets: config.minSockets
|
maxFreeSockets: config.keepAliveMaxFreeSockets,
|
||||||
|
freeSocketKeepAliveTimeout: config.keepAliveFreeSocketTimeout
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.useSsl) {
|
if (this.useSsl) {
|
||||||
|
|||||||
Reference in New Issue
Block a user