Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefetching a configurable amount of data. #394

Merged
merged 3 commits into from
Oct 30, 2023
Merged

Prefetching a configurable amount of data. #394

merged 3 commits into from
Oct 30, 2023

Conversation

AnatolyPopov
Copy link
Contributor

No description provided.

Copy link
Contributor

@jeqo jeqo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @AnatolyPopov .

This looks promising. I just have some comments about config definition, and some suggestions to refactor the prefetching logic.

Overall, the approach looks sound to me: Pre-fetching once per fetch request.
For this to be effective, we should consider the prefetched size to be at least higher than the chunk size (else no chunk will be cached) and, better, to be equal or larger than the max fetch bytes per partition, so at least all the get requests to e.g. S3 will be done at once. If double, we can expect the next fetch request to be sourced directly from local cache.

Also, cache size will be affected by this. If 30MB is prefetched per partition, then a broker to prefetch from 10 partitions concurrently will require at least 300MB to cache all required chunks.

@jeqo jeqo mentioned this pull request Oct 2, 2023
@AnatolyPopov AnatolyPopov force-pushed the anatolii/prefetching branch 3 times, most recently from d7cce31 to 41f01af Compare October 20, 2023 15:08
@ivanyu ivanyu self-assigned this Oct 23, 2023
Comment on lines 456 to 458
if (chunkManager instanceof ChunkCache) {
((ChunkCache<?>) chunkManager).startPrefetching(segmentKey, segmentManifest, range.from);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this is happening here and not in ChunkCache#getChunk? Looks like a leaky abstraction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, fixed.

Copy link
Contributor

@ivanyu ivanyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, a couple of minor things

@AnatolyPopov AnatolyPopov marked this pull request as ready for review October 30, 2023 09:36
@AnatolyPopov AnatolyPopov requested a review from a team as a code owner October 30, 2023 09:36
@jeqo jeqo merged commit 15faf68 into main Oct 30, 2023
8 checks passed
@jeqo jeqo deleted the anatolii/prefetching branch October 30, 2023 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants