var connectionString = "mongodb://localhost/?safe=true;maxpoolsize=200";
var server = MongoServer.Create(connectionString);
The default pool size is 100. If you are using less than 100 threads
then there cannot be any contention for the connections. If your
threads are using MongoDB intensively you could set the connection
pool size equal to the number of threads you are using.
> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>
Hi Robert
Thank you for getting back to me. This is useful information, but it
looks like the error was at my end. I don't think I was disposing of
connection objects properly when aborting my threads. Having said
that, I'd still like to be able to disable connection pooling or at
least flush the connections! (Hint hint!)
Off the top of my head (remember, NYE has come and gone since then!),
the thread's "main" should've looked something like this:
Server conn = null;
try
{
conn = Server.Create(connection_string);
...
..
.
}
catch (ThreadAbortException ex)
{
// ok to ignore
}
catch (Exception error)
{
throw error;
}
finally
{
if(conn != null)
{
conn.Disconnect();