Faster sequential access for stored fields (#62509)#62573
Merged
jimczi merged 1 commit intoelastic:7.xfrom Sep 17, 2020
Merged
Conversation
Faster sequential access for stored fields Spinoff of elastic#61806 Today retrieving stored fields at search time is optimized for random access. So we make no effort to keep state in order to not decompress the same data multiple times because two documents might be in the same compressed block. This strategy is acceptable when retrieving a top N sorted by score since there is no guarantee that documents will be on the same block. However, we have some use cases where the document to retrieve might be completely sequential: Scrolls or normal search sorted by document id. Queries on Runtime fields that extract from _source. This commit exposes a sequential stored fields reader in the custom leaf reader that we use at search time. That allows to leverage the merge instances of stored fields readers that are optimized for sequential access. This change focuses on the fetch phase for now and leverages the merge instances for stored fields only if all documents to retrieve are adjacent. Applying the same logic in the source lookup of runtime fields should be trivial but will be done in a follow up. The speedup on queries sorted by doc id is significant. I played with the scroll task of the http_logs rally track on my laptop and had the following result: | Metric | Task | Baseline | Contender | Diff | Unit | |--------------------------------------------------------------:|-------:|------------:|------------:|---------:|--------:| | Total Young Gen GC | | 0.199 | 0.231 | 0.032 | s | | Total Old Gen GC | | 0 | 0 | 0 | s | | Store size | | 17.9704 | 17.9704 | 0 | GB | | Translog size | | 2.04891e-06 | 2.04891e-06 | 0 | GB | | Heap used for segments | | 0.820332 | 0.820332 | 0 | MB | | Heap used for doc values | | 0.113979 | 0.113979 | 0 | MB | | Heap used for terms | | 0.37973 | 0.37973 | 0 | MB | | Heap used for norms | | 0.03302 | 0.03302 | 0 | MB | | Heap used for points | | 0 | 0 | 0 | MB | | Heap used for stored fields | | 0.293602 | 0.293602 | 0 | MB | | Segment count | | 541 | 541 | 0 | | | Min Throughput | scroll | 12.7872 | 12.8747 | 0.08758 | pages/s | | Median Throughput | scroll | 12.9679 | 13.0556 | 0.08776 | pages/s | | Max Throughput | scroll | 13.4001 | 13.5705 | 0.17046 | pages/s | | 50th percentile latency | scroll | 524.966 | 251.396 | -273.57 | ms | | 90th percentile latency | scroll | 577.593 | 271.066 | -306.527 | ms | | 100th percentile latency | scroll | 664.73 | 272.734 | -391.997 | ms | | 50th percentile service time | scroll | 522.387 | 248.776 | -273.612 | ms | | 90th percentile service time | scroll | 573.118 | 267.79 | -305.328 | ms | | 100th percentile service time | scroll | 660.642 | 268.963 | -391.678 | ms | | error rate | scroll | 0 | 0 | 0 | % | Closes elastic#62024
Contributor
Author
|
@elasticmachine run elasticsearch-ci/packaging-sample-windows |
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.
Backport of #62509