Memory release when establishing cursors in mongos can be optimized

XMLWordPrintableJSON

    • Query Execution
    • Fully Compatible
    • QE 2025-11-24
    • 0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When a CursorEstablisher (CE) successfully receives responses, it stores (potentially large) BSON data in the _remoteCursors structure. Upon a timeout, the CE schedules asynchronous cleanUp requests. After scheduling cleanUp requests, the CE asserts and goes out of scope, which releases the memory held by _remoteCursors. Any responses received after the timeout are pushed to _responseQueue. The memory for _responseQueue is released when the AsyncResultsSender (ARS) goes out of scope. ARS goes out of scope when a response has been returned to the client. Any delay in the destruction of CE or ARS would cause valid responses to contribute to the memory consumption. Rather than waiting for the instances of CE and ARS to go out of scope we should release the memory explicitly when we know that it is not needed anymore.

            Assignee:
            Jan Steemann
            Reporter:
            Foteini Alvanaki
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: