Use fine-grained locks in the connection pool to reduce contention

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Infrastructure
    • None
    • Python Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      By using fine-grained locks in the connection pool, we can reduce the rate of lock contention and improve overall throughput.
      From testing related to PYTHON-5007, using fine-grained locks improved thread efficiency by about 20% in a small read scenario. It showed improvement with free-threading enabled.

      There is a proof of concept in https://github.com/blink1073/mongo-python-driver/pull/10 .

      Definition of done

      Implement fine-grained locks in the connection pool and ensure that there are no regressions in behavior. Verify improvements to small reads in async and sync with and without the GIL enabled.

      Pitfalls

      Ensure that we do not regress in resource protection.

            Assignee:
            Unassigned
            Reporter:
            Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: