Add maxConnection environment configuration, have it default to 128

The number gives the maximum number of contemporary connections and
is dimensioned on the limit of open file descriptors found to be
needed on a per-connection basis.
This commit is contained in:
Sandro Santilli 2013-01-29 17:36:50 +01:00
parent 8d5baebf1d
commit 2510a47262
6 changed files with 23 additions and 0 deletions

8
app.js
View File

@ -33,7 +33,15 @@ var Windshaft = require('windshaft');
var serverOptions = require('./lib/cartodb/server_options');
ws = CartodbWindshaft(serverOptions);
// Maximum number of connections for one process
// 128 is a good number if you have up to 1024 filedescriptors
// 4 is good if you have max 32 filedescriptors
// 1 is good if you have max 16 filedescriptors
ws.maxConnections = global.environment.maxConnections || 128;
ws.listen(global.environment.port, global.environment.host);
ws.on('listening', function() {
console.log("Windshaft tileserver started on " + global.environment.host + ':' + global.environment.port);
});

View File

@ -36,6 +36,9 @@ var serverOptions = require('./lib/cartodb/server_options');
var ws = CartodbWindshaft(serverOptions);
// Maximum number of connections for one process (see apps.js)
ws.maxConnections = global.environment.maxConnections || 128;
//.use(cluster.logger('logs'))
//.use(cluster.stats())
//.use(cluster.pidfiles('pids'))

View File

@ -2,6 +2,9 @@ var config = {
environment: 'development'
,port: 8181
,host: '127.0.0.1'
// Maximum number of connections for one process
// 128 is a good value with a limit of 1024 open file descriptors
,maxConnections:128
// idle socket timeout, in miliseconds
,socket_timeout: 600000
,enable_cors: true

View File

@ -2,6 +2,9 @@ var config = {
environment: 'production'
,port: 8181
,host: '127.0.0.1'
// Maximum number of connections for one process
// 128 is a good value with a limit of 1024 open file descriptors
,maxConnections:128
// idle socket timeout, in miliseconds
,socket_timeout: 600000
,enable_cors: true

View File

@ -2,6 +2,9 @@ var config = {
environment: 'production'
,port: 8181
,host: '127.0.0.1'
// Maximum number of connections for one process
// 128 is a good value with a limit of 1024 open file descriptors
,maxConnections:128
// idle socket timeout, in miliseconds
,socket_timeout: 600000
,enable_cors: true

View File

@ -2,6 +2,9 @@ var config = {
environment: 'test'
,port: 8888
,host: '127.0.0.1'
// Maximum number of connections for one process
// 128 is a good value with a limit of 1024 open file descriptors
,maxConnections:128
// idle socket timeout, in miliseconds
,socket_timeout: 600000
,enable_cors: true