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

nydusd: add the config support of amplify_io #1452

Merged
merged 2 commits into from
Nov 9, 2023

Conversation

hangvane
Copy link
Contributor

@hangvane hangvane commented Oct 24, 2023

Relevant Issue (if applicable)

If there are Issues related to this PullRequest, please list it.

Details

Please describe the details of PullRequest.

The first commit is to rename the variables with similar usages into same names.

i.e.,

prefetch.batch_size/prefetch.merging_size -> batch_size (filed name)/prefetch_batch_size(function name) (newly changed)

threads/threads_count -> threads_count

batch_size/amplify_io ->user_io_batch_size

bandwidth_rate/bandwidth_limit -> bandwidth_limit

This change is only for the variables in nydusd runtime, and does not affect the filed names in the config file.

The second commit adds the support of amplify_io in the config file of nydusd to restrict read amplification.

Types of changes

What types of changes does your PullRequest introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@hangvane hangvane requested a review from a team as a code owner October 24, 2023 12:14
@hangvane hangvane requested review from bergwolf, liubin and changweige and removed request for a team October 24, 2023 12:14
storage/src/factory.rs Outdated Show resolved Hide resolved
@hangvane hangvane force-pushed the amplify_io branch 2 times, most recently from 3ea439d to 760fbcb Compare October 24, 2023 14:33
@hangvane hangvane requested a review from imeoer October 25, 2023 01:30
api/src/config.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

Merging #1452 (0063e89) into master (46dca17) will increase coverage by 0.01%.
The diff coverage is 75.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1452      +/-   ##
==========================================
+ Coverage   62.49%   62.50%   +0.01%     
==========================================
  Files         123      123              
  Lines       43131    43148      +17     
  Branches    43131    43148      +17     
==========================================
+ Hits        26955    26970      +15     
- Misses      14868    14870       +2     
  Partials     1308     1308              
Files Coverage Δ
api/src/config.rs 87.61% <100.00%> (ø)
storage/src/cache/filecache/mod.rs 67.50% <100.00%> (+0.23%) ⬆️
storage/src/cache/fscache/mod.rs 76.38% <100.00%> (+0.20%) ⬆️
storage/src/cache/worker.rs 62.53% <100.00%> (ø)
rafs/src/metadata/md_v5.rs 29.41% <0.00%> (ø)
service/src/fs_cache.rs 29.21% <0.00%> (ø)
storage/src/factory.rs 50.00% <83.33%> (+3.28%) ⬆️
storage/src/cache/cachedfile.rs 33.58% <33.33%> (ø)
rafs/src/fs.rs 34.68% <22.22%> (-0.06%) ⬇️

api/src/config.rs Outdated Show resolved Hide resolved
api/src/config.rs Show resolved Hide resolved
api/src/config.rs Outdated Show resolved Hide resolved
@imeoer
Copy link
Collaborator

imeoer commented Oct 31, 2023

@jiangliu PTAL.

@hangvane hangvane force-pushed the amplify_io branch 3 times, most recently from 02c2c25 to 922a192 Compare November 2, 2023 02:53
storage/src/factory.rs Outdated Show resolved Hide resolved
@hangvane hangvane force-pushed the amplify_io branch 2 times, most recently from 003ecc0 to 65a874b Compare November 3, 2023 05:22
@hangvane hangvane requested a review from imeoer November 3, 2023 05:49
docs/nydusd.md Outdated Show resolved Hide resolved
@hangvane hangvane force-pushed the amplify_io branch 2 times, most recently from 2dbd1e7 to 88edb18 Compare November 6, 2023 02:54
@hangvane hangvane requested a review from imeoer November 6, 2023 05:56
Copy link
Collaborator

@imeoer imeoer left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks!

@@ -681,10 +681,10 @@ impl CacheConfigV2 {
}

if self.prefetch.enable {
if self.prefetch.batch_size > 0x10000000 {
if self.prefetch.prefetch_request_batch_size > 0x10000000 {
Copy link
Collaborator

@jiangliu jiangliu Nov 9, 2023

Choose a reason for hiding this comment

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

It's an field in inside prefetch, so why adding prefetch_request prefix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's at least three types of batch_size in nydus. Is it explicit enough to leave it as batch_size?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted to prefetch.batch_size. Please reply again if there's some other problems.

@@ -117,6 +117,10 @@ impl BlobFactory {
) -> IOResult<Arc<dyn BlobCache>> {
let backend_cfg = config.get_backend_config()?;
let cache_cfg = config.get_cache_config()?;
let user_io_batch_size = config
.get_rafs_config()
.map_or_else(|_| default_user_io_batch_size(), |v| v.user_io_batch_size)
Copy link
Collaborator

@jiangliu jiangliu Nov 9, 2023

Choose a reason for hiding this comment

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

Should be?

.map_or_else(default_user_io_batch_size, |v| v.user_io_batch_size)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

function is expected to take 1 argument, but it takes 0 arguments
expected function that takes 1 argument

@@ -300,19 +301,19 @@ impl FileCacheEntry {
}
}

fn prefetch_batch_size(&self) -> u64 {
if self.prefetch_config.merging_size < 0x2_0000 {
fn prefetch_request_batch_size(&self) -> u64 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about prefetch_batch_size()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

Variable names about prefetch are confused currently.
So we merge variable names that have the same meaning,
while DO NOT affect the field names read from the configuration file.

Signed-off-by: Wenhao Ren <wenhaoren@mail.dlut.edu.cn>
Add the support of `amplify_io` in the config file of nydusd
to configure read amplification.

Signed-off-by: Wenhao Ren <wenhaoren@mail.dlut.edu.cn>
@jiangliu jiangliu merged commit c9fbce8 into dragonflyoss:master Nov 9, 2023
26 checks passed
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.

None yet

4 participants