Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-3250

Connection not reused and keep growing

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Works as Designed
    • 2.10.3
    • None
    • Connectivity
    • None
    • c# driver in Azure VM hosting Service Fabric Cluster

    Description

      We have a proces where all our tenant databases are processed. In our setup each tenant has it's own database (with own credentials).

      Currently we use the default of the c# driver (connection pool of 100). What i'm seeing is that the number of connections to our MongoBD server is only increasing.

      It looks like the driver is not reusing used connections from the pool.

      I use the following script

      db.currentOp(true).inprog.reduce(
      {{ (accumulator, connection) => {}}
      {{ ipaddress = connection.client ? connection.client.split(":")[0] : "Internal";}}
      {{ ipaddressActiveConnection = ipaddress + "-active";}}
      {{ ipaddressINActiveConnection = ipaddress + "-INactive"; }}
      {{ accumulator[ipaddress] = (accumulator[ipaddress] || 0) + 1;}}
      {{ accumulator["TOTAL_CONNECTION_COUNT"]++;}}
      {{ if (connection.active) { }}
      {{ accumulator[ipaddressActiveConnection] = (accumulator[ipaddressActiveConnection] || 0) + 1;}}
      {{ accumulator["ACTIVE_CONNECTION_COUNT"]++;}}
      {{ } else {}}
      {{ accumulator[ipaddressINActiveConnection] = (accumulator[ipaddressINActiveConnection] || 0) + 1;}}
      {{ accumulator["INACTIVE_CONNECTION_COUNT"]++;}}
      {{ }}}
      {{ return accumulator;}}
      {{ },}}
      {{ { TOTAL_CONNECTION_COUNT: 0, ACTIVE_CONNECTION_COUNT : 0, INACTIVE_CONNECTION_COUNT : 0 }}}
      )

      When running i see that the number of INACTIVE_CONNECTIONS is increasing.

      and a little later

       

      Is this normal, cause it feels like a bug, where a new connection (from pool) is created instead of reusing an inactive one.

       

      Attachments

        1. image-2020-11-05-10-19-39-946.png
          19 kB
          Dennis Hoefakker
        2. image-2020-11-05-10-19-51-989.png
          20 kB
          Dennis Hoefakker
        3. image-2020-11-05-12-00-36-118.png
          10 kB
          Dennis Hoefakker
        4. image-2020-11-05-12-01-24-890.png
          10 kB
          Dennis Hoefakker

        Activity

          People

            james.kovacs@mongodb.com James Kovacs
            dennis@hoefakkr.nl Dennis Hoefakker
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: