Optimize byte array writes in OutputStreamIndexOutput to remove unnecessary overhead#16119
Open
neoremind wants to merge 2 commits into
Open
Optimize byte array writes in OutputStreamIndexOutput to remove unnecessary overhead#16119neoremind wants to merge 2 commits into
neoremind wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Inspired by #13543 for
write(int), I was profiling the write path and noticed a similar optimization can be applied towriteBytes, this can eliminate unnecessarygrowIfNeededchecks and the large-byte-array bypass checks.Why this is safe:
XBufferedOutputStreamuses a fixed 8KB buffer, it never resizes,growIfNeededis pure overhead.super.write(b, off, len)retains the existing behavior for large byte arrays that should bypass buffering entirely and chunk them later for real I/O.Verification
Since Lucene indexing is CPU-intensive and the I/O path isn't the time-consuming part, there is no significant processing time difference in luceneutil nightly benchmarks. But I did profiling with JFR and verified the overhead is completely removed.
Note that I can only sample
growIfNeededsince it's a method call, the large-byte-array bypass check is inlined and hard to measure, so the real benefit should be slightly better than what the numbers below show.Wikipedia medium
33M docs, single-thread, with dv, wait for commit/merge, use CMS and TieredMergePolicy
See Appendix 2. for detailed call stack captured.
flamegraph link
log link
What to call out is that
writeBytesis not the dominanting write op inOutputStreamIndexOutput, only 5% of total calls. But the savings are still positive. In a 33M wikipedia indexing, it removes 245M unnecessarygrowIfNeededand large-byte-array bypass checks.I intercepted
OutputStreamIndexOutputto count every write call (see how-to in Appendix 1). The stats showwriteIntdominates by call count (61.4%), andwriteByteshandles nearly half the total bytes despite being only 5% of calls. And 93% ofwriteBytescalls are less than 128 bytes, they all hit the optimization.KNN indexing
1M 1024-dim float32 vectors, wait for commit/merge, use CMS, force merge at last
See Appendix 2. for detailed call stack captured.
flamegraph link
log link
For knn,
writeBytesdominates at 78.4% of all write calls, indexing 1M vectors involves tens of millions ofwriteBytesops, and all of them benefit from the fast path. But since knn is super CPU-intensive with vectorized dot product dominating the profiling, the small improvement diminishes as it's barely visible in the samples, but still a micro-level win.Write path deep dive
FSDirectory.FSIndexOutputwrites data through a layered stack:For the common case that small writes that fit in the buffer, do
System.arraycopy, no unnecessary checks. For large arrays that the buffer can't hold, fall toBufferedOutputStream.write()which flushes the buffer and writes directly to the underlying stream, theFilterOutputStreaminFSDirectorythen chunks those large writes to less than 8K before hitting the file channel, preventing unwanted larger native buffer allocation. This is true, so I've also updated the staleCHUNK_SIZEcomment as the original comment is a bit misleading.Appendix 1. Statistical analysis method of lucene write path
Write statistics were captured using a modified luceneutil that intercepts all write calls and performs statistical analysis after indexing completes: luceneutil commit.
Appendix 2. Detailed call stacks hitting growIfNeeded captured by JFR
Baseline top stacks of wikipedia 33MM
--- Count: 3 ---
java.io.BufferedOutputStream.growIfNeeded() line: 138
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.ByteBuffersDataOutput.copyTo() line: 338
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.flushDocBlock() line: 491
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.finishTerm() line: 576
org.apache.lucene.codecs.PushPostingsWriterBase.writeTerm() line: 172
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.write() line: 988
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter.write() line: 390
org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsWriter.write() line: 161
org.apache.lucene.index.FreqProxTermsWriter.flush() line: 133
org.apache.lucene.index.IndexingChain.flush() line: 361
org.apache.lucene.index.DocumentsWriterPerThread.flush() line: 492
org.apache.lucene.index.DocumentsWriter.doFlush() line: 541
org.apache.lucene.index.DocumentsWriter.postUpdate() line: 404
org.apache.lucene.index.DocumentsWriter.updateDocuments() line: 450
org.apache.lucene.index.IndexWriter.updateDocuments() line: 1600
org.apache.lucene.index.IndexWriter.updateDocument() line: 1882
org.apache.lucene.index.IndexWriter.addDocument() line: 1491
perf.IndexThreads$IndexThread.run() line: 419
--- Count: 2 ---
java.io.BufferedOutputStream.growIfNeeded() line: 135
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.RateLimitedIndexOutput.writeBytes() line: 60
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValuesRange() line: 1496
org.apache.lucene.util.bkd.BKDWriter.writeHighCardinalityLeafBlockPackedValues() line: 1422
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValues() line: 1358
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.writeLeafBlock() line: 859
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.add() line: 754
org.apache.lucene.util.bkd.BKDWriter.merge() line: 666
org.apache.lucene.codecs.lucene90.Lucene90PointsWriter.merge() line: 279
org.apache.lucene.index.SegmentMerger.mergePoints() line: 197
org.apache.lucene.index.SegmentMerger$$Lambda.0x000000004f1ca8e0.merge() line: -1
org.apache.lucene.index.SegmentMerger.mergeWithLogging() line: 315
org.apache.lucene.index.SegmentMerger.merge() line: 155
org.apache.lucene.index.IndexWriter.mergeMiddle() line: 5322
org.apache.lucene.index.IndexWriter.merge() line: 4785
org.apache.lucene.index.IndexWriter$IndexWriterMergeSource.merge() line: 6590
org.apache.lucene.index.ConcurrentMergeScheduler.doMerge() line: 661
org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.run() line: 726
--- Count: 2 ---
java.io.BufferedOutputStream.growIfNeeded() line: 137
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.ByteBuffersDataOutput.copyTo() line: 338
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.flushDocBlock() line: 491
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.finishTerm() line: 576
org.apache.lucene.codecs.PushPostingsWriterBase.writeTerm() line: 172
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.write() line: 988
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter.write() line: 390
org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsWriter.write() line: 161
org.apache.lucene.index.FreqProxTermsWriter.flush() line: 133
org.apache.lucene.index.IndexingChain.flush() line: 361
org.apache.lucene.index.DocumentsWriterPerThread.flush() line: 492
org.apache.lucene.index.DocumentsWriter.doFlush() line: 541
org.apache.lucene.index.DocumentsWriter.postUpdate() line: 404
org.apache.lucene.index.DocumentsWriter.updateDocuments() line: 450
org.apache.lucene.index.IndexWriter.updateDocuments() line: 1600
org.apache.lucene.index.IndexWriter.updateDocument() line: 1882
org.apache.lucene.index.IndexWriter.addDocument() line: 1491
perf.IndexThreads$IndexThread.run() line: 419
--- Count: 2 ---
java.io.BufferedOutputStream.growIfNeeded() line: 135
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValuesRange() line: 1496
org.apache.lucene.util.bkd.BKDWriter.writeHighCardinalityLeafBlockPackedValues() line: 1422
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValues() line: 1358
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.writeLeafBlock() line: 859
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.add() line: 754
org.apache.lucene.util.bkd.BKDWriter$2.visit() line: 609
org.apache.lucene.index.PointValuesWriter$1.visitDocValues() line: 209
org.apache.lucene.util.bkd.BKDWriter.writeField1Dim() line: 604
org.apache.lucene.util.bkd.BKDWriter.writeField() line: 449
org.apache.lucene.codecs.lucene90.Lucene90PointsWriter.writeField() line: 156
org.apache.lucene.index.PointValuesWriter.flush() line: 317
org.apache.lucene.index.IndexingChain.writePoints() line: 408
org.apache.lucene.index.IndexingChain.flush() line: 318
org.apache.lucene.index.DocumentsWriterPerThread.flush() line: 492
org.apache.lucene.index.DocumentsWriter.doFlush() line: 541
org.apache.lucene.index.DocumentsWriter.postUpdate() line: 404
org.apache.lucene.index.DocumentsWriter.updateDocuments() line: 450
org.apache.lucene.index.IndexWriter.updateDocuments() line: 1600
org.apache.lucene.index.IndexWriter.updateDocument() line: 1882
org.apache.lucene.index.IndexWriter.addDocument() line: 1491
perf.IndexThreads$IndexThread.run() line: 419
--- Count: 2 ---
java.io.BufferedOutputStream.growIfNeeded() line: 138
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValuesRange() line: 1496
org.apache.lucene.util.bkd.BKDWriter.writeHighCardinalityLeafBlockPackedValues() line: 1422
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValues() line: 1358
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.writeLeafBlock() line: 859
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.add() line: 754
org.apache.lucene.util.bkd.BKDWriter$2.visit() line: 609
org.apache.lucene.index.PointValuesWriter$1.visitDocValues() line: 209
org.apache.lucene.util.bkd.BKDWriter.writeField1Dim() line: 604
org.apache.lucene.util.bkd.BKDWriter.writeField() line: 449
org.apache.lucene.codecs.lucene90.Lucene90PointsWriter.writeField() line: 156
org.apache.lucene.index.PointValuesWriter.flush() line: 317
org.apache.lucene.index.IndexingChain.writePoints() line: 408
org.apache.lucene.index.IndexingChain.flush() line: 318
org.apache.lucene.index.DocumentsWriterPerThread.flush() line: 492
org.apache.lucene.index.DocumentsWriter.doFlush() line: 541
org.apache.lucene.index.DocumentsWriter.postUpdate() line: 404
org.apache.lucene.index.DocumentsWriter.updateDocuments() line: 450
org.apache.lucene.index.IndexWriter.updateDocuments() line: 1600
org.apache.lucene.index.IndexWriter.updateDocument() line: 1882
org.apache.lucene.index.IndexWriter.addDocument() line: 1491
perf.IndexThreads$IndexThread.run() line: 419
--- Count: 2 ---
java.io.BufferedOutputStream.growIfNeeded() line: 138
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.RateLimitedIndexOutput.writeBytes() line: 60
org.apache.lucene.store.DataOutput.writeBytes() line: 54
org.apache.lucene.codecs.lucene104.PForUtil.encode() line: 104
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.addPosition() line: 342
org.apache.lucene.codecs.PushPostingsWriterBase.writeTerm() line: 159
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.write() line: 988
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter.write() line: 390
org.apache.lucene.codecs.FieldsConsumer.merge() line: 94
org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsWriter.merge() line: 190
org.apache.lucene.index.SegmentMerger.mergeTerms() line: 223
org.apache.lucene.index.SegmentMerger$$Lambda.0x000000004f1c48b8.merge() line: -1
org.apache.lucene.index.SegmentMerger.mergeWithLogging() line: 315
org.apache.lucene.index.SegmentMerger.merge() line: 147
org.apache.lucene.index.IndexWriter.mergeMiddle() line: 5322
org.apache.lucene.index.IndexWriter.merge() line: 4785
org.apache.lucene.index.IndexWriter$IndexWriterMergeSource.merge() line: 6590
org.apache.lucene.index.ConcurrentMergeScheduler.doMerge() line: 661
org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.run() line: 726
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 138
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.DataOutput.writeBytes() line: 54
org.apache.lucene.codecs.lucene104.PForUtil.encode() line: 104
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.addPosition() line: 342
org.apache.lucene.codecs.PushPostingsWriterBase.writeTerm() line: 159
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.write() line: 988
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter.write() line: 390
org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsWriter.write() line: 161
org.apache.lucene.index.FreqProxTermsWriter.flush() line: 133
org.apache.lucene.index.IndexingChain.flush() line: 361
org.apache.lucene.index.DocumentsWriterPerThread.flush() line: 492
org.apache.lucene.index.DocumentsWriter.doFlush() line: 541
org.apache.lucene.index.DocumentsWriter.postUpdate() line: 404
org.apache.lucene.index.DocumentsWriter.updateDocuments() line: 450
org.apache.lucene.index.IndexWriter.updateDocuments() line: 1600
org.apache.lucene.index.IndexWriter.updateDocument() line: 1882
org.apache.lucene.index.IndexWriter.addDocument() line: 1491
perf.IndexThreads$IndexThread.run() line: 419
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 142
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.ByteBuffersDataOutput.copyTo() line: 338
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.flushDocBlock() line: 491
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.finishTerm() line: 576
org.apache.lucene.codecs.PushPostingsWriterBase.writeTerm() line: 172
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.write() line: 988
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter.write() line: 390
org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsWriter.write() line: 161
org.apache.lucene.index.FreqProxTermsWriter.flush() line: 133
org.apache.lucene.index.IndexingChain.flush() line: 361
org.apache.lucene.index.DocumentsWriterPerThread.flush() line: 492
org.apache.lucene.index.DocumentsWriter.doFlush() line: 541
org.apache.lucene.index.DocumentsWriter.postUpdate() line: 404
org.apache.lucene.index.DocumentsWriter.updateDocuments() line: 450
org.apache.lucene.index.IndexWriter.updateDocuments() line: 1600
org.apache.lucene.index.IndexWriter.updateDocument() line: 1882
org.apache.lucene.index.IndexWriter.addDocument() line: 1491
perf.IndexThreads$IndexThread.run() line: 419
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 138
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.DataOutput.writeBytes() line: 54
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.writeBlock() line: 944
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.writeBlocks() line: 636
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.pushTerm() line: 1039
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.write() line: 995
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter.write() line: 390
org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsWriter.write() line: 161
org.apache.lucene.index.FreqProxTermsWriter.flush() line: 133
org.apache.lucene.index.IndexingChain.flush() line: 361
org.apache.lucene.index.DocumentsWriterPerThread.flush() line: 492
org.apache.lucene.index.DocumentsWriter.doFlush() line: 541
org.apache.lucene.index.DocumentsWriter.postUpdate() line: 404
org.apache.lucene.index.DocumentsWriter.updateDocuments() line: 450
org.apache.lucene.index.IndexWriter.updateDocuments() line: 1600
org.apache.lucene.index.IndexWriter.updateDocument() line: 1882
org.apache.lucene.index.IndexWriter.addDocument() line: 1491
perf.IndexThreads$IndexThread.run() line: 419
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 142
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.RateLimitedIndexOutput.writeBytes() line: 60
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValuesRange() line: 1496
org.apache.lucene.util.bkd.BKDWriter.writeHighCardinalityLeafBlockPackedValues() line: 1422
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValues() line: 1358
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.writeLeafBlock() line: 859
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.add() line: 754
org.apache.lucene.util.bkd.BKDWriter.merge() line: 666
org.apache.lucene.codecs.lucene90.Lucene90PointsWriter.merge() line: 279
org.apache.lucene.index.SegmentMerger.mergePoints() line: 197
org.apache.lucene.index.SegmentMerger$$Lambda.0x000000004f1ca8e0.merge() line: -1
org.apache.lucene.index.SegmentMerger.mergeWithLogging() line: 315
org.apache.lucene.index.SegmentMerger.merge() line: 155
org.apache.lucene.index.IndexWriter.mergeMiddle() line: 5322
org.apache.lucene.index.IndexWriter.merge() line: 4785
org.apache.lucene.index.IndexWriter$IndexWriterMergeSource.merge() line: 6590
org.apache.lucene.index.ConcurrentMergeScheduler.doMerge() line: 661
org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.run() line: 726
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 138
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.RateLimitedIndexOutput.writeBytes() line: 60
org.apache.lucene.store.ByteBuffersDataOutput.copyTo() line: 338
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.writeLevel1SkipData() line: 535
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.flushDocBlock() line: 487
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.startDoc() line: 259
org.apache.lucene.codecs.PushPostingsWriterBase.writeTerm() line: 144
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.write() line: 988
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter.write() line: 390
org.apache.lucene.codecs.FieldsConsumer.merge() line: 94
org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsWriter.merge() line: 190
org.apache.lucene.index.SegmentMerger.mergeTerms() line: 223
org.apache.lucene.index.SegmentMerger$$Lambda.0x000000004f1c48b8.merge() line: -1
org.apache.lucene.index.SegmentMerger.mergeWithLogging() line: 315
org.apache.lucene.index.SegmentMerger.merge() line: 147
org.apache.lucene.index.IndexWriter.mergeMiddle() line: 5322
org.apache.lucene.index.IndexWriter.merge() line: 4785
org.apache.lucene.index.IndexWriter$IndexWriterMergeSource.merge() line: 6590
org.apache.lucene.index.ConcurrentMergeScheduler.doMerge() line: 661
org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.run() line: 726
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 134
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValuesRange() line: 1496
org.apache.lucene.util.bkd.BKDWriter.writeHighCardinalityLeafBlockPackedValues() line: 1422
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValues() line: 1358
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.writeLeafBlock() line: 859
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.add() line: 754
org.apache.lucene.util.bkd.BKDWriter$2.visit() line: 609
org.apache.lucene.index.PointValuesWriter$1.visitDocValues() line: 209
org.apache.lucene.util.bkd.BKDWriter.writeField1Dim() line: 604
org.apache.lucene.util.bkd.BKDWriter.writeField() line: 449
org.apache.lucene.codecs.lucene90.Lucene90PointsWriter.writeField() line: 156
org.apache.lucene.index.PointValuesWriter.flush() line: 317
org.apache.lucene.index.IndexingChain.writePoints() line: 408
org.apache.lucene.index.IndexingChain.flush() line: 318
org.apache.lucene.index.DocumentsWriterPerThread.flush() line: 492
org.apache.lucene.index.DocumentsWriter.doFlush() line: 541
org.apache.lucene.index.DocumentsWriter.postUpdate() line: 404
org.apache.lucene.index.DocumentsWriter.updateDocuments() line: 450
org.apache.lucene.index.IndexWriter.updateDocuments() line: 1600
org.apache.lucene.index.IndexWriter.updateDocument() line: 1882
org.apache.lucene.index.IndexWriter.addDocument() line: 1491
perf.IndexThreads$IndexThread.run() line: 419
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 137
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.DataOutput.writeBytes() line: 54
org.apache.lucene.codecs.lucene104.PForUtil.encode() line: 104
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.addPosition() line: 342
org.apache.lucene.codecs.PushPostingsWriterBase.writeTerm() line: 159
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.write() line: 988
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter.write() line: 390
org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsWriter.write() line: 161
org.apache.lucene.index.FreqProxTermsWriter.flush() line: 133
org.apache.lucene.index.IndexingChain.flush() line: 361
org.apache.lucene.index.DocumentsWriterPerThread.flush() line: 492
org.apache.lucene.index.DocumentsWriter.doFlush() line: 541
org.apache.lucene.index.DocumentsWriter.postUpdate() line: 404
org.apache.lucene.index.DocumentsWriter.updateDocuments() line: 450
org.apache.lucene.index.IndexWriter.updateDocuments() line: 1600
org.apache.lucene.index.IndexWriter.updateDocument() line: 1882
org.apache.lucene.index.IndexWriter.addDocument() line: 1491
perf.IndexThreads$IndexThread.run() line: 419
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 134
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.DataOutput.writeBytes() line: 54
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.writeBlock() line: 926
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.writeBlocks() line: 666
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.pushTerm() line: 1039
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.write() line: 995
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter.write() line: 390
org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsWriter.write() line: 161
org.apache.lucene.index.FreqProxTermsWriter.flush() line: 133
org.apache.lucene.index.IndexingChain.flush() line: 361
org.apache.lucene.index.DocumentsWriterPerThread.flush() line: 492
org.apache.lucene.index.DocumentsWriter.doFlush() line: 541
org.apache.lucene.index.DocumentsWriter.postUpdate() line: 404
org.apache.lucene.index.DocumentsWriter.updateDocuments() line: 450
org.apache.lucene.index.IndexWriter.updateDocuments() line: 1600
org.apache.lucene.index.IndexWriter.updateDocument() line: 1882
org.apache.lucene.index.IndexWriter.addDocument() line: 1491
perf.IndexThreads$IndexThread.run() line: 419
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 134
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.RateLimitedIndexOutput.writeBytes() line: 60
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValuesRange() line: 1496
org.apache.lucene.util.bkd.BKDWriter.writeHighCardinalityLeafBlockPackedValues() line: 1422
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValues() line: 1358
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.writeLeafBlock() line: 859
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.add() line: 754
org.apache.lucene.util.bkd.BKDWriter.merge() line: 666
org.apache.lucene.codecs.lucene90.Lucene90PointsWriter.merge() line: 279
org.apache.lucene.index.SegmentMerger.mergePoints() line: 197
org.apache.lucene.index.SegmentMerger$$Lambda.0x000000004f1ca8e0.merge() line: -1
org.apache.lucene.index.SegmentMerger.mergeWithLogging() line: 315
org.apache.lucene.index.SegmentMerger.merge() line: 155
org.apache.lucene.index.IndexWriter.mergeMiddle() line: 5322
org.apache.lucene.index.IndexWriter.merge() line: 4785
org.apache.lucene.index.IndexWriter$IndexWriterMergeSource.merge() line: 6590
org.apache.lucene.index.ConcurrentMergeScheduler.doMerge() line: 661
org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.run() line: 726
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 142
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.ByteBuffersDataOutput.copyTo() line: 338
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.writeLevel1SkipData() line: 535
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.flushDocBlock() line: 487
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.startDoc() line: 259
org.apache.lucene.codecs.PushPostingsWriterBase.writeTerm() line: 144
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.write() line: 988
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter.write() line: 390
org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsWriter.write() line: 161
org.apache.lucene.index.FreqProxTermsWriter.flush() line: 133
org.apache.lucene.index.IndexingChain.flush() line: 361
org.apache.lucene.index.DocumentsWriterPerThread.flush() line: 492
org.apache.lucene.index.DocumentsWriter.doFlush() line: 541
org.apache.lucene.index.DocumentsWriter.postUpdate() line: 404
org.apache.lucene.index.DocumentsWriter.updateDocuments() line: 450
org.apache.lucene.index.IndexWriter.updateDocuments() line: 1600
org.apache.lucene.index.IndexWriter.updateDocument() line: 1882
org.apache.lucene.index.IndexWriter.addDocument() line: 1491
perf.IndexThreads$IndexThread.run() line: 419
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 134
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.ByteBuffersDataOutput.copyTo() line: 338
org.apache.lucene.codecs.lucene90.LZ4WithPresetDictCompressionMode$LZ4WithPresetDictCompressor.compress() line: 194
org.apache.lucene.codecs.lucene90.compressing.Lucene90CompressingStoredFieldsWriter.flush() line: 259
org.apache.lucene.codecs.lucene90.compressing.Lucene90CompressingStoredFieldsWriter.finishDocument() line: 191
org.apache.lucene.index.StoredFieldsConsumer.finishDocument() line: 94
org.apache.lucene.index.IndexingChain.finishStoredFields() line: 565
org.apache.lucene.index.IndexingChain.processDocument() line: 657
org.apache.lucene.index.DocumentsWriterPerThread.updateDocuments() line: 291
org.apache.lucene.index.DocumentsWriter.updateDocuments() line: 428
org.apache.lucene.index.IndexWriter.updateDocuments() line: 1600
org.apache.lucene.index.IndexWriter.updateDocument() line: 1882
org.apache.lucene.index.IndexWriter.addDocument() line: 1491
perf.IndexThreads$IndexThread.run() line: 419
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 137
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValuesRange() line: 1496
org.apache.lucene.util.bkd.BKDWriter.writeHighCardinalityLeafBlockPackedValues() line: 1422
org.apache.lucene.util.bkd.BKDWriter.writeLeafBlockPackedValues() line: 1358
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.writeLeafBlock() line: 859
org.apache.lucene.util.bkd.BKDWriter$OneDimensionBKDWriter.add() line: 754
org.apache.lucene.util.bkd.BKDWriter$2.visit() line: 609
org.apache.lucene.index.PointValuesWriter$1.visitDocValues() line: 209
org.apache.lucene.util.bkd.BKDWriter.writeField1Dim() line: 604
org.apache.lucene.util.bkd.BKDWriter.writeField() line: 449
org.apache.lucene.codecs.lucene90.Lucene90PointsWriter.writeField() line: 156
org.apache.lucene.index.PointValuesWriter.flush() line: 317
org.apache.lucene.index.IndexingChain.writePoints() line: 408
org.apache.lucene.index.IndexingChain.flush() line: 318
org.apache.lucene.index.DocumentsWriterPerThread.flush() line: 492
org.apache.lucene.index.DocumentsWriter.doFlush() line: 541
org.apache.lucene.index.DocumentsWriter.postUpdate() line: 404
org.apache.lucene.index.DocumentsWriter.updateDocuments() line: 450
org.apache.lucene.index.IndexWriter.updateDocuments() line: 1600
org.apache.lucene.index.IndexWriter.updateDocument() line: 1882
org.apache.lucene.index.IndexWriter.addDocument() line: 1491
perf.IndexThreads$IndexThread.run() line: 419
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 135
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.RateLimitedIndexOutput.writeBytes() line: 60
org.apache.lucene.store.DataOutput.writeBytes() line: 54
org.apache.lucene.codecs.lucene104.PForUtil.encode() line: 104
org.apache.lucene.codecs.lucene104.Lucene104PostingsWriter.addPosition() line: 342
org.apache.lucene.codecs.PushPostingsWriterBase.writeTerm() line: 159
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter$TermsWriter.write() line: 988
org.apache.lucene.codecs.lucene103.blocktree.Lucene103BlockTreeTermsWriter.write() line: 390
org.apache.lucene.codecs.FieldsConsumer.merge() line: 94
org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsWriter.merge() line: 190
org.apache.lucene.index.SegmentMerger.mergeTerms() line: 223
org.apache.lucene.index.SegmentMerger$$Lambda.0x000000004f1c48b8.merge() line: -1
org.apache.lucene.index.SegmentMerger.mergeWithLogging() line: 315
org.apache.lucene.index.SegmentMerger.merge() line: 147
org.apache.lucene.index.IndexWriter.mergeMiddle() line: 5322
org.apache.lucene.index.IndexWriter.merge() line: 4785
org.apache.lucene.index.IndexWriter$IndexWriterMergeSource.merge() line: 6590
org.apache.lucene.index.ConcurrentMergeScheduler.doMerge() line: 661
org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.run() line: 726
Total CPU samples: 409250
Matched: 26
Percentage: 0.01%
Baseline top stacks of knn 1MM
--- Count: 3 ---
java.io.BufferedOutputStream.growIfNeeded() line: 134
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.RateLimitedIndexOutput.writeBytes() line: 60
org.apache.lucene.store.DataOutput.writeBytes() line: 54
org.apache.lucene.util.GroupVIntUtil.writeGroupVInts() line: 173
org.apache.lucene.store.DataOutput.writeGroupVInts() line: 358
org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsWriter.writeGraph() line: 550
org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsWriter.buildAndWriteGraph() line: 484
org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsWriter.lambda$mergeOneField$0() line: 451
org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsWriter$$Lambda.0x000000003019a9e0.run() line: -1
org.apache.lucene.codecs.KnnVectorsWriter.merge() line: 144
org.apache.lucene.index.SegmentMerger.mergeVectorValues() line: 272
org.apache.lucene.index.SegmentMerger$$Lambda.0x0000000030198000.merge() line: -1
org.apache.lucene.index.SegmentMerger.mergeWithLogging() line: 315
org.apache.lucene.index.SegmentMerger.merge() line: 159
org.apache.lucene.index.IndexWriter.mergeMiddle() line: 5322
org.apache.lucene.index.IndexWriter.merge() line: 4785
org.apache.lucene.index.IndexWriter$IndexWriterMergeSource.merge() line: 6590
org.apache.lucene.index.ConcurrentMergeScheduler.doMerge() line: 661
knn.KnnIndexer$TrackingConcurrentMergeScheduler.doMerge() line: 360
org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.run() line: 726
--- Count: 1 ---
java.io.BufferedOutputStream.growIfNeeded() line: 137
java.io.BufferedOutputStream.write() line: 186
org.apache.lucene.store.OutputStreamIndexOutput.writeBytes() line: 59
org.apache.lucene.store.RateLimitedIndexOutput.writeBytes() line: 60
org.apache.lucene.store.DataOutput.writeBytes() line: 54
org.apache.lucene.util.GroupVIntUtil.writeGroupVInts() line: 173
org.apache.lucene.store.DataOutput.writeGroupVInts() line: 358
org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsWriter.writeGraph() line: 550
org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsWriter.buildAndWriteGraph() line: 484
org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsWriter.lambda$mergeOneField$0() line: 451
org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsWriter$$Lambda.0x000000003019a9e0.run() line: -1
org.apache.lucene.codecs.KnnVectorsWriter.merge() line: 144
org.apache.lucene.index.SegmentMerger.mergeVectorValues() line: 272
org.apache.lucene.index.SegmentMerger$$Lambda.0x0000000030198000.merge() line: -1
org.apache.lucene.index.SegmentMerger.mergeWithLogging() line: 315
org.apache.lucene.index.SegmentMerger.merge() line: 159
org.apache.lucene.index.IndexWriter.mergeMiddle() line: 5322
org.apache.lucene.index.IndexWriter.merge() line: 4785
org.apache.lucene.index.IndexWriter$IndexWriterMergeSource.merge() line: 6590
org.apache.lucene.index.ConcurrentMergeScheduler.doMerge() line: 661
knn.KnnIndexer$TrackingConcurrentMergeScheduler.doMerge() line: 360
org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.run() line: 726
Total CPU samples: 1943015
Matched: 4
Percentage: 0.00%