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
过去多啦不再A梦2017-05-17 10:04:52
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).
淡淡烟草味2017-05-17 10:04:52
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
1)每次都创建Connection,对应的网络等待的参数就是:connectTimeout
2)Connection pooling的话,从Connection Pool取得Connection,对应的网络等待的参数:maxWaitTime.
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!