0

I am using spring-boot-starter-data-mongodb (version 2.3.1 RELEASE) to manipulate mongdb.

I notice that timeout is an important setting for client. I've searched over this forum and found various recommendations in terms of these settings, such as:

How to configure MongoDB Java driver MongoOptions for production use?

Howover, the above answer seems deprecated (last edited in 2013), as I cannot find settings like socketTimeout or autoConnectRetry in the latest 4.0.4 mongodb-driver-core.

Using mongodb 4.0.4 driver, we can notice several timeout settings under SocketSettings:

  • connectTimeout: Seems to be socket connect timeout, default 10s
  • readTimeout: Socket read timeout, default 0s

Can anyone give more explanations in terms of these timeout settings ?

Shu
  • 128
  • 1
  • 10
  • Connect timeout applies to the initial connection on a socket. Socket timeout applies to subsequent read & write operations. – D. SM Jul 28 '20 at 09:16
  • https://docs.mongodb.com/ruby-driver/current/tutorials/ruby-driver-create-client/#socket-timeout – D. SM Jul 28 '20 at 09:16
  • @D.SM, thanks for the reply. I'am using mongodb server 4.0.10, it seems that socket timeout setting has disapeared, I am using mongodb java-driver-core-4.0.4, in SocketSetting, I only found: 1). connectTimeoutMS, default is 10s, 2). readTimeoutMS default 0, 3). receiveBufferSize 4). sendBufferSize – Shu Jul 29 '20 at 07:24
  • Link to driver documentation where the timeouts are described please. – D. SM Jul 29 '20 at 16:01

0 Answers0