Created
July 21, 2011 21:56
-
-
Save SaleemJavid/1098326 to your computer and use it in GitHub Desktop.
The config settings for mongo server on C# driver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static Driver.MongoConnectionStringBuilder GetConnectionStringBuilder(string serverString) | |
| { | |
| var builder = new Driver.MongoConnectionStringBuilder(serverString); | |
| builder.MinConnectionPoolSize = DriverInterfaceConfig.MinPoolSize; | |
| builder.MaxConnectionPoolSize = DriverInterfaceConfig.MaxPoolSize; | |
| builder.WaitQueueMultiple = DriverInterfaceConfig.WaitQueueMultiple; | |
| // if maxpoolsize = 20 | |
| // and waitqueuemultiple = 3 | |
| // then number of requests that will be put in queue waiting for free connection is 20*3 | |
| // | |
| builder.ConnectTimeout = DriverInterfaceConfig.ConnectionTimeOut; | |
| return builder; | |
| } | |
| private static Driver.MongoServer GetPooledConnection(string serverString) | |
| { | |
| // serverString "Server=localhost:27017" | |
| var builder = GetConnectionStringBuilder(serverString); | |
| var settings = builder.ToServerSettings(); | |
| Driver.MongoServer server = MongoDB.Driver.MongoServer.Create(settings); | |
| return server; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment