How to find the optimal value for mongo.options.connectionsPerHost

366 Views Asked by At

Currently I am using Grails and I am running several servers connecting to a single mongo server.

options {
            autoConnectRetry = true
            connectTimeout = 3000
            connectionsPerHost = 100
            socketTimeout = 60000
            threadsAllowedToBlockForConnectionMultiplier = 10
            maxAutoConnectRetryTime=5
            maxWaitTime=120000
        }

Unfortunately, when I run 50 servers, total number of connections goes up by 5k. After a bit of research I found that this was a simple config in the DataSource.groovy

I am sure that my programs do not need 100 mongo connections. But I am unsure what value should I set this to.

I have 2 doubts. First, how to determine the optimal value for the connectionsPerHost. Second, whether all these 100 connections are created once and then pooled?

0

There are 0 best solutions below