It depends on how active your threads are with database operations and
how long the database operations take.
I would suggest increasing your connectionsPerHost to something closer
to the number of threads you have -- for a normal web application
10-100/1 is a reasonable number. If you expect all your threads to do
database operations at the same time then increasing it to the number
of threads is probably your best option.
Can you collection mongostat data from the time when you are seeing
things get this error on the java side?
On Thu, Aug 30, 2012 at 6:36 PM, Paul Kim <
pa...@funsockets.com> wrote:
> Hi everybody,
>
> I have about a dozen applications in beta accessing the same Mongo
> standalone database, which in production will be a cluster with master + 2
> slaves. Basically, we started getting "com.mongodb.DBPortPool$SemaphoresOut:
> Out of semaphores to get db connection" error.
>
> Our servers currently can have 256 threads running, any more than that will
> be queued. With mongo java driver, the default will only support up to 50
> threads. That means the mongo connection will fail if server is trying to
> process 50 or more requests.
>
> We changed the threadsAllowedToBlockForConnectionMultiplier in MongoOptions
> to 26. This will make our server support up to 260 mongo threads.
>
> This seemed to resolve the "Out of semaphores" error, but we have started to
> see many queries get backed up and take several tens of seconds to process.
> We would like to increase our throughput to handle this traffic. We are
> considering modifying MongoOptions:
>
> increasing connectionsPerHost
> setting maxWaitTime to non-zero
>
> Is this the right direction to go, or are there other adjustments we should
> be making?
>
> I found this thread mentioning threadsAllowedToBlockForConnectionMultiplier
> and connectionsPerHost.
>
> We are running:
>
> Mongo DB v1.8.1
> Mongo java driver 2.4
> Ubuntu 10.04 64-bit
>
> Thanks,
> Paul.
>
>
>
> --
> 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
> See also the IRC channel --
freenode.net#mongodb