feat: coalesce contiguous range reads for partial segment downloads#19652
Draft
capistrant wants to merge 1 commit into
Draft
feat: coalesce contiguous range reads for partial segment downloads#19652capistrant wants to merge 1 commit into
capistrant wants to merge 1 commit into
Conversation
Embedded test rename fix checkstyle
| * @param jsonMapper used by the metadata entry's mount path to parse the header | ||
| * @param storagePool thread pool the async cursor path submits on-demand column downloads to (which bounds | ||
| * load concurrency itself); may be null in tests that never invoke the cursor factory | ||
| * @param coalesceConfig range-coalescing thresholds applied to on-demand downloads once the entry is mounted |
Contributor
|
Question 1: Per-historical, do we track in-flight range requests so we avoid duplicate calls? E.g. query 1 calls for range A, not available locally so we initiate fetch from S3, meanwhile query 2 calls for range A. Does query 2 know about the in-flight request to avoid sending a duplicate? Question 2: how are we balancing coalescing ranged GET calls while maximizing parallelism at the S3 connection level? |
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.
Description
First cut at adding some coalescing to range reads for partial segment downloads. The overarching goal is to combine what would have been multiple reads of contiguous ranges (or near-contiguous ranges - see below) into a single read when it meets certain parameters. I say near-contiguous because this PR adds a knob to define a gap in bytes between required reads that can be opportunistically also read in order to create a ranged read over two required internal files. If unneeded files are downloaded for a coalesced range, they are still marked downloaded on the host and become queryable. This technically means there could be never-requested data becoming resident on the data server and cause evictions on a host that has disk pressure. Operators can control the knobs to reduce or increase these new configs to become more or less aggressive with coalescing reads. The hope is the defaults are a generally good for all, but may need tuning after real world learnings.
Configs
druid.segmentCache.virtualStorageCoalesceMaxGapBytes1048576(1 MiB)0merges only truly-adjacent files. Must be>= 0.druid.segmentCache.virtualStorageCoalesceMaxChunkBytes16777216(16 MiB)>= 1.Both are validated at startup; an invalid value fails service startup with a clear message.
New metric
storage/virtual/read/gapBytesstorage/virtual/read/bytes, the bytes read that were not part of a requested file (unrequested files spanned to coalesce, plus inter-file padding). Ratio toread/bytesis the over-fetch fraction.locationRelease note
Key changed/added classes in this PR
processing/src/main/java/org/apache/druid/segment/PartialQueryableIndex.javaprocessing/src/main/java/org/apache/druid/segment/PartialQueryableIndexCursorFactory.javaprocessing/src/main/java/org/apache/druid/segment/file/PartialSegmentFileMapperV10.javaThis PR has: