I would like to ask the master, is my understanding of the following parameters of mongodb correct?
maxWaitTime=120000 means that you have connected to mongodb and are waiting for data to return. This waiting time
connectTimeout=10000 refers to the time when requesting a mongodb connection, not yet connected, and waiting for the connection
socketTimeout=0 means that it has been connected and data is being transmitted. The data transmission process will take time. Here is the waiting time for the data transfer to end
Stackoverflow上有一个有140次赞的回答:How to configure MongoDB Java driver MongoOptions for production use?
connectTimeout. As the name suggest number of milliseconds the driver will wait before a connection attempt is aborted. Set timeout to something long (15-30 seconds) unless there's a realistic, expected chance this will be in the way of otherwise succesful connection attempts. Normally if a connection attempt takes longer than a couple of seconds your network infrastructure isn't capable of high throughput.
maxWaitTime. Number of ms a thread will wait for a connection to become available on the connection pool, and raises an exception if this does not happen in time. Keep default.
socketTimeout. Standard socket timeout value. Set to 60 seconds (60000).
Additional instructions are as follows:
There are many network-related waiting settings in the MongoDB Client driver settings, which are introduced in order:
1. The time it takes for the Client to find the Server. In the RS or Shard environment, the Client needs to find the Server it needs
Corresponding parameters: ServerSelctionTimeOut
2. After finding the Server, you need to establish a Connection
3. After finding the Connection, there is Socket communication. The parameter of the network waiting time during the Socket communication between the client and MonogoDB is: socketTimeout
For reference.
Love MongoDB! Have Fun!