diff --git a/NEWS.md b/NEWS.md index 2c873cdc..175532d7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,9 +1,13 @@ # Changelog -## 2.11.1 +## 2.12.0 Released 2015-mm-dd +New features: + - Make http and https globalAgent options configurable + * If config is not provided it configures them with default values + ## 2.11.0 diff --git a/app.js b/app.js index 3844a74e..e2651bfd 100755 --- a/app.js +++ b/app.js @@ -9,6 +9,8 @@ var path = require('path'); var fs = require('fs'); +var http = require('http'); +var https = require('https'); var RedisPool = require('redis-mpool'); var _ = require('underscore'); @@ -72,6 +74,17 @@ var redisOpts = _.defaults(global.environment.redis, { }); var redisPool = new RedisPool(redisOpts); +// set global HTTP and HTTPS agent default configurations +// ref https://nodejs.org/api/http.html#http_new_agent_options +var agentOptions = _.defaults(global.environment.httpAgent || {}, { + keepAlive: false, + keepAliveMsecs: 1000, + maxSockets: Infinity, + maxFreeSockets: 256 +}); +http.globalAgent = new http.Agent(agentOptions); +https.globalAgent = new https.Agent(agentOptions); + // Include cartodb_windshaft only _after_ the "global" variable is set // See https://github.com/Vizzuality/Windshaft-cartodb/issues/28 var cartodbWindshaft = require('./lib/cartodb/cartodb_windshaft'), diff --git a/config/environments/development.js.example b/config/environments/development.js.example index 760a7840..c3401aa2 100644 --- a/config/environments/development.js.example +++ b/config/environments/development.js.example @@ -196,6 +196,13 @@ var config = { unwatchOnRelease: false, // Send unwatch on release, see http://github.com/CartoDB/Windshaft-cartodb/issues/161 noReadyCheck: true // Check `no_ready_check` at https://github.com/mranney/node_redis/tree/v0.12.1#overloading } + // For more details about this options check https://nodejs.org/api/http.html#http_new_agent_options + ,httpAgent: { + keepAlive: true, + keepAliveMsecs: 1000, + maxSockets: 25, + maxFreeSockets: 256 + } ,varnish: { host: 'localhost', port: 6082, // the por for the telnet interface where varnish is listening to diff --git a/config/environments/production.js.example b/config/environments/production.js.example index 2e31ddf6..d251ac8e 100644 --- a/config/environments/production.js.example +++ b/config/environments/production.js.example @@ -190,6 +190,13 @@ var config = { unwatchOnRelease: false, // Send unwatch on release, see http://github.com/CartoDB/Windshaft-cartodb/issues/161 noReadyCheck: true // Check `no_ready_check` at https://github.com/mranney/node_redis/tree/v0.12.1#overloading } + // For more details about this options check https://nodejs.org/api/http.html#http_new_agent_options + ,httpAgent: { + keepAlive: true, + keepAliveMsecs: 1000, + maxSockets: 25, + maxFreeSockets: 256 + } ,varnish: { host: 'localhost', port: 6082, // the por for the telnet interface where varnish is listening to diff --git a/config/environments/staging.js.example b/config/environments/staging.js.example index 941083bd..5fe72c9e 100644 --- a/config/environments/staging.js.example +++ b/config/environments/staging.js.example @@ -190,6 +190,13 @@ var config = { unwatchOnRelease: false, // Send unwatch on release, see http://github.com/CartoDB/Windshaft-cartodb/issues/161 noReadyCheck: true // Check `no_ready_check` at https://github.com/mranney/node_redis/tree/v0.12.1#overloading } + // For more details about this options check https://nodejs.org/api/http.html#http_new_agent_options + ,httpAgent: { + keepAlive: true, + keepAliveMsecs: 1000, + maxSockets: 25, + maxFreeSockets: 256 + } ,varnish: { host: 'localhost', port: 6082, // the por for the telnet interface where varnish is listening to diff --git a/config/environments/test.js.example b/config/environments/test.js.example index 65cce732..f0002aa5 100644 --- a/config/environments/test.js.example +++ b/config/environments/test.js.example @@ -192,6 +192,13 @@ var config = { unwatchOnRelease: false, // Send unwatch on release, see http://github.com/CartoDB/Windshaft-cartodb/issues/161 noReadyCheck: true // Check `no_ready_check` at https://github.com/mranney/node_redis/tree/v0.12.1#overloading } + // For more details about this options check https://nodejs.org/api/http.html#http_new_agent_options + ,httpAgent: { + keepAlive: true, + keepAliveMsecs: 1000, + maxSockets: 25, + maxFreeSockets: 256 + } ,varnish: { host: '', port: null, // the por for the telnet interface where varnish is listening to diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 8382cc3a..99b48dd2 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "windshaft-cartodb", - "version": "2.11.1", + "version": "2.12.0", "dependencies": { "cartodb-psql": { "version": "0.4.0", diff --git a/package.json b/package.json index 07ebdf3a..2854752e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "windshaft-cartodb", - "version": "2.11.1", + "version": "2.12.0", "description": "A map tile server for CartoDB", "keywords": [ "cartodb"