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

curvefs/client: add qos for curve-fuse, we can limits the bandwidth #2424

Merged
merged 1 commit into from
May 25, 2023
Merged

curvefs/client: add qos for curve-fuse, we can limits the bandwidth #2424

merged 1 commit into from
May 25, 2023

Conversation

UniverseParticle
Copy link
Contributor

@UniverseParticle UniverseParticle commented Apr 24, 2023

What problem does this PR solve?

Issue Number: #2225

Problem Summary: add qos for curve-fuse, then we can limits the bandwidth or IOPS

What is changed and how it works?

What's Changed:

  1. Read the configuration from the client.conf
  2. enable the throttle

Side effects(Breaking backward compatibility? Performance regression?):
It does not start by default

Check List

  • Relevant documentation/comments is changed or added
  • I acknowledge that all my contributions will be made under the project's license

@UniverseParticle UniverseParticle changed the title feat: add qos for curve-fuse, then we can limits the bandwidth feat: add qos for curve-fuse, we can limits the bandwidth Apr 24, 2023
@UniverseParticle
Copy link
Contributor Author

cicheck

@wuhongsong
Copy link
Contributor

cicheck

@wuhongsong
Copy link
Contributor

wuhongsong commented Apr 25, 2023

image

@UniverseParticle To avoid having PRs blocked in the future, always include Signed-off-by: Author Name <[email protected]> in every commit message. You can also do this automatically by using the -s flag (i.e., git commit -s).

@wuhongsong
Copy link
Contributor

wuhongsong commented Apr 26, 2023

good job(and maybe we can also limit the metadata manipulation, but we can do it in ohter pr after this done)

@@ -143,6 +142,15 @@ CURVEFS_ERROR FuseClient::Init(const FuseClientOption &option) {
warmupManager_->SetFsInfo(fsInfo_);
}

ReadWriteThrottleParams params;
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can dynamic throttle like diskcache throttle

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, It's better this way

@UniverseParticle
Copy link
Contributor Author

cicheck

1 similar comment
@UniverseParticle
Copy link
Contributor Author

cicheck

@ilixiaocui
Copy link
Contributor

image

It is better to merge four commits into one commit.

@ilixiaocui
Copy link
Contributor

image

Please use git commit -s -m "****"

@wuhongsong
Copy link
Contributor

good job. LGTM. no any more questions, except git commit -s as said above.

@wuhongsong wuhongsong changed the title feat: add qos for curve-fuse, we can limits the bandwidth curvefs/client: add qos for curve-fuse, we can limits the bandwidth May 4, 2023
@UniverseParticle
Copy link
Contributor Author

cicheck

2 similar comments
@UniverseParticle
Copy link
Contributor Author

cicheck

@UniverseParticle
Copy link
Contributor Author

cicheck

@wuhongsong
Copy link
Contributor

client branch coverage is not ok, actual branch coverage ratio: 42.2714, expected branch coverage ratio: 59. maybe the unitest is abort, you can run unittest in your test environment and look at the reasons for the failure

@wuhongsong
Copy link
Contributor

wuhongsong commented May 9, 2023 via email

# the read throttle bps of fuseClient, default no limit
fuseClient.throttle.avgReadBytes=0
# the read throttle iops of fuseClient, default no limit
fuseClient.throttle.avgReadIops=0
Copy link
Contributor

Choose a reason for hiding this comment

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

burst should contains four types:

  • read
    • bps
    • iops
  • write
    • bps : just this one here, we'd better add anothers.
    • iops

Copy link
Contributor

Choose a reason for hiding this comment

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

I means we can fix this by a new pr.

void S3Info2FsS3Option(const curvefs::common::S3Info& s3,
S3InfoOption* fsS3Opt) {
void S3Info2FsS3Option(const curvefs::common::S3Info &s3,
S3InfoOption *fsS3Opt) {
Copy link
Contributor

Choose a reason for hiding this comment

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

these changes look like only about code styles, the old and new styles in C++ are all good, we can leave them to old style, so the reviewer can pay more attentions to your added codes.

@UniverseParticle
Copy link
Contributor Author

cicheck

@UniverseParticle
Copy link
Contributor Author

微信图片_20230514103146

@wuhongsong
Copy link
Contributor

cicheck

@wuhongsong
Copy link
Contributor

微信图片_20230514103146

just wget failed, recheck

@UniverseParticle
Copy link
Contributor Author

cicheck

1 similar comment
@wuhongsong
Copy link
Contributor

cicheck


throttle_.UpdateThrottleParams(params);

int ret = bthread_timer_add(&throttleTimer_, butil::seconds_from_now(1),
Copy link
Contributor

Choose a reason for hiding this comment

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

not periodic tasks? maybe can reference timer in curve

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a timer task that refreshes variables once per second

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a timer task that refreshes variables once per second
yes
6d2cc34d-2b00-4cb5-a46a-f2804b95ccff

@UniverseParticle UniverseParticle requested a review from aspirer May 17, 2023 08:52
@@ -205,6 +205,34 @@ struct FuseClientOption {
bool disableXattr = false;
uint32_t downloadMaxRetryTimes;
uint32_t warmupThreadsNum = 10;

// the write throttle bps of fuseClient
uint64_t avgWriteBytes;
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@@ -308,6 +308,35 @@ void InitFuseClientOption(Configuration *conf, FuseClientOption *clientOption) {
clientOption->entryTimeOut = 0;
}


conf->GetValueFatalIfFail("fuseClient.throttle.avgWriteBytes",
&clientOption->avgWriteBytes);
Copy link
Contributor

Choose a reason for hiding this comment

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

Here you can consider initializing FLAGS_XX directly, without going through the option to switch to one layer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I referred to the qos usage of S3 disk cache。

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 is a situation where users only need to initialize from the configuration file and do not need to dynamically modify the qos

Copy link
Contributor

@ilixiaocui ilixiaocui May 17, 2023

Choose a reason for hiding this comment

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

If so, the following regular InitQosParam will be problematic.

Even if the user does not set the value of FLAG_XX, the value read from the configuration file will be overwritten.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is a situation where users only need to initialize from the configuration file and do not need to dynamically modify the qos

It can be considered that FLAG_XX is directly read in the code, and there are two sources of its assignment, one is the configuration file, and the other is the setting of the http interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fuse client initialization will read from the configuration file and assign values to FLAG_XX.
1684325977(1)

Copy link
Contributor

Choose a reason for hiding this comment

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

The fuse client initialization will read from the configuration file and assign values to FLAG_XX. 1684325977(1)

so,here you can consider initializing FLAGS_XX directly, without going through the option to switch to one layer? like:

    conf->GetValueFatalIfFail("fuseClient.throttle.avgReadBytes",
                              &FLAG_fuseClientAvgReadBytes);

It can be considered that FLAG_XX is directly read in the code, and there are two sources of its assignment, one is the configuration file, and the other is the setting of the http interface.

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 are two ways to initializing values . Is this the standard writing method in the future? (initializing FLAGS_XX directly)

@@ -1471,5 +1548,32 @@ FuseClient::SetMountStatus(const struct MountOption *mountOption) {
return CURVEFS_ERROR::OK;
}

void FuseClient::InitQosParam() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add new code, please add the corresponding unit test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@ilixiaocui
Copy link
Contributor

image Please merge into one commit to submit.

@UniverseParticle
Copy link
Contributor Author

cicheck

@UniverseParticle
Copy link
Contributor Author

cicheck

1 similar comment
@UniverseParticle
Copy link
Contributor Author

cicheck

@ilixiaocui
Copy link
Contributor

LGTM!

@ilixiaocui ilixiaocui merged commit 4bb0b52 into opencurve:master May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants