Hi,I noticed that on every call to asyncInsert() a new I/O thread is created and waits for an available connection. I see that the maximum number of possibly waiting threads is set to the max connections multiplied by a factor of 5.
During my test I get many of the following exception:
MongoWaitQueueFullException: Too many threads are already waiting for a connection. Max number of threads (maxWaitQueueSize) of 500 has been exceeded.
I tried to set the max connection option to a relatively high value but that did not help and the above exception is still thrown. Furthermore, the driver spawned a huge amount of threads waiting for connections.
Since it is NIO2 based I wonder why there is a need to spawn so many I/O threads, whereas a single thread can handle multiple connections?
I would be very grateful for any feedback.