Skip to content

Commit

Permalink
[feat]curvefs/client: support change diskcacheConf on fly
Browse files Browse the repository at this point in the history
Signed-off-by: Cyber-SiKu <[email protected]>
  • Loading branch information
Cyber-SiKu committed Sep 5, 2023
1 parent a6a32b8 commit 30ce10b
Show file tree
Hide file tree
Showing 7 changed files with 300 additions and 160 deletions.
13 changes: 11 additions & 2 deletions curvefs/conf/client.conf
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,19 @@ diskCache.forceFlush=true
diskCache.trimCheckIntervalSec=5
# the interval of check to trim load file to s3
diskCache.asyncLoadPeriodMs=5
# start trim file when disk cache use ratio is Greater than fullRatio,
# util less than safeRatio
# ok nearfull full
# |------------|-------------------|----------------------|
# 0 trimRatio*safeRatio safeRatio fullRatio
#
# 1. 0<=ok<trimRatio*safeRatio;
# 2. trimRatio*safeRatio<=nearfull<safeRatio
# 3. safeRatio<=full<=fullRatio
# If the status is ok or ok->nearfull does not clean up
# If the status is full or
# full->nearfull clean up
diskCache.fullRatio=90
diskCache.safeRatio=70
diskCache.trimRatio=50
diskCache.threads=5
# the max size disk cache can use
diskCache.maxUsableSpaceBytes=107374182400
Expand Down
2 changes: 2 additions & 0 deletions curvefs/src/client/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ void InitDiskCacheOption(Configuration *conf,
&diskCacheOption->fullRatio);
conf->GetValueFatalIfFail("diskCache.safeRatio",
&diskCacheOption->safeRatio);
conf->GetValueFatalIfFail("diskCache.trimRatio",
&diskCacheOption->trimRatio);
conf->GetValueFatalIfFail("diskCache.maxUsableSpaceBytes",
&diskCacheOption->maxUsableSpaceBytes);
conf->GetValueFatalIfFail("diskCache.maxFileNums",
Expand Down
8 changes: 5 additions & 3 deletions curvefs/src/client/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ struct DiskCacheOption {
// async load interval
uint64_t asyncLoadPeriodMs;
// trim start if disk usage over fullRatio
uint64_t fullRatio;
// trim finish until disk usage below safeRatio
uint64_t safeRatio;
uint32_t fullRatio = 90;
// disk usage safeRatio
uint32_t safeRatio = 70;
// trim finish until disk usage < safeRatio*trimRatio/100
uint32_t trimRatio = 50;
// the max size disk cache can use
uint64_t maxUsableSpaceBytes;
// the max file nums can cache
Expand Down
Loading

0 comments on commit 30ce10b

Please sign in to comment.