-
Notifications
You must be signed in to change notification settings - Fork 164
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
Multilevel cache #1064
Multilevel cache #1064
Conversation
8d9efd6
to
6a8e202
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of comments.
Signed-off-by: Vlad Volodkin <vlaad@amazon.com>
69d9063
to
a232279
Compare
MultilevelDataCache<DiskCache, ExpressCache, Runtime> | ||
{ | ||
pub fn new(disk_cache: Arc<DiskCache>, express_cache: ExpressCache, runtime: Runtime) -> Self { | ||
// Method `MultilevelDataCache::block_size` relies on block sizes of both caches to be equal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit convoluted. We use the same blocks at both levels, so they need to have the same size. I'd mention it as a requirement in this method rustdoc.
mountpoint-s3/src/cli.rs
Outdated
@@ -298,10 +309,10 @@ pub struct CliArgs { | |||
#[cfg(feature = "block_size")] | |||
#[clap( | |||
long, | |||
help = "Size of a cache block in KiB [Default: 1024 (1 MiB) for disk cache, 512 (512 KiB) for S3 Express cache]", | |||
help = "Size of a cache block in KiB [Default: 1024 (1 MiB) for disk cache and for S3 Express cache]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
help = "Size of a cache block in KiB [Default: 1024 (1 MiB) for disk cache and for S3 Express cache]", | |
help = "Size of a cache block in KiB [Default: 1024 (1 MiB)]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -89,6 +91,7 @@ where | |||
} | |||
buffer.extend_from_slice(&body); | |||
|
|||
// Ensure the flow-control window is large enough. | |||
result.as_mut().increment_read_window(self.block_size as usize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unnecessary now, doesn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to keep it for now and review when we optimize for the single chunk case (see TODO above).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to account for a case when the block object is larger than block_size
for some reason. If we've just removed this line the read
may freeze. If we've kept it as it is now MP may attempt to read an unbounded amount of data to RAM.
This requires a bit more thinking, so I agree that it's better to address in the following PR.
Description of change
Allow using both caches when
--cache-express <bucket> --cache <directory>
options are specified, local cache is queried first.Relevant issues: No
Does this change impact existing behavior?
No.
Does this change need a changelog entry in any of the crates?
Yes, will add in one of the future PRs.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).