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

Allow configuration of MAX_CONNECTING on the connection pool after 4.3.x changes

    • Not Needed


      After migrating from 4.2.1 to 4.3.1 with the connection pool changes made in JAVA-3927 we find that only allowing 2 new connections at a time is too conservative and would like that value to be configurable.

      Our setup used to be (we have 60 worker threads in our app):

      .maxConnectionLifeTime(60, TimeUnit.SECONDS)
      .maxWaitTime(0, TimeUnit.MILLISECONDS)

      Due to external factors we need to limit our connection lifetime to 60 seconds, and we have high throughput on our connections, and we need to limit p99 latency spikes which is why we've instructed the driver to time out rather than wait the default 2 seconds.

      After upgrading to 4.3.1 we started encountering a LOT of timeouts and changed the settings to:

      .maxConnectionLifeTime(60, TimeUnit.SECONDS)
      .maxWaitTime(50, TimeUnit.MILLISECONDS)
      .maintenanceFrequency(250, TimeUnit.MILLISECONDS)

      (changed max wait to 50ms, increased min-size and lowered maintenance freq)

      This takes care of MOST of our time-outs, but we still get the occassional one. It has increased our p99/p100 latency by 50ms, and we're essentially wasting 30 threads per host connecting to the DB.

      It'd be most appreciated if we could configure MAX_CONNECTING instead of having it as a static final package-private constant.

            valentin.kovalenko@mongodb.com Valentin Kavalenka
            bridner.marc@gmail.com Marc Bridner
            0 Vote for this issue
            2 Start watching this issue