Mongodb’s thread pool setting does not work

  mongodb, question

Recently encountered the problem of thread pool, the default mongodb allocates a thread pool for each connection (i.e. a connection object from new). There are at most 10 threads in the thread pool. Online, it is said that the thread pool size can be adjusted through MongoObject’s connectionPerHost parameter, but in fact, no matter how I modify the value of this parameter, the thread pool size is 10. May I ask why this is and if there is any place to modify it?

In addition, for the application of a web page, is it a good way for the client to create a connection (a new connection object) every time it clicks on the interface, or is it a good way to create a connection at the beginning of the program and then allocate it to its larger thread pool, and take one from the thread pool every time the client connects? Personally, I feel that the first one has a higher load on the system under the condition of high concurrency.

I found the reason myself:
1 The default thread count is 10 because the JAVA driver version is too old. The version is 2.2 and the latest version is 2.12. The default thread pool for one connection has been set to 100.
The advice given in the official document is to open a connection and then fetch the connection from the thread pool
3 MongoOpection class was abolished in version 2.12, but it can be used. Although setting connectionPerHost parameter can ostensibly modify the number of threads in the thread pool in the connection parameter, in fact the upper limit of thread pool in the background of the system is still 100, and the parameter has not taken effect (it is suspected that there is another setting method). However, I think it is not very important. If the thread pool can occupy more than 100 uniformly, it is estimated that the system design is also problematic.