a problem about pool size

169 views
Skip to first unread message

Li Jiang

unread,
Sep 16, 2012, 9:12:42 PM9/16/12
to node-mong...@googlegroups.com
I used the node-mongodb-native in some projects, i confused by a problem that when and how to use poolsize in MongoDB native driver;can  you help me to resolve this problem? Thank you.

Wes Freeman

unread,
Sep 16, 2012, 9:48:21 PM9/16/12
to node-mong...@googlegroups.com
It's for when you want to be able to use the connection to do more than one query at a time.

This is a bit tricky, because you do queries asynchronously, so you might end up doing more than one at a time unintentionally.

Wes

Tom

unread,
Sep 16, 2012, 9:53:52 PM9/16/12
to node-mong...@googlegroups.com
Are you sure Wes? I was of the impression that it actually creates
multiple connections with the database servers, thereby achieving
asynchornous queries. With one connection you cannot perform queries
asynchronously.

I would consider this normal behavior. In fact I believe that the
default pool size should be bigger than one, because the current
setting of one may cause people to rely on the accompanying
"unintentioned synchronousness".

Tom

Wes Freeman

unread,
Sep 16, 2012, 10:03:48 PM9/16/12
to node-mong...@googlegroups.com
I know that by default it only uses one connection, but maybe it can handle multiple queries at once without safe:true. Maybe I'm thinking of when you use safe:true and callbacks... it's been a while since I was deeper in the driver. Anyone else want to chime in?

Wes Freeman

unread,
Sep 16, 2012, 10:11:30 PM9/16/12
to node-mong...@googlegroups.com
Sorry Tom, I totally misread your comment. Yes, it (pooling) is for having multiple connections open to the server so that you can run multiple queries/inserts/updates at the same time. It actually does create multiple connections with connection pooling enabled. That's what I meant to say in my initial response, but I was less than clear.

christkv

unread,
Sep 16, 2012, 11:03:47 PM9/16/12
to node-mong...@googlegroups.com
The driver defaults to 5 connections these days (poolSize:5).

Wes Freeman

unread,
Sep 17, 2012, 12:46:36 AM9/17/12
to node-mong...@googlegroups.com
Oh, cool. That's good to know.

Wes

Li Jiang

unread,
Sep 17, 2012, 9:42:00 PM9/17/12
to node-mong...@googlegroups.com

Thank you for your answers.I want to know the poolsize how to work in the mongodb.Thanks again
在 2012年9月17日星期一UTC+8上午9时12分42秒,Li Jiang写道:
Reply all
Reply to author
Forward
0 new messages