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

Driver should dedicate a thread to monitor each server

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • 2.12.2, 3.0.0
    • 2.12.0, 2.12.1
    • Cluster Management
    • None

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: