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

On INSERT iterate over documents ONCE not TWICE

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.0
    • Affects Version/s: 2.5.3
    • Component/s: Performance
    • Environment:
      N/A

      Currently DBApiLayer iterates through documents TWICE in case '_id's have to be created ( "shouldApply" is true ): once to set "_id"s and the second time to create batch chunks.
      This slows down the insert ( with any WriteConcern ).

      Attaching a patch that optimizes the INSERT: now documents are iterated only ONCE without changing a current behavior.

      /Anatoly

      P.S. I am currently testing with application level partitioning, so different partitions actually sent to the different mongoDs in real time ( even distribution ): https://github.com/anatoly-polinsky/mongodb-write-performance-playground and the patch does help to boost the performance.

            Assignee:
            Unassigned Unassigned
            Reporter:
            tolitius Anatoly Polinsky
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: