Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3244

Ways to timeout long mongo write operation

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Hi,

      We are using mongo-java-driver 3.4.2, and our database structure is:

      sharded-cluster: # of shard: 3

      Have replica set every dc across US.

      Have 3 primarys, all the others are secondary.

      We now experience cross-dc network issue in one datacenter to the primary in another datacenter. So some of the requests have very long latency (16min), and succeed.

      Our solution is to add retry template in client side. So for the request that has a long latency, it will trigger retry and the retry one can succeed very fast. The problem is, we cannot kill the previous one (which with long latency), and eventually the mongodb execute 2 requests for it.

      We investigate why the long latency, and found the network from mongos to mongod has huge package loss, it may be the root cause.

      We wish to timeout the long latency write operation. But found mongo doc and mongo-java-driver doc, no useful timeout found.

       

      Work we have done:

      From MongoClientOption: add socketTiemout, connectionTimeout, maxConnectionIdleTime, maxConnectionLifeTime. All with no use. Request can still take very long(longest is 16min)

            Assignee:
            Unassigned Unassigned
            Reporter:
            zchen12345 Zhexuan Chen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: