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

Excessive memory allocation due to unwrapping of updates in bulk ops

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.6.0, 3.7.0, 3.8.0, 3.9.0, 3.10.0
    • Fix Version/s: 3.11.0
    • Component/s: Write Operations
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible

      Description

      It looks like the changes inĀ 332ffc78538b36db880c94836d82276f5e5d9296 introduced a call to isEmpty() on the update document, to throw an illegal arg exception if the update document is empty.

      However, when used with BsonDocumentWrapper, the call to isEmpty() causes the wrapped document to be unwrapped, just to check for emptiness. This causes many unnecessary allocations when unwrapping update documents of any size.

      Removing this call saves about approx ~80% GC'd allocations for a comparable volume of writes, as illustrated in the attached screenshot comparing two JProfiler snapshots. On the left is the version w/o the check, on the right is the current code w/ the check.

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: