Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-9827

Small segments are slower to merge due to stored fields since 8.7

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 9.0, 8.9
    • None
    • None
    • New

    Description

      dm and dimitrisli looked into an interesting case where indexing slowed down after upgrading to 8.7. After digging we identified that this was due to the merging of stored fields, which had become slower on average.

      This is due to changes to stored fields, which now have top-level blocks that are then split into sub-blocks and compressed using shared dictionaries (one dictionary per top-level block). As the top-level blocks are larger than they were before, segments are more likely to be considered "dirty" by the merging logic. Dirty segments are segments were 1% of the data or more consists of incomplete blocks. For large segments, the size of blocks doesn't really affect the dirtiness of segments: if you flush a segment that has 100 blocks or more, it will never be considered dirty as only the last block may be incomplete. But for small segments it does: for instance if your segment is only 10 blocks, it is very likely considered dirty given that the last block is always incomplete. And the fact that we increased the top-level block size means that segments that used to be considered clean might now be considered dirty.

      And indeed benchmarks reported that while large stored fields merges became slightly faster after upgrading to 8.7, the smaller merges actually became slower. See attached chart, which gives the total merge time as a function of the number of documents in the segment.

      I don't know how we can address this, this is a natural consequence of the larger block size, which is needed to achieve better compression ratios. But I wanted to open an issue about it in case someone has a bright idea how we could make things better.

      Attachments

        1. total-merge-time-by-num-docs-on-small-segments.png
          66 kB
          Adrien Grand
        2. merge-count-by-num-docs.png
          56 kB
          Daniel Mitterdorfer
        3. merge-type-by-version.png
          35 kB
          Daniel Mitterdorfer
        4. total-merge-time-by-num-docs.png
          92 kB
          Daniel Mitterdorfer
        5. log-and-lucene-9827.patch
          4 kB
          Daniel Mitterdorfer
        6. Indexer.java
          2 kB
          Robert Muir

        Activity

          People

            Unassigned Unassigned
            jpountz Adrien Grand
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h 10m
                2h 10m