How to open db connections when clustering a node app?


#1

Hello,

Assuming the following snippet:

var couchbase = require('couchbase');

var bucket = new couchbase.Connection({
‘bucket’: ‘default’,
‘host’: ‘127.0.0.1:8091’
}, function (err) {
if (err) {
// Failed to make a connection to the Couchbase cluster.
throw err;
}
});

If I cluster my Node app, how should I connect to couchbase?:

a) using one connection and share the bucket across workers.
b) every worker uses its own database connection.

Thanks.