[CSHARP-2055] Sudden burst of "Exception = 'MongoDB.Driver.MongoConnectionException: Too many threads are already waiting for a connection." Created: 05/Oct/17 Updated: 27/Oct/23 Resolved: 13/Oct/17 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Manjunath Bhuyar | Assignee: | Robert Stam |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | question | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
Hi, Our ecosystem uses MongoDB as preferred storage engine (we are running 3.2 Enterprise version server) and c# driver 1.11. From last two days our system is throwing exceptions to establish connection We are using all default settings for establishing the connection. After googling for a while, people suggested to increase the "MaxConnectionPoolSize" & "WaitQueueSize" settings, what are the ideal settings? Regards [Exception = 'MongoDB.Driver.MongoConnectionException: Too many threads are already waiting for a connection. |
| Comments |
| Comment by Manjunath Bhuyar [ 06/Oct/17 ] |
|
Hi Robert, Found the issue, it was bad indexing on our part, our couple of collections were running on peak with multiple queries running very very slow. That made the server super slow to respond. Connection rates were running in 2.7K range, after applying proper index everything came back to normal and now connections are under 250 Thank you for the support and we can close the case. Regards |
| Comment by Manjunath Bhuyar [ 06/Oct/17 ] |
|
Attached is the cluster monitoring graphs, which show a sudden spike in activity in the last two days |
| Comment by Manjunath Bhuyar [ 06/Oct/17 ] |
|
Hi Robert, No luck with the setting of Poolsize to 300, still seeing connection failures. And the connection issues are happening on only one Database on the cluster and other DB's are having a different error -Manju Connection issue Stack trace ReadPreference issue stack trace |
| Comment by Manjunath Bhuyar [ 05/Oct/17 ] |
|
Thank you Robert, we will try your suggestion and double the values. Regards |
| Comment by Robert Stam [ 05/Oct/17 ] |
|
There is no single setting that is ideal for everyone. You want MaxConnectionPoolSize to be big enough to handle spikes in load without: 1. Allowing too many connections to be opened (overloading the server with connections) You want WaitQueueSize to be big enough to handle spikes in load without: 1. Throwing an exception because the wait queue is full So the ideal setting will depend on your load. Given that you are seeing these exceptions we can deduce that your load has grown to the point where your current settings are no longer adequate. Perhaps the easiest thing is to double each of the values and see whether that prevents further exceptions. |