Driver should dedicate a thread to monitor each server

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Critical - P2
    • 2.12.2, 3.0.0
    • Affects Version/s: 2.12.0, 2.12.1
    • Component/s: Cluster Management
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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:
              Jeffrey Yemin
              Reporter:
              Jeffrey Yemin
              None
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: