Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9022

Enable mongos mode which releases ShardConnections to the pool after read ops

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.4, 2.4.2, 2.5.0
    • Affects Version/s: None
    • Component/s: Sharding
    • Labels:
      None
    • Minor Change

      Create a new serverParameter for mongos, "releaseConnectionsAfterResponse," which enables returning ShardConnections from the per-socket pool to the global pool after each read operation. This should reduce the total number of outgoing mongos connections to each shard.

      Warning: Enabling this option on mongos comes with the caveat that clients can only call getLastError immediately after an actual write operation. This is fine for the vast majority of use cases. However, if an application does:

      • write op (no GLE)
      • read op
      • GLE w=2 — this will not provide any semantic guarantees (and may in fact return an unrelated error)

      If your application only ever calls GLE immediately after an actual write op (which is the same as using safe mode), this option will provide a good bit of multiplexing.

      The behavior is off by default. To turn the behavior on (and off) a running mongos, use the standard setParameter framework -

      mongo <mongos>
      > use admin
      > db.runCommand({ setParameter : 1, releaseConnectionsAfterResponse : true })
      { was : false, ok : true }
      

      To turn the behavior on at startup in a 2.4 mongos (this is not available before 2.4), you can also use:

      shell> mongos --setParameter "releaseConnectionsAfterResponse=true" --configdb ...
      

            Assignee:
            greg_10gen Greg Studer
            Reporter:
            dan@mongodb.com Daniel Pasette (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: