Reputation: 3457
I am using MongoDb as the Database for our WebApplication
Currently we are facing a issue in mongoDb which is "max connections 8000 exceeded"
To solve this problem we have decided to increase the connections to 20000
But not sure how to increase the connections in MongoDB .
Currently we have only this property called maxConnections whose vaue is 800 in our code
This is the stats collected from mongodb server
db.serverStatus().connections
{ "current" : 7000, "available" : 1000 }
We start the mongodb this way
mongod --config /etc/mongodb.conf
and inside the mongodb.conf we have
replSet = test
fork = true
port = 27017
I am not sure why the max conection is showing 8000 ?? where it is hardcoded ??
Could any body please tell me how to find why the connection size is 8000 in my case ??
Upvotes: 0
Views: 242
Reputation: 62648
Do you actually have over 8000 threads access this database concurrently? Perhaps you are instead just spinning up a ton of connections you don't actually need?
That said, the 8000 limit is probably coming from your system limits. ulimit
will restrict the number of usable sockets, which will restrict the number of connections. See the mongod documentation for a complete explanation.
Your approach here, though, should probably be to make sure you're reusing connections rather than just creating tons of them, since it's extremely doubtful that you are actually running 8000 concurrent clients.
Upvotes: 1