Replica Set Options for poolSize doesn't seem to work

59 views
Skip to first unread message

Dustin Davidson

unread,
May 29, 2013, 1:49:32 PM5/29/13
to node-mong...@googlegroups.com
Having issues with passing the poolSize option to a Replica Set instance.  The connection works fine, but I only see 15 connections(default is 5 per server) not 150(I want 50 per server).  Any thoughts?


var options = {poolSize:50, auto_reconnect: true, readPreference: 'ReadPreference.NEAREST'};
  //Replica Set Init
  var replSet = new ReplSetServers( [
    new Server( 'localhost', 27017, options),
    new Server( 'localhost', 27018, options),
    new Server( 'localhost', 27019, options)],
    {rs_name: 'rs0', read_secondary: true}
  );

  // DB connection
  var db = new Db(db_conf.database, replSet,{w:2, native_parser:false, safe: true});

  //Opening the DB connection
  db.open(function(err, db) {
    if(err){
      console.error('Database Connection Error -- ' + Date());
      console.error(err.stack);
    }else{
      console.log('Connected to Mongo');
    }
  });

Bryant Chou

unread,
Jul 19, 2013, 11:17:32 AM7/19/13
to node-mong...@googlegroups.com
+1. i'm seeing the same issues.

Bryant Chou

unread,
Jul 19, 2013, 11:34:03 AM7/19/13
to node-mong...@googlegroups.com
+1. i'm seeing the same issues.

On Wednesday, May 29, 2013 10:49:32 AM UTC-7, Dustin Davidson wrote:

christkv

unread,
Jul 19, 2013, 11:45:48 AM7/19/13
to node-mong...@googlegroups.com
I'm trying to discourage the use of the Db and Server as it's better to use MongoClient.connect since it does topology discovery for you (auto configures to a single server, repliaset or sharded system)

if you insist you need to set the pool size on the replset instance not on the individual server instances

http://mongodb.github.io/node-mongodb-native/api-generated/replset.html

Bryant Chou

unread,
Jul 19, 2013, 12:29:22 PM7/19/13
to node-mong...@googlegroups.com
I'm using MongoClient.connect, passing in the opts as follows:
var opts = {
     poolSize: 20,
     replSet: {
      socketOptions: {
        connectTimeoutMS: 30000,
        socketTimeoutMS: 30000
      }
    }
}
MongoClient.connect(connectionString, opts, cb);



--
You received this message because you are subscribed to a topic in the Google Groups "node-mongodb-native" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-mongodb-native/3Xw-69VH52U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-mongodb-na...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages