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

Driver should dedicate a thread to monitor each server

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.12.2, 3.0.0
    • Affects Version/s: 2.12.0, 2.12.1
    • Component/s: Cluster Management
    • Labels:
      None

      In 2.12.0, the driver started using a ScheduledExecutorService to monitor the servers in MongoClient. This service was initialized to use a number of threads equal to the size of the seed list given to MongoClient. The idea was to reduce resource consumption by minimizing the number of background threads created by MongoClient, though this number could be increased using com.mongodb.MongoClientOptions.Builder#heartbeatThreadCount.

      However, under some circumstances where servers are unavailable and take a significant amount of time to timeout on connect, this could result in starvation, and prevent the MongoClient from having enough free threads to monitor servers that are actually reachable and available.

      To fix this, we are going to change the design so that the client dedicates a single-threaded ScheduledExecutorService for each server being monitored. This will eliminate the possibility of starvation, at the expense of slightly higher resource consumption.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: