diff --git a/.bazelrc b/.bazelrc index bd9e2fd766..7c1adc7ea9 100644 --- a/.bazelrc +++ b/.bazelrc @@ -7,4 +7,20 @@ build:gcc7-later --cxxopt -faligned-new build --incompatible_blacklisted_protos_requires_proto_info=false build --copt=-fdiagnostics-color=always +build:sanitize-common --strip=never +build:sanitize-common --copt -O1 +build:sanitize-common --copt -g +build:sanitize-common --copt -fno-omit-frame-pointer + +build:asan --config=sanitize-common +build:asan --copt -fsanitize=address +build:asan --copt -DADDRESS_SANITIZER +build:asan --linkopt -fsanitize=address + +build:asan --config=sanitize-common +build:msan --copt -fsanitize=memory +build:msan --copt -fsanitize=undefined +build:msan --linkopt -fsanitize=address +build:msan --linkopt -fsanitize=undefined + run --copt=-fdiagnostics-color=always diff --git a/.clang-format b/.clang-format index fa13380a3d..da0d029bcd 100644 --- a/.clang-format +++ b/.clang-format @@ -4,6 +4,7 @@ BasedOnStyle: Google AccessModifierOffset: -3 DerivePointerAlignment: false IndentWidth: 4 +AlignAfterOpenBracket: DontAlign --- Language: Proto BasedOnStyle: Google diff --git a/.github/workflows/clang-format.yaml b/.github/workflows/clang-format.yml similarity index 93% rename from .github/workflows/clang-format.yaml rename to .github/workflows/clang-format.yml index d4d373c519..fa4c88720e 100644 --- a/.github/workflows/clang-format.yaml +++ b/.github/workflows/clang-format.yml @@ -9,12 +9,12 @@ jobs: name: Clang Formatter runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: # fetch everything to be able to compare with any ref fetch-depth: 0 - - name: Check + - name: Check env: LANG: "C.UTF-8" LC_ALL: "C.UTF-8" diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml new file mode 100644 index 0000000000..cc0c5e25b4 --- /dev/null +++ b/.github/workflows/cppcheck.yml @@ -0,0 +1,24 @@ +name: Static Checker + +on: pull_request + +jobs: + cppcheck: + name: CppCheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: chmorgan/cppcheck-action@v1.4 + with: + enable: all + std: c++11 + inconclusive: disable + output_file: ./cppcheck_report.txt + other_options: "-j4 --suppressions-list=util/cppcheck/cppcheck.suppressions --error-exitcode=1 -itest -icurvefs/test -inebd/test -inbd/test -icurvefs_python -icurvesnapshot_python -ithirdparties" + + - name: Show cppcheck report + if: failure() + run: | + cat ./cppcheck_report.txt + exit 1 diff --git a/.gitignore b/.gitignore index 1a66484ca7..92dc59bcf5 100755 --- a/.gitignore +++ b/.gitignore @@ -82,6 +82,9 @@ runlog/ !curve-snapshotcloneserver-nginx/app/lib !nebd/nebd-package/usr/bin +# build output +build + # mac .DS_Store @@ -166,3 +169,11 @@ test/integration/snapshotcloneserver/config/*.conf *.deb *.whl + +*.class +curvefs/sdk/java/target/ +curvefs/sdk/java/native/build +curvefs/sdk/libcurvefs/examples/bin +curvefs/sdk/output/ +hadoop-test/ +nnbench-test/ diff --git a/.obm.cfg b/.obm.cfg index 93bee71c49..ada426f8e5 100644 --- a/.obm.cfg +++ b/.obm.cfg @@ -1,2 +1,2 @@ -container_name: curve-build-playground-master -container_image: opencurvedocker/curve-base:build-debian9 +container_name: curve-build-playground.master +container_image: opencurvedocker/curve-base:build-debian11 diff --git a/Makefile b/Makefile index f986bb4777..749e838ba2 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Copyright (C) 2021 Jingli Chen (Wine93), NetEase Inc. -.PHONY: list build dep install image playground check test docker +.PHONY: list build dep ci-list ci-build ci-dep install image playground check test docker format stor?="" prefix?= "$(PWD)/projects" @@ -13,6 +13,14 @@ os?= "debian11" ci?=0 commit_id="HEAD^" define help_msg +## build curvebs + make build stor=bs dep=1 + make dep stor=bs && make build stor=bs + +## build curvefs + make build stor=fs dep=1 + make dep stor=fs && make build stor=fs + ## list Usage: make list stor=bs/fs @@ -21,20 +29,25 @@ Examples: ## build Usage: - make build stor=bs/fs only=TARGET dep=0/1 release=0/1 os=OS + make build stor=bs/fs only=TARGET1,...,TARGETx dep=0/1 release=0/1 os=OS Examples: make build stor=bs only=//src/chunkserver:chunkserver - make build stor=bs only=src/* dep=0 - make build stor=fs only=test/* os=debian9 - make build stor=fs release=1 + make build stor=bs only=src/*,test/* dep=0 + make build stor=fs only=test/* os=debian11 + make build stor=fs release=1 +Note: + Extra build options can be specified using BUILD_OPTS environment variable, which will be passed to bazel build command. ## dep +## configure dependency(before build) Usage: make dep stor=bs/fs Examples: make dep stor=bs +## ci-list/build/dep +## use the same way above, but in the container ## install Usage: @@ -49,7 +62,21 @@ Examples: Usage: make image stor=bs/fs tag=TAG os=OS Examples: - make image stor=bs tag=opencurvedocker/curvebs:v1.2 os=debian9 + make image stor=bs tag=opencurvedocker/curvebs:v1.2 os=debian11 + + +## package +Usage: + make release=0/1 dep=0/1 os=OS +Examples: + make deb + make tar release=1 dep=1 os=debian11 + + +## playground +## create/run a container, changes outside will be mapped into the container +Usage/Example: + make playground endef export help_msg @@ -65,8 +92,11 @@ build: dep: @bash util/build.sh --stor=$(stor) --only="" --dep=1 +ci-list: + @bash util/build_in_image.sh --stor=$(stor) --list + ci-build: - @bash util/build_in_image.sh --stor=$(stor) --only=$(only) --dep=$(dep) --release=$(release) --ci=$(ci) --os=$(os) + @bash util/build_in_image.sh --stor=$(stor) --only=$(only) --dep=$(dep) --release=$(release) --ci=$(ci) --os=$(os) --sanitizer=$(sanitizer) ci-dep: @bash util/build_in_image.sh --stor=$(stor) --only="" --dep=1 @@ -77,8 +107,11 @@ install: image: @bash util/image.sh $(stor) $(tag) $(os) +tar deb: + @RELEASE=$(release) DEP=$(dep) OS=$(os) bash util/package.sh $@ + playground: - @bash util/playground.sh + @bash util/playground.sh --version=$(version) check: @bash util/check.sh $(stor) @@ -88,5 +121,12 @@ test: docker: @bash util/docker.sh --os=$(os) --ci=$(ci) + format: @bash util/format.sh $(commit_id) + +init-hadoop: + @bash util/init-hadoop.sh + +sdk: + @bash util/sdk.sh diff --git a/WORKSPACE b/WORKSPACE index 70772b05f5..a423f1c46a 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -142,7 +142,7 @@ git_repository( patches = [ "//:thirdparties/brpc/brpc.patch", "//:thirdparties/brpc/fix-gcc11.patch", - "//:thirdparties/brpc/0001-bvar-warning-on-conflict-bvar-name.patch", + "//:thirdparties/brpc/0001-bvar-warning-on-conflict-bvar-name.patch", ], patch_args = ["-p1"], ) @@ -192,7 +192,6 @@ new_local_repository( path = "thirdparties/memcache/libmemcached-1.1.2", ) - http_archive( name = "aws", urls = ["https://github.com/aws/aws-sdk-cpp/archive/1.7.340.tar.gz"], @@ -259,6 +258,21 @@ http_archive( build_file = "//:thirdparties/spdlog.BUILD", ) +# incbin +new_git_repository( + name = "incbin", + remote = "https://github.com/graphitemaster/incbin.git", + commit = "6e576cae5ab5810f25e2631f2e0b80cbe7dc8cbf", + build_file = "//:thirdparties/incbin.BUILD", +) + +# config +new_local_repository( + name = "config", + build_file = "//:thirdparties/config.BUILD", + path = "thirdparties/config", +) + # Bazel platform rules. http_archive( name = "platforms", @@ -274,6 +288,13 @@ new_local_repository( path = "thirdparties/rocksdb", ) +# jni +new_local_repository( + name = "jni", + build_file = "//:thirdparties/jni.BUILD", + path = "thirdparties", +) + # Hedron's Compile Commands Extractor for Bazel # https://github.com/hedronvision/bazel-compile-commands-extractor http_archive( diff --git a/conf/chunkserver.conf b/conf/chunkserver.conf index 0cfc27b544..19457b3c18 100644 --- a/conf/chunkserver.conf +++ b/conf/chunkserver.conf @@ -194,7 +194,7 @@ rconcurrentapply.queuedepth=1 # 是否开启从chunkfilepool获取chunk,一般是true chunkfilepool.enable_get_chunk_from_pool=true # chunkfilepool目录 -chunkfilepool.chunk_file_pool_dir=./0/ # __CURVEADM_TEMPLATE__ ${prefix}/data __CURVEADM_TEMPLATE__ +chunkfilepool.chunk_file_pool_dir=./0/chunks # __CURVEADM_TEMPLATE__ ${prefix}/data __CURVEADM_TEMPLATE__ # chunkfilepool meta文件路径 chunkfilepool.meta_path=./chunkfilepool.meta # __CURVEADM_TEMPLATE__ ${prefix}/data/chunkfilepool.meta __CURVEADM_TEMPLATE__ # chunkfilepool meta文件大小 @@ -207,6 +207,14 @@ chunkfilepool.clean.enable=true chunkfilepool.clean.bytes_per_write=4096 # The throttle iops for cleaning chunk (4KB/IO) chunkfilepool.clean.throttle_iops=500 +# Whether allocate filePool by percent of disk size. +chunkfilepool.allocated_by_percent=true +# Preallocate storage percent of total disk +chunkfilepool.allocate_percent=80 +# Preallocate storage size of chunkfilepool (None/KB/MB/GB/TB) +chunkfilepool.chunk_file_pool_size=1GB +# The thread num for format chunks +chunkfilepool.thread_num=1 # # WAL file pool @@ -229,6 +237,14 @@ walfilepool.metapage_size=4096 walfilepool.meta_file_size=4096 # WAL filepool get chunk最大重试次数 walfilepool.retry_times=5 +# Whether allocate filePool by percent of disk size. +walfilepool.allocated_by_percent=true +# Preallocate storage percent of total disk +walfilepool.allocate_percent=90 +# Preallocate storage size size of walfilepool (None/KB/MB/GB/TB) +walfilepool.wal_file_pool_size=0 +# The thread num for format chunks +walfilepool.thread_num=1 # # trash settings diff --git a/conf/chunkserver.conf.example b/conf/chunkserver.conf.example index eb664c2fd6..443412215b 100644 --- a/conf/chunkserver.conf.example +++ b/conf/chunkserver.conf.example @@ -186,7 +186,7 @@ rconcurrentapply.queuedepth=1 # 是否开启从chunkfilepool获取chunk,一般是true chunkfilepool.enable_get_chunk_from_pool=true # chunkfilepool目录 -chunkfilepool.chunk_file_pool_dir=./0/ +chunkfilepool.chunk_file_pool_dir=./0/chunks # chunkfilepool meta文件路径 #chunkfilepool.meta_path=./chunkfilepool.meta # chunkfilepool meta文件大小 @@ -199,6 +199,14 @@ chunkfilepool.clean.enable=true chunkfilepool.clean.bytes_per_write=4096 # The throttle iops for cleaning chunk (4KB/IO) chunkfilepool.clean.throttle_iops=500 +# Whether allocate filePool by percent of disk size. +chunkfilepool.allocated_by_percent=true +# Preallocate storage percent of total disk +chunkfilepool.allocate_percent=80 +# Preallocate storage size of chunkfilepool (None/KB/MB/GB/TB) +chunkfilepool.chunk_file_pool_size=1GB +# The thread num for format chunks +chunkfilepool.thread_num=1 # # WAL file pool @@ -221,6 +229,14 @@ walfilepool.metapage_size=4096 walfilepool.meta_file_size=4096 # WAL filepool get chunk最大重试次数 walfilepool.retry_times=5 +# Whether allocate filePool by percent of disk size. +walfilepool.allocated_by_percent=true +# Preallocate storage percent of total disk +walfilepool.allocate_percent=10 +# Preallocate storage size size of walfilepool (None/KB/MB/GB/TB) +walfilepool.wal_file_pool_size=0 +# The thread num for format chunks +walfilepool.thread_num=1 # # trash settings diff --git a/curve-ansible/README.md b/curve-ansible/README.md index 4815a12153..1f52d2f43f 100644 --- a/curve-ansible/README.md +++ b/curve-ansible/README.md @@ -30,8 +30,8 @@ chunkserver_num=13 ### 3、包管理 curve-ansible同时提供了debian包和tar包的方式安装curve软件包。默认使用tar包方式安装,如果想用debian包的方式,需要在inventory或者命令行中指定install_with_deb=true。(debian的方式目前不支持格式化指定盘,只支持格式化全部ATA盘) -- debian包的方式下,需要使用mk-deb.sh打debian包,并将debian包上传到debian源中,使其能够用apt-get命令安装。 -- tar包的方式下,tar包可以是来自curve github release,也可以是自己执行mk-tar.sh脚本获取到的。 +- debian包的方式下,需要使用 make deb 打debian包,并将debian包上传到debian源中,使其能够用apt-get命令安装。 +- tar包的方式下,tar包可以是来自curve github release,也可以是自己执行 make tar 获取到的。 ## 三、使用命令 ### 1、集群部署 diff --git a/curvefs/conf/client.conf b/curvefs/conf/client.conf index c66477926c..755d624920 100644 --- a/curvefs/conf/client.conf +++ b/curvefs/conf/client.conf @@ -92,8 +92,6 @@ fuseClient.enableMultiMountPointRename=true fuseClient.enableSplice=false # thread number of listDentry when get summary xattr fuseClient.listDentryThreads=10 -# disable xattr on one mountpoint can fast 'ls -l' -fuseClient.disableXattr=false # default data(s3ChunkInfo/volumeExtent) size in inode, if exceed will eliminate and try to get the merged one fuseClient.maxDataSize=1024 # default refresh data interval 30s @@ -128,17 +126,26 @@ fuseClient.throttle.burstReadIops=0 # the times that read burst Iops can continue, default 180s fuseClient.throttle.burstReadIopsSecs=180 +#### vfs (virtual filesystem) +#{ +vfs.userPermission.uid=0 +vfs.userPermission.gids=0 +vfs.userPermission.umask=0022 +vfs.entryCache.lruSize=2000000 +vfs.attrCache.lruSize=2000000 +#} + #### filesystem metadata # { -# fs.disableXattr: +# fs.disableXAttr: # if you want to get better metadata performance, -# you can mount fs with |fs.disableXattr| is true +# you can mount fs with |fs.disableXAttr| is true # # fs.lookupCache.negativeTimeoutSec: # entry which not found will be cached if |timeout| > 0 fs.cto=true fs.maxNameLength=255 -fs.disableXattr=false +fs.disableXAttr=true fs.accessLogging=true fs.kernelCache.attrTimeoutSec=3600 fs.kernelCache.dirAttrTimeoutSec=3600 @@ -204,6 +211,18 @@ s3.writeCacheMaxByte=838860800 s3.readCacheMaxByte=209715200 # file cache read thread num s3.readCacheThreads=5 + +# The data in the cache cluster download to local +s3.memClusterToLocal=true +# The data in the s3 storage download to local +s3.s3ToLocal=true +# read size bigger than this value will read until prefetch is finished +s3.bigIoSize=131072 +# retry times when read big io failed +s3.bigIoRetryTimes=100 +# retry interval when read big io failed +s3.bigIoRetryIntervalUs=100 + # http = 0, https = 1 s3.http_scheme=0 s3.verify_SSL=False @@ -217,7 +236,7 @@ s3.logLevel=4 s3.logPrefix=/data/logs/curvefs/aws_ # __CURVEADM_TEMPLATE__ /curvefs/client/logs/aws_ __CURVEADM_TEMPLATE__ s3.asyncThreadNum=500 # limit all inflight async requests' bytes, |0| means not limited -s3.maxAsyncRequestInflightBytes=104857600 +s3.maxAsyncRequestInflightBytes=1073741824 s3.chunkFlushThreads=5 # throttle s3.throttle.iopsTotalLimit=0 @@ -247,7 +266,7 @@ diskCache.asyncLoadPeriodMs=5 # ok nearfull full # |------------|-------------------|----------------------| # 0 trimRatio*safeRatio safeRatio fullRatio -# +# # 1. 0<=ok&2 +} + +function success() { + msg "\33[32m[✔]\33[0m ${1}${2}" +} + +function die() { + msg "\33[31m[✘]\33[0m ${1}${2}" + exit 1 +} + +############################ FUNCTIONS +function usage () { + cat << _EOC_ +Usage: + entrypoint.sh --role=ROLE + entrypoint.sh --role=ROLE --args=ARGS + +Examples: + entrypoint.sh --role=etcd + entrypoint.sh --role=client --args="-o default_permissions" +_EOC_ +} + +function get_options() { + local long_opts="role:,args:,help" + local args=`getopt -o ra --long $long_opts -n "$0" -- "$@"` + eval set -- "${args}" + while true + do + case "$1" in + -r|--role) + g_role=$2 + shift 2 + ;; + -a|--args) + g_args=$2 + shift 2 + ;; + -h) + usage + exit 1 + ;; + --) + shift + break + ;; + *) + exit 1 + ;; + esac + done +} + +function prepare() { + g_prefix="/curvefs/$g_role" + conf_path="$g_prefix/conf/$g_role.conf" + + case $g_role in + etcd) + g_binary="$g_prefix/sbin/etcd" + g_start_args="--config-file $conf_path" + ;; + mds) + g_binary="$g_prefix/sbin/curvefs-mds" + g_start_args="--confPath $conf_path" + ;; + metaserver) + g_binary="$g_prefix/sbin/curvefs-metaserver" + g_start_args="--confPath $conf_path" + ;; + client) + g_binary="$g_prefix/sbin/curve-fuse" + g_start_args="--confPath $conf_path" + ;; + monitor) + g_binary="python3" + g_start_args="target_json.py" + ;; + *) + usage + exit 1 + ;; + esac + + if [ "$g_args" != "" ]; then + g_start_args=$g_args + fi +} + +function create_directory() { + chmod 700 "$g_prefix/data" + if [ "$g_role" == "etcd" ]; then + mkdir -p "$g_prefix/data/wal" + elif [ "$g_role" == "metaserver" ]; then + mkdir -p "$g_prefix/data/storage" + elif [ "$g_role" == "client" ]; then + mkdir -p "$g_prefix/mnt" + fi +} + +function main() { + get_options "$@" + + prepare + create_directory + [[ $(command -v crontab) ]] && cron + [[ ! -z $g_preexec ]] && $g_preexec & + if [ $g_role == "etcd" ]; then + exec $g_binary $g_start_args >>$g_prefix/logs/etcd.log 2>&1 + elif [ $g_role == "monitor" ]; then + cd $g_prefix + exec $g_binary $g_start_args + else + exec $g_binary $g_start_args + fi + +} + +############################ MAIN() +main "$@" diff --git a/curvefs/monitor/grafana/provisioning/dashboards/client.json b/curvefs/monitor/grafana/provisioning/dashboards/client.json index 02cba766d5..5303f00661 100644 --- a/curvefs/monitor/grafana/provisioning/dashboards/client.json +++ b/curvefs/monitor/grafana/provisioning/dashboards/client.json @@ -25,7 +25,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 1, + "id": 7, "links": [], "liveNow": false, "panels": [ @@ -37,7 +37,7 @@ "x": 0, "y": 0 }, - "id": 201, + "id": 236, "panels": [ { "aliasColors": {}, @@ -48,9 +48,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "fuse s3 client FuseOpRead latency", "fieldConfig": { "defaults": { - "unit": "short" + "unit": "µs" }, "overrides": [] }, @@ -63,7 +64,7 @@ "y": 1 }, "hiddenSeries": false, - "id": 202, + "id": 237, "interval": "1s", "legend": { "alignAsTable": true, @@ -82,7 +83,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -98,16 +99,17 @@ }, "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_kv_cache_qps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_client_[[fs:regex]]_user_read_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", "range": true, - "refId": "A" + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "read_kv_cache_qps", + "title": "read latency", "tooltip": { "shared": true, "sort": 0, @@ -122,7 +124,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "short", + "format": "µs", "logBase": 1, "show": true }, @@ -146,9 +148,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "fuse s3 client FuseOpWrite latency", "fieldConfig": { "defaults": { - "unit": "short" + "unit": "µs" }, "overrides": [] }, @@ -161,7 +164,7 @@ "y": 1 }, "hiddenSeries": false, - "id": 203, + "id": 238, "interval": "1s", "legend": { "alignAsTable": true, @@ -180,7 +183,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -196,16 +199,17 @@ }, "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_kv_cache_qps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_client_[[fs:regex]]_user_write_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", "range": true, - "refId": "A" + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "write_kv_cache_qps", + "title": "write latency", "tooltip": { "shared": true, "sort": 0, @@ -220,7 +224,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "short", + "format": "µs", "logBase": 1, "show": true }, @@ -244,9 +248,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "fuse s3 client FuseOpRead read attr latency", "fieldConfig": { "defaults": { - "unit": "binBps" + "unit": "µs" }, "overrides": [] }, @@ -259,7 +264,7 @@ "y": 9 }, "hiddenSeries": false, - "id": 204, + "id": 239, "interval": "1s", "legend": { "alignAsTable": true, @@ -278,7 +283,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -294,16 +299,17 @@ }, "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_kv_cache_bps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_fuse_s3_client_[[fs:regex]]_read_attr_[[quantile:regex]]\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", "range": true, - "refId": "A" + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "read_kv_cache_bps", + "title": "read attr latency", "tooltip": { "shared": true, "sort": 0, @@ -318,7 +324,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "binBps", + "format": "µs", "logBase": 1, "show": true }, @@ -342,9 +348,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "fuse s3 client FuseOpRead write attr latency", "fieldConfig": { "defaults": { - "unit": "binBps" + "unit": "µs" }, "overrides": [] }, @@ -357,7 +364,7 @@ "y": 9 }, "hiddenSeries": false, - "id": 205, + "id": 240, "interval": "1s", "legend": { "alignAsTable": true, @@ -376,7 +383,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -392,16 +399,17 @@ }, "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_kv_cache_bps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_fuse_s3_client_[[fs:regex]]_write_attr_[[quantile:regex]]\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", "range": true, - "refId": "A" + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "write_kv_cache_bps", + "title": "write attr latency", "tooltip": { "shared": true, "sort": 0, @@ -416,7 +424,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "binBps", + "format": "µs", "logBase": 1, "show": true }, @@ -440,6 +448,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "fuse s3 client FuseOpRead read data latency", "fieldConfig": { "defaults": { "unit": "µs" @@ -455,7 +464,7 @@ "y": 17 }, "hiddenSeries": false, - "id": 206, + "id": 241, "interval": "1s", "legend": { "alignAsTable": true, @@ -474,7 +483,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -490,7 +499,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_kv_cache_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_fuse_s3_client_[[fs:regex]]_read_data_[[quantile:regex]]\", instance=~\"$instance\"}", "hide": false, "interval": "", "legendFormat": "", @@ -500,7 +509,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "read_kv_cache_latency", + "title": "read data latency", "tooltip": { "shared": true, "sort": 0, @@ -539,6 +548,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "fuse s3 client FuseOpRead write data latency", "fieldConfig": { "defaults": { "unit": "µs" @@ -554,7 +564,7 @@ "y": 17 }, "hiddenSeries": false, - "id": 207, + "id": 242, "interval": "1s", "legend": { "alignAsTable": true, @@ -573,7 +583,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -589,7 +599,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_kv_cache_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_fuse_s3_client_[[fs:regex]]_write_data_[[quantile:regex]]\", instance=~\"$instance\"}", "hide": false, "interval": "", "legendFormat": "", @@ -599,7 +609,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "write_kv_cache_latency", + "title": "write data latency", "tooltip": { "shared": true, "sort": 0, @@ -630,1229 +640,4181 @@ } } ], - "title": "client kv cache r/w performance", + "title": "fuse s3 client", "type": "row" }, { - "collapsed": false, + "collapsed": true, "gridPos": { "h": 1, "w": 24, "x": 0, "y": 1 }, - "id": 194, - "panels": [], - "title": "client diskcache performance", - "type": "row" - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "unit": "short" - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 2 - }, - "hiddenSeries": false, - "id": 195, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.3", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ + "id": 208, + "panels": [ { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, "datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "editorMode": "code", - "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_disk_cache_qps\", instance=~\"$instance\"}", - "interval": "", - "legendFormat": "", - "range": true, - "refId": "A" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "read_disk_cache_qps", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:212", - "format": "short", - "logBase": 1, - "show": true - }, - { - "$$hashKey": "object:213", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "unit": "short" - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 2 - }, - "hiddenSeries": false, - "id": 196, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.3", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] }, - "editorMode": "code", - "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_disk_cache_qps\", instance=~\"$instance\"}", - "interval": "", - "legendFormat": "", - "range": true, - "refId": "A" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "write_disk_cache_qps", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:212", - "format": "short", - "logBase": 1, - "show": true - }, - { - "$$hashKey": "object:213", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "unit": "binBps" - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 10 - }, - "hiddenSeries": false, - "id": 197, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.3", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 41 }, - "editorMode": "code", - "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_disk_cache_bps\", instance=~\"$instance\"}", - "interval": "", - "legendFormat": "", - "range": true, - "refId": "A" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "read_disk_cache_bps", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:212", - "format": "binBps", - "logBase": 1, - "show": true - }, - { - "$$hashKey": "object:213", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "unit": "binBps" + "hiddenSeries": false, + "id": 116, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs.*_read_data_cache_num\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "read_data_cache_num", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "short", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 10 - }, - "hiddenSeries": false, - "id": 198, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.3", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, "datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "editorMode": "code", - "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_disk_cache_bps\", instance=~\"$instance\"}", - "interval": "", - "legendFormat": "", - "range": true, - "refId": "A" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "write_disk_cache_bps", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 41 + }, + "hiddenSeries": false, + "id": 117, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs.*_write_data_cache_num\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "write_data_cache_num", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "short", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 49 + }, + "hiddenSeries": false, + "id": 118, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs.*_read_data_cache_byte\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "read_data_cache_byte", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "short", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 49 + }, + "hiddenSeries": false, + "id": 119, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs.*_write_data_cache_byte\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "write_data_cache_byte", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "short", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + } + ], + "title": "memcache cache", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 2 + }, + "id": 201, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 18 + }, + "hiddenSeries": false, + "id": 202, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_kv_cache_qps\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "read_kv_cache_qps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "short", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 18 + }, + "hiddenSeries": false, + "id": 203, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_kv_cache_qps\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "write_kv_cache_qps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "short", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "binBps" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 26 + }, + "hiddenSeries": false, + "id": 204, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_kv_cache_bps\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "read_kv_cache_bps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "binBps", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "binBps" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 26 + }, + "hiddenSeries": false, + "id": 205, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_kv_cache_bps\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "write_kv_cache_bps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "binBps", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 34 + }, + "hiddenSeries": false, + "id": 206, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_kv_cache_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "", + "range": true, + "refId": "B" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "read_kv_cache_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "µs", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 34 + }, + "hiddenSeries": false, + "id": 207, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_kv_cache_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "", + "range": true, + "refId": "B" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "write_kv_cache_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "µs", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + } + ], + "title": "client kv cache r/w performance", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 3 + }, + "id": 194, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 19 + }, + "hiddenSeries": false, + "id": 195, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_disk_cache_qps\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "read_disk_cache_qps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "short", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 19 + }, + "hiddenSeries": false, + "id": 196, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_disk_cache_qps\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "write_disk_cache_qps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "short", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "binBps" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 27 + }, + "hiddenSeries": false, + "id": 197, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_disk_cache_bps\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "read_disk_cache_bps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "binBps", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "binBps" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 27 + }, + "hiddenSeries": false, + "id": 198, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_disk_cache_bps\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "write_disk_cache_bps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "binBps", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 35 + }, + "hiddenSeries": false, + "id": 199, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_disk_cache_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "", + "range": true, + "refId": "B" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "read_disk_cache_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "µs", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 35 + }, + "hiddenSeries": false, + "id": 200, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_disk_cache_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "", + "range": true, + "refId": "B" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "write_disk_cache_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "µs", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + } + ], + "title": "client diskcache performance", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 4 + }, + "id": 187, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 20 + }, + "hiddenSeries": false, + "id": 188, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_s3_qps\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "read_s3_qps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "short", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 20 + }, + "hiddenSeries": false, + "id": 189, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_s3_qps\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "write_s3_qps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "short", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "binBps" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 28 + }, + "hiddenSeries": false, + "id": 190, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_s3_bps\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "read_s3_bps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "binBps", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "binBps" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 28 + }, + "hiddenSeries": false, + "id": 191, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_s3_bps\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "write_s3_bps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "binBps", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 36 + }, + "hiddenSeries": false, + "id": 192, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_s3_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "", + "range": true, + "refId": "B" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "read_s3_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "µs", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 36 + }, + "hiddenSeries": false, + "id": 193, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_s3_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "", + "range": true, + "refId": "B" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "write_s3_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:212", + "format": "µs", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:213", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + } + ], + "title": "client s3 r/w performance", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 5 + }, + "id": 6, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 209 + }, + "hiddenSeries": false, + "id": 4, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.3", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "process_memory_resident{instance=~\"$instance\"}", + "interval": "", + "legendFormat": "process_memory_resident {{instance}}", + "refId": "process_memory_resident" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "process_memory_virtual{instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "process_memory_virtual {{instance}}", + "refId": "process_memory_virtual" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "process_memory_shared{instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "process_memory_shared {{instance}}", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "process memory usage", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:63", + "format": "decbytes", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:64", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 209 + }, + "hiddenSeries": false, + "id": 2, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.3", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "process_cpu_usage{instance=~\"$instance\"}", + "interval": "", + "legendFormat": "process_cpu_usage {{instance}}", + "refId": "process_cpu_usage" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "process_cpu_usage_system{instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "process_cpu_usage_system {{instance}}", + "refId": "process_cpu_usage_system" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "process_cpu_usage_user{instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "process_cpu_usage_user {{instance}}", + "refId": "process_cpu_usage_user" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "process cpu usage", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:495", + "format": "percentunit", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:496", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + } + ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], + "title": "process usage", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 6 + }, + "id": 85, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 15 + }, + "hiddenSeries": false, + "id": 107, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_read_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "read_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 15 + }, + "hiddenSeries": false, + "id": 108, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_write_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "write_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 23 + }, + "hiddenSeries": false, + "id": 87, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_mk_dir_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "mkdir_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 23 + }, + "hiddenSeries": false, + "id": 91, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_rm_dir_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "rmdir_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 31 + }, + "hiddenSeries": false, + "id": 88, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_create_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "create_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 31 + }, + "hiddenSeries": false, + "id": 92, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_unlink_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "unlink_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, { - "$$hashKey": "object:212", - "format": "binBps", - "logBase": 1, - "show": true + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 39 + }, + "hiddenSeries": false, + "id": 89, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_open_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "open_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } }, { - "$$hashKey": "object:213", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "unit": "µs" + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 39 + }, + "hiddenSeries": false, + "id": 90, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_release_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "release_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 47 + }, + "hiddenSeries": false, + "id": 93, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_open_dir_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "opendir_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 18 - }, - "hiddenSeries": false, - "id": 199, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.3", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, "datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "editorMode": "code", - "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_disk_cache_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "", - "range": true, - "refId": "B" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "read_disk_cache_latency", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:212", - "format": "µs", - "logBase": 1, - "show": true - }, - { - "$$hashKey": "object:213", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "unit": "µs" + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 47 + }, + "hiddenSeries": false, + "id": 94, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_release_dir_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "releasedir_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 18 - }, - "hiddenSeries": false, - "id": 200, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.3", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, "datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "editorMode": "code", - "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_disk_cache_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "", - "range": true, - "refId": "B" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "write_disk_cache_latency", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:212", - "format": "µs", - "logBase": 1, - "show": true - }, - { - "$$hashKey": "object:213", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 26 - }, - "id": 187, - "panels": [], - "title": "client s3 r/w performance", - "type": "row" - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "unit": "short" + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 55 + }, + "hiddenSeries": false, + "id": 99, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_read_dir_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "readdir_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 27 - }, - "hiddenSeries": false, - "id": 188, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.3", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, "datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "editorMode": "code", - "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_s3_qps\", instance=~\"$instance\"}", - "interval": "", - "legendFormat": "", - "range": true, - "refId": "A" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "read_s3_qps", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:212", - "format": "short", - "logBase": 1, - "show": true - }, - { - "$$hashKey": "object:213", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "unit": "short" + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 55 + }, + "hiddenSeries": false, + "id": 100, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_read_link_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "readlink_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 27 - }, - "hiddenSeries": false, - "id": 189, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.3", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, "datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "editorMode": "code", - "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_s3_qps\", instance=~\"$instance\"}", - "interval": "", - "legendFormat": "", - "range": true, - "refId": "A" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "write_s3_qps", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:212", - "format": "short", - "logBase": 1, - "show": true - }, - { - "$$hashKey": "object:213", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "unit": "binBps" + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 63 + }, + "hiddenSeries": false, + "id": 95, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_lookup_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "lookup_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 35 - }, - "hiddenSeries": false, - "id": 190, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.3", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, "datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "editorMode": "code", - "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_s3_bps\", instance=~\"$instance\"}", - "interval": "", - "legendFormat": "", - "range": true, - "refId": "A" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "read_s3_bps", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:212", - "format": "binBps", - "logBase": 1, - "show": true + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 63 + }, + "hiddenSeries": false, + "id": 96, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_mk_nod_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "mknod_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } }, { - "$$hashKey": "object:213", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "unit": "binBps" + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 71 + }, + "hiddenSeries": false, + "id": 97, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_link_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "link_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 35 - }, - "hiddenSeries": false, - "id": 191, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.3", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, "datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "editorMode": "code", - "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_s3_bps\", instance=~\"$instance\"}", - "interval": "", - "legendFormat": "", - "range": true, - "refId": "A" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "write_s3_bps", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:212", - "format": "binBps", - "logBase": 1, - "show": true - }, - { - "$$hashKey": "object:213", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "unit": "µs" + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 71 + }, + "hiddenSeries": false, + "id": 98, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_symlink_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "symlink_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 43 - }, - "hiddenSeries": false, - "id": 192, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.3", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, "datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "editorMode": "code", - "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_read_from_s3_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "", - "range": true, - "refId": "B" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "read_s3_latency", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:212", - "format": "µs", - "logBase": 1, - "show": true - }, - { - "$$hashKey": "object:213", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "unit": "µs" + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 79 + }, + "hiddenSeries": false, + "id": 101, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_get_attr_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "getattr_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 43 - }, - "hiddenSeries": false, - "id": 193, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.3", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, "datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "editorMode": "code", - "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_write_to_s3_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "", - "range": true, - "refId": "B" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "write_s3_latency", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:212", - "format": "µs", - "logBase": 1, - "show": true + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 79 + }, + "hiddenSeries": false, + "id": 102, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_client_op_set_attr_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "setattr_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } }, - { - "$$hashKey": "object:213", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "collapsed": true, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 51 - }, - "id": 6, - "panels": [ { "aliasColors": {}, "bars": false, @@ -1862,16 +4824,22 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 153 + "y": 87 }, "hiddenSeries": false, - "id": 4, + "id": 103, "interval": "1s", "legend": { "alignAsTable": true, @@ -1890,7 +4858,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "9.4.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -1905,39 +4873,15 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "process_memory_resident{instance=~\"$instance\"}", - "interval": "", - "legendFormat": "process_memory_resident {{instance}}", - "refId": "process_memory_resident" - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "exemplar": true, - "expr": "process_memory_virtual{instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "process_memory_virtual {{instance}}", - "refId": "process_memory_virtual" - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "exemplar": true, - "expr": "process_memory_shared{instance=~\"$instance\"}", - "hide": false, + "expr": "{__name__=~\"curvefs_client_op_get_xattr_lat_[[quantile:regex]]\", instance=~\"$instance\"}", "interval": "", - "legendFormat": "process_memory_shared {{instance}}", + "legendFormat": "", "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "process memory usage", + "title": "getxattr_latency", "tooltip": { "shared": true, "sort": 0, @@ -1951,13 +4895,11 @@ }, "yaxes": [ { - "$$hashKey": "object:63", - "format": "decbytes", + "format": "µs", "logBase": 1, "show": true }, { - "$$hashKey": "object:64", "format": "short", "logBase": 1, "show": true @@ -1976,16 +4918,22 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 153 + "y": 87 }, "hiddenSeries": false, - "id": 2, + "id": 104, "interval": "1s", "legend": { "alignAsTable": true, @@ -1993,7 +4941,6 @@ "current": false, "max": true, "min": true, - "rightSide": false, "show": true, "total": false, "values": true @@ -2005,7 +4952,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "9.4.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2020,39 +4967,109 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "process_cpu_usage{instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_client_op_list_xattr_lat_[[quantile:regex]]\", instance=~\"$instance\"}", "interval": "", - "legendFormat": "process_cpu_usage {{instance}}", - "refId": "process_cpu_usage" + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "listxattr_latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "logBase": 1, + "show": true }, { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "exemplar": true, - "expr": "process_cpu_usage_system{instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "process_cpu_usage_system {{instance}}", - "refId": "process_cpu_usage_system" + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 95 + }, + "hiddenSeries": false, + "id": 105, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ { "datasource": { "type": "prometheus", "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "process_cpu_usage_user{instance=~\"$instance\"}", - "hide": false, + "expr": "{__name__=~\"curvefs_client_op_fsync_lat_[[quantile:regex]]\", instance=~\"$instance\"}", "interval": "", - "legendFormat": "process_cpu_usage_user {{instance}}", - "refId": "process_cpu_usage_user" + "legendFormat": "", + "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "process cpu usage", + "title": "fsync_latency", "tooltip": { "shared": true, "sort": 0, @@ -2066,13 +5083,11 @@ }, "yaxes": [ { - "$$hashKey": "object:495", - "format": "percentunit", + "format": "µs", "logBase": 1, "show": true }, { - "$$hashKey": "object:496", "format": "short", "logBase": 1, "show": true @@ -2081,34 +5096,7 @@ "yaxis": { "align": false } - } - ], - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "refId": "A" - } - ], - "title": "process usage", - "type": "row" - }, - { - "collapsed": true, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 52 - }, - "id": 85, - "panels": [ + }, { "aliasColors": {}, "bars": false, @@ -2129,11 +5117,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 154 + "x": 12, + "y": 95 }, "hiddenSeries": false, - "id": 107, + "id": 106, "interval": "1s", "legend": { "alignAsTable": true, @@ -2152,7 +5140,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "9.4.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2167,7 +5155,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_read_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_client_op_flush_lat_[[quantile:regex]]\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -2175,7 +5163,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "read_latency", + "title": "flush_latency", "tooltip": { "shared": true, "sort": 0, @@ -2223,11 +5211,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 154 + "x": 0, + "y": 103 }, "hiddenSeries": false, - "id": 108, + "id": 109, "interval": "1s", "legend": { "alignAsTable": true, @@ -2246,7 +5234,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "9.4.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2261,7 +5249,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_write_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_client_op_rename_lat_[[quantile:regex]]\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -2269,7 +5257,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "write_latency", + "title": "rename_latency", "tooltip": { "shared": true, "sort": 0, @@ -2296,7 +5284,34 @@ "yaxis": { "align": false } - }, + } + ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], + "title": "op latency", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 7 + }, + "id": 176, + "panels": [ { "aliasColors": {}, "bars": false, @@ -2308,7 +5323,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "short" }, "overrides": [] }, @@ -2316,12 +5331,12 @@ "fillGradient": 0, "gridPos": { "h": 8, - "w": 12, + "w": 24, "x": 0, - "y": 162 + "y": 251 }, "hiddenSeries": false, - "id": 87, + "id": 177, "interval": "1s", "legend": { "alignAsTable": true, @@ -2340,7 +5355,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "9.4.3", + "pluginVersion": "8.0.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -2355,7 +5370,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_mk_dir_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_client_op_[[op:regex]]_inflight_num\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -2363,7 +5378,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "mkdir_latency", + "title": "op _inflight_num", "tooltip": { "shared": true, "sort": 0, @@ -2377,7 +5392,7 @@ }, "yaxes": [ { - "format": "µs", + "format": "short", "logBase": 1, "show": true }, @@ -2390,7 +5405,34 @@ "yaxis": { "align": false } - }, + } + ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], + "title": "op inflight number", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 8 + }, + "id": 47, + "panels": [ { "aliasColors": {}, "bars": false, @@ -2402,7 +5444,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "short" }, "overrides": [] }, @@ -2411,11 +5453,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 162 + "x": 0, + "y": 17 }, "hiddenSeries": false, - "id": 91, + "id": 48, "interval": "1s", "legend": { "alignAsTable": true, @@ -2434,7 +5476,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "9.4.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2449,7 +5491,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_rm_dir_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_.*[[fs:regex]]_user_read_qps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -2457,7 +5499,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "rmdir_latency", + "title": "read_qps", "tooltip": { "shared": true, "sort": 0, @@ -2471,11 +5513,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "short", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -2496,7 +5540,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "short" }, "overrides": [] }, @@ -2505,11 +5549,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 170 + "x": 12, + "y": 17 }, "hiddenSeries": false, - "id": 88, + "id": 49, "interval": "1s", "legend": { "alignAsTable": true, @@ -2528,7 +5572,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "9.4.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2543,7 +5587,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_create_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_.*[[fs:regex]]_user_write_qps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -2551,7 +5595,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "create_latency", + "title": "write_qps", "tooltip": { "shared": true, "sort": 0, @@ -2565,11 +5609,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "short", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -2590,7 +5636,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "binBps" }, "overrides": [] }, @@ -2599,11 +5645,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 170 + "x": 0, + "y": 25 }, "hiddenSeries": false, - "id": 92, + "id": 50, "interval": "1s", "legend": { "alignAsTable": true, @@ -2622,7 +5668,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "9.4.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2637,7 +5683,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_unlink_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_read_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -2645,7 +5691,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "unlink_latency", + "title": "read_bps", "tooltip": { "shared": true, "sort": 0, @@ -2659,11 +5705,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "binBps", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -2684,7 +5732,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "binBps" }, "overrides": [] }, @@ -2693,11 +5741,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 178 + "x": 12, + "y": 25 }, "hiddenSeries": false, - "id": 89, + "id": 51, "interval": "1s", "legend": { "alignAsTable": true, @@ -2716,7 +5764,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "9.4.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2731,7 +5779,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_open_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_write_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -2739,7 +5787,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "open_latency", + "title": "write_bps", "tooltip": { "shared": true, "sort": 0, @@ -2753,11 +5801,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "binBps", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -2778,7 +5828,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "short" }, "overrides": [] }, @@ -2787,11 +5837,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 178 + "x": 0, + "y": 33 }, "hiddenSeries": false, - "id": 90, + "id": 52, "interval": "1s", "legend": { "alignAsTable": true, @@ -2810,7 +5860,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "9.4.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2825,7 +5875,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_release_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_read_eps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -2833,7 +5883,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "release_latency", + "title": "read_eps", "tooltip": { "shared": true, "sort": 0, @@ -2847,11 +5897,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "short", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -2870,22 +5922,16 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "fieldConfig": { - "defaults": { - "unit": "µs" - }, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 186 + "x": 12, + "y": 33 }, "hiddenSeries": false, - "id": 93, + "id": 53, "interval": "1s", "legend": { "alignAsTable": true, @@ -2904,7 +5950,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2919,7 +5965,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_open_dir_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs.*[[fs:regex]]_adaptor_write_eps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -2927,7 +5973,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "opendir_latency", + "title": "write_eps", "tooltip": { "shared": true, "sort": 0, @@ -2941,11 +5987,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "short", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -2966,7 +6014,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "reqps" }, "overrides": [] }, @@ -2975,11 +6023,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 186 + "x": 0, + "y": 41 }, "hiddenSeries": false, - "id": 94, + "id": 54, "interval": "1s", "legend": { "alignAsTable": true, @@ -2998,7 +6046,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3013,7 +6061,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_release_dir_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_read_rps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -3021,7 +6069,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "releasedir_latency", + "title": "read_rps", "tooltip": { "shared": true, "sort": 0, @@ -3035,11 +6083,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "reqps", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -3060,7 +6110,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "reqps" }, "overrides": [] }, @@ -3069,11 +6119,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 194 + "x": 12, + "y": 41 }, "hiddenSeries": false, - "id": 99, + "id": 43, "interval": "1s", "legend": { "alignAsTable": true, @@ -3092,7 +6142,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3107,7 +6157,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_read_dir_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_write_rps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -3115,7 +6165,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "readdir_latency", + "title": "write_rps", "tooltip": { "shared": true, "sort": 0, @@ -3129,11 +6179,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "reqps", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -3154,7 +6206,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "bytes" }, "overrides": [] }, @@ -3163,11 +6215,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 194 + "x": 0, + "y": 49 }, "hiddenSeries": false, - "id": 100, + "id": 56, "interval": "1s", "legend": { "alignAsTable": true, @@ -3186,7 +6238,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3201,7 +6253,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_read_link_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_read_io_size\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -3209,7 +6261,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "readlink_latency", + "title": "read_io_size", "tooltip": { "shared": true, "sort": 0, @@ -3223,11 +6275,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "bytes", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -3248,7 +6302,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "bytes" }, "overrides": [] }, @@ -3257,11 +6311,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 202 + "x": 12, + "y": 49 }, "hiddenSeries": false, - "id": 95, + "id": 57, "interval": "1s", "legend": { "alignAsTable": true, @@ -3280,7 +6334,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3295,7 +6349,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_lookup_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_write_io_size\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -3303,7 +6357,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "lookup_latency", + "title": "write_io_size", "tooltip": { "shared": true, "sort": 0, @@ -3317,11 +6371,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "bytes", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -3351,11 +6407,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 202 + "x": 0, + "y": 57 }, "hiddenSeries": false, - "id": 96, + "id": 58, "interval": "1s", "legend": { "alignAsTable": true, @@ -3374,7 +6430,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3389,15 +6445,16 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_mk_nod_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_read_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "mknod_latency", + "title": "read_latency", "tooltip": { "shared": true, "sort": 0, @@ -3411,11 +6468,13 @@ }, "yaxes": [ { + "$$hashKey": "object:212", "format": "µs", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -3445,11 +6504,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 210 + "x": 12, + "y": 57 }, "hiddenSeries": false, - "id": 97, + "id": 59, "interval": "1s", "legend": { "alignAsTable": true, @@ -3468,7 +6527,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3483,15 +6542,16 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_link_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_write_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "link_latency", + "title": "write_latency", "tooltip": { "shared": true, "sort": 0, @@ -3505,11 +6565,13 @@ }, "yaxes": [ { + "$$hashKey": "object:212", "format": "µs", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -3518,7 +6580,34 @@ "yaxis": { "align": false } - }, + } + ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], + "title": "client interface performance", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 9 + }, + "id": 8, + "panels": [ { "aliasColors": {}, "bars": false, @@ -3530,7 +6619,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "short" }, "overrides": [] }, @@ -3539,11 +6628,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 210 + "x": 0, + "y": 57 }, "hiddenSeries": false, - "id": 98, + "id": 10, "interval": "1s", "legend": { "alignAsTable": true, @@ -3562,7 +6651,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3577,7 +6666,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_symlink_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_qps\", job=\"client\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -3585,7 +6674,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "symlink_latency", + "title": "read_qps", "tooltip": { "shared": true, "sort": 0, @@ -3599,11 +6688,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "short", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -3624,7 +6715,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "short" }, "overrides": [] }, @@ -3633,11 +6724,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 218 + "x": 12, + "y": 57 }, "hiddenSeries": false, - "id": 101, + "id": 11, "interval": "1s", "legend": { "alignAsTable": true, @@ -3656,7 +6747,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3671,7 +6762,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_get_attr_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_qps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -3679,7 +6770,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "getattr_latency", + "title": "write_qps", "tooltip": { "shared": true, "sort": 0, @@ -3693,11 +6784,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "short", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -3718,7 +6811,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "binBps" }, "overrides": [] }, @@ -3727,11 +6820,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 218 + "x": 0, + "y": 65 }, "hiddenSeries": false, - "id": 102, + "id": 12, "interval": "1s", "legend": { "alignAsTable": true, @@ -3750,7 +6843,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3765,7 +6858,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_set_attr_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -3773,7 +6866,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "setattr_latency", + "title": "read_bps", "tooltip": { "shared": true, "sort": 0, @@ -3787,11 +6880,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "binBps", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -3812,7 +6907,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "binBps" }, "overrides": [] }, @@ -3821,11 +6916,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 226 + "x": 12, + "y": 65 }, "hiddenSeries": false, - "id": 103, + "id": 13, "interval": "1s", "legend": { "alignAsTable": true, @@ -3844,7 +6939,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3859,7 +6954,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_get_xattr_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -3867,7 +6962,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "getxattr_latency", + "title": "write_bps", "tooltip": { "shared": true, "sort": 0, @@ -3881,11 +6976,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "binBps", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -3906,7 +7003,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "short" }, "overrides": [] }, @@ -3915,11 +7012,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 226 + "x": 0, + "y": 73 }, "hiddenSeries": false, - "id": 104, + "id": 14, "interval": "1s", "legend": { "alignAsTable": true, @@ -3938,7 +7035,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3953,7 +7050,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_list_xattr_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_eps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -3961,7 +7058,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "listxattr_latency", + "title": "read_eps", "tooltip": { "shared": true, "sort": 0, @@ -3975,11 +7072,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "short", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -3998,22 +7097,16 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "fieldConfig": { - "defaults": { - "unit": "µs" - }, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 234 + "x": 12, + "y": 73 }, "hiddenSeries": false, - "id": 105, + "id": 15, "interval": "1s", "legend": { "alignAsTable": true, @@ -4032,7 +7125,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -4047,7 +7140,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_fsync_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_eps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -4055,7 +7148,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "fsync_latency", + "title": "write_eps", "tooltip": { "shared": true, "sort": 0, @@ -4069,11 +7162,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "short", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -4094,7 +7189,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "reqps" }, "overrides": [] }, @@ -4103,11 +7198,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 234 + "x": 0, + "y": 81 }, "hiddenSeries": false, - "id": 106, + "id": 42, "interval": "1s", "legend": { "alignAsTable": true, @@ -4126,7 +7221,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -4141,7 +7236,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_flush_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_rps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -4149,7 +7244,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "flush_latency", + "title": "read_rps", "tooltip": { "shared": true, "sort": 0, @@ -4163,11 +7258,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "reqps", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -4188,7 +7285,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "reqps" }, "overrides": [] }, @@ -4197,11 +7294,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 242 + "x": 12, + "y": 81 }, "hiddenSeries": false, - "id": 109, + "id": 55, "interval": "1s", "legend": { "alignAsTable": true, @@ -4220,7 +7317,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -4235,7 +7332,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_rename_lat_[[quantile:regex]]\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_rps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -4243,7 +7340,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "rename_latency", + "title": "write_rps", "tooltip": { "shared": true, "sort": 0, @@ -4257,11 +7354,13 @@ }, "yaxes": [ { - "format": "µs", + "$$hashKey": "object:212", + "format": "reqps", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -4270,34 +7369,7 @@ "yaxis": { "align": false } - } - ], - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "refId": "A" - } - ], - "title": "op latency", - "type": "row" - }, - { - "collapsed": true, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 53 - }, - "id": 176, - "panels": [ + }, { "aliasColors": {}, "bars": false, @@ -4309,7 +7381,7 @@ }, "fieldConfig": { "defaults": { - "unit": "short" + "unit": "bytes" }, "overrides": [] }, @@ -4317,12 +7389,12 @@ "fillGradient": 0, "gridPos": { "h": 8, - "w": 24, + "w": 12, "x": 0, - "y": 195 + "y": 89 }, "hiddenSeries": false, - "id": 177, + "id": 60, "interval": "1s", "legend": { "alignAsTable": true, @@ -4341,7 +7413,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -4356,7 +7428,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_client_op_[[op:regex]]_inflight_num\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_size\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -4364,7 +7436,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "op _inflight_num", + "title": "read_io_size", "tooltip": { "shared": true, "sort": 0, @@ -4378,11 +7450,13 @@ }, "yaxes": [ { - "format": "short", + "$$hashKey": "object:212", + "format": "bytes", "logBase": 1, "show": true }, { + "$$hashKey": "object:213", "format": "short", "logBase": 1, "show": true @@ -4391,34 +7465,7 @@ "yaxis": { "align": false } - } - ], - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "refId": "A" - } - ], - "title": "op inflight number", - "type": "row" - }, - { - "collapsed": true, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 54 - }, - "id": 47, - "panels": [ + }, { "aliasColors": {}, "bars": false, @@ -4430,7 +7477,7 @@ }, "fieldConfig": { "defaults": { - "unit": "short" + "unit": "bytes" }, "overrides": [] }, @@ -4439,11 +7486,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 156 + "x": 12, + "y": 89 }, "hiddenSeries": false, - "id": 48, + "id": 61, "interval": "1s", "legend": { "alignAsTable": true, @@ -4462,7 +7509,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -4477,7 +7524,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_.*[[fs:regex]]_user_read_qps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_size\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -4485,7 +7532,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "read_qps", + "title": "write_io_size", "tooltip": { "shared": true, "sort": 0, @@ -4500,7 +7547,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "short", + "format": "bytes", "logBase": 1, "show": true }, @@ -4526,7 +7573,7 @@ }, "fieldConfig": { "defaults": { - "unit": "short" + "unit": "µs" }, "overrides": [] }, @@ -4535,11 +7582,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 156 + "x": 0, + "y": 97 }, "hiddenSeries": false, - "id": 49, + "id": 26, "interval": "1s", "legend": { "alignAsTable": true, @@ -4558,7 +7605,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -4573,15 +7620,16 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_.*[[fs:regex]]_user_write_qps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "write_qps", + "title": "read_latency", "tooltip": { "shared": true, "sort": 0, @@ -4596,7 +7644,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "short", + "format": "µs", "logBase": 1, "show": true }, @@ -4622,7 +7670,7 @@ }, "fieldConfig": { "defaults": { - "unit": "binBps" + "unit": "µs" }, "overrides": [] }, @@ -4631,11 +7679,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 164 + "x": 12, + "y": 97 }, "hiddenSeries": false, - "id": 50, + "id": 27, "interval": "1s", "legend": { "alignAsTable": true, @@ -4654,7 +7702,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -4669,15 +7717,16 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_read_bps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "read_bps", + "title": "write_latency", "tooltip": { "shared": true, "sort": 0, @@ -4692,7 +7741,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "binBps", + "format": "µs", "logBase": 1, "show": true }, @@ -4706,7 +7755,34 @@ "yaxis": { "align": false } - }, + } + ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], + "title": "s3_adaptor r/w performance", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 10 + }, + "id": 72, + "panels": [ { "aliasColors": {}, "bars": false, @@ -4718,7 +7794,7 @@ }, "fieldConfig": { "defaults": { - "unit": "binBps" + "unit": "short" }, "overrides": [] }, @@ -4727,11 +7803,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 164 + "x": 0, + "y": 254 }, "hiddenSeries": false, - "id": 51, + "id": 73, "interval": "1s", "legend": { "alignAsTable": true, @@ -4750,7 +7826,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "8.0.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -4765,7 +7841,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_write_bps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_disk_cache_qps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -4773,7 +7849,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "write_bps", + "title": "read_diskcache_qps", "tooltip": { "shared": true, "sort": 0, @@ -4788,7 +7864,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "binBps", + "format": "short", "logBase": 1, "show": true }, @@ -4823,11 +7899,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 172 + "x": 12, + "y": 254 }, "hiddenSeries": false, - "id": 52, + "id": 74, "interval": "1s", "legend": { "alignAsTable": true, @@ -4846,7 +7922,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "8.0.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -4861,7 +7937,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_read_eps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_disk_cache_qps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -4869,7 +7945,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "read_eps", + "title": "write_diskcache_qps", "tooltip": { "shared": true, "sort": 0, @@ -4908,16 +7984,22 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "fieldConfig": { + "defaults": { + "unit": "binBps" + }, + "overrides": [] + }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 172 + "x": 0, + "y": 262 }, "hiddenSeries": false, - "id": 53, + "id": 75, "interval": "1s", "legend": { "alignAsTable": true, @@ -4936,7 +8018,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "8.0.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -4951,7 +8033,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs.*[[fs:regex]]_adaptor_write_eps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_disk_cache_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -4959,7 +8041,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "write_eps", + "title": "read_diskcache_bps", "tooltip": { "shared": true, "sort": 0, @@ -4974,7 +8056,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "short", + "format": "binBps", "logBase": 1, "show": true }, @@ -5000,7 +8082,7 @@ }, "fieldConfig": { "defaults": { - "unit": "reqps" + "unit": "binBps" }, "overrides": [] }, @@ -5009,11 +8091,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 180 + "x": 12, + "y": 262 }, "hiddenSeries": false, - "id": 54, + "id": 76, "interval": "1s", "legend": { "alignAsTable": true, @@ -5032,7 +8114,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "8.0.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -5047,7 +8129,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_read_rps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_disk_cache_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -5055,7 +8137,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "read_rps", + "title": "write_diskcache_bps", "tooltip": { "shared": true, "sort": 0, @@ -5070,7 +8152,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "reqps", + "format": "binBps", "logBase": 1, "show": true }, @@ -5096,7 +8178,7 @@ }, "fieldConfig": { "defaults": { - "unit": "reqps" + "unit": "µs" }, "overrides": [] }, @@ -5105,11 +8187,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 180 + "x": 0, + "y": 270 }, "hiddenSeries": false, - "id": 43, + "id": 77, "interval": "1s", "legend": { "alignAsTable": true, @@ -5128,7 +8210,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "8.0.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -5143,15 +8225,16 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_write_rps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_disk_cache_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "write_rps", + "title": "read_diskcache_latency", "tooltip": { "shared": true, "sort": 0, @@ -5166,7 +8249,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "reqps", + "format": "µs", "logBase": 1, "show": true }, @@ -5192,7 +8275,7 @@ }, "fieldConfig": { "defaults": { - "unit": "bytes" + "unit": "µs" }, "overrides": [] }, @@ -5201,11 +8284,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 188 + "x": 12, + "y": 270 }, "hiddenSeries": false, - "id": 56, + "id": 78, "interval": "1s", "legend": { "alignAsTable": true, @@ -5224,7 +8307,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "8.0.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -5239,15 +8322,16 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_read_io_size\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_disk_cache_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "read_io_size", + "title": "write_diskcache_latency", "tooltip": { "shared": true, "sort": 0, @@ -5262,7 +8346,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "bytes", + "format": "µs", "logBase": 1, "show": true }, @@ -5276,7 +8360,34 @@ "yaxis": { "align": false } - }, + } + ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], + "title": "s3_adaptor r/w diskcache performance", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 11 + }, + "id": 69, + "panels": [ { "aliasColors": {}, "bars": false, @@ -5288,7 +8399,7 @@ }, "fieldConfig": { "defaults": { - "unit": "bytes" + "unit": "short" }, "overrides": [] }, @@ -5297,11 +8408,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 188 + "x": 0, + "y": 113 }, "hiddenSeries": false, - "id": 57, + "id": 62, "interval": "1s", "legend": { "alignAsTable": true, @@ -5335,7 +8446,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_write_io_size\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_s3_qps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -5343,7 +8454,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "write_io_size", + "title": "read_s3_qps", "tooltip": { "shared": true, "sort": 0, @@ -5358,7 +8469,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "bytes", + "format": "short", "logBase": 1, "show": true }, @@ -5384,7 +8495,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "short" }, "overrides": [] }, @@ -5393,11 +8504,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 196 + "x": 12, + "y": 113 }, "hiddenSeries": false, - "id": 58, + "id": 63, "interval": "1s", "legend": { "alignAsTable": true, @@ -5431,16 +8542,15 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_read_lat_[[quantile:regex]]\", instance=~\"$instance\"}", - "hide": false, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_s3_qps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", - "refId": "B" + "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "read_latency", + "title": "write_s3_qps", "tooltip": { "shared": true, "sort": 0, @@ -5455,7 +8565,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "µs", + "format": "short", "logBase": 1, "show": true }, @@ -5481,7 +8591,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "binBps" }, "overrides": [] }, @@ -5490,11 +8600,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 196 + "x": 0, + "y": 121 }, "hiddenSeries": false, - "id": 59, + "id": 66, "interval": "1s", "legend": { "alignAsTable": true, @@ -5528,16 +8638,15 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs.*[[fs:regex]]_user_write_lat_[[quantile:regex]]\", instance=~\"$instance\"}", - "hide": false, + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_s3_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", - "refId": "B" + "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "write_latency", + "title": "read_s3_bps", "tooltip": { "shared": true, "sort": 0, @@ -5552,7 +8661,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "µs", + "format": "binBps", "logBase": 1, "show": true }, @@ -5566,34 +8675,7 @@ "yaxis": { "align": false } - } - ], - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "refId": "A" - } - ], - "title": "client interface performance", - "type": "row" - }, - { - "collapsed": true, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 55 - }, - "id": 8, - "panels": [ + }, { "aliasColors": {}, "bars": false, @@ -5605,7 +8687,7 @@ }, "fieldConfig": { "defaults": { - "unit": "short" + "unit": "binBps" }, "overrides": [] }, @@ -5614,11 +8696,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 80 + "x": 12, + "y": 121 }, "hiddenSeries": false, - "id": 10, + "id": 65, "interval": "1s", "legend": { "alignAsTable": true, @@ -5652,7 +8734,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_qps\", job=\"client\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_s3_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -5660,7 +8742,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "read_qps", + "title": "write_s3_bps", "tooltip": { "shared": true, "sort": 0, @@ -5675,7 +8757,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "short", + "format": "binBps", "logBase": 1, "show": true }, @@ -5701,7 +8783,7 @@ }, "fieldConfig": { "defaults": { - "unit": "short" + "unit": "µs" }, "overrides": [] }, @@ -5710,11 +8792,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 80 + "x": 0, + "y": 129 }, "hiddenSeries": false, - "id": 11, + "id": 64, "interval": "1s", "legend": { "alignAsTable": true, @@ -5748,15 +8830,16 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_qps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_s3_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "write_qps", + "title": "read_s3_latency", "tooltip": { "shared": true, "sort": 0, @@ -5771,7 +8854,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "short", + "format": "µs", "logBase": 1, "show": true }, @@ -5797,7 +8880,7 @@ }, "fieldConfig": { "defaults": { - "unit": "binBps" + "unit": "µs" }, "overrides": [] }, @@ -5806,11 +8889,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 88 + "x": 12, + "y": 129 }, "hiddenSeries": false, - "id": 12, + "id": 67, "interval": "1s", "legend": { "alignAsTable": true, @@ -5844,15 +8927,16 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_bps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_s3_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "read_bps", + "title": "write_s3_latency", "tooltip": { "shared": true, "sort": 0, @@ -5867,7 +8951,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "binBps", + "format": "µs", "logBase": 1, "show": true }, @@ -5881,7 +8965,34 @@ "yaxis": { "align": false } - }, + } + ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], + "title": "s3_adaptor r/w s3 performance", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 12 + }, + "id": 80, + "panels": [ { "aliasColors": {}, "bars": false, @@ -5893,7 +9004,7 @@ }, "fieldConfig": { "defaults": { - "unit": "binBps" + "unit": "short" }, "overrides": [] }, @@ -5902,11 +9013,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 88 + "x": 0, + "y": 304 }, "hiddenSeries": false, - "id": 13, + "id": 81, "interval": "1s", "legend": { "alignAsTable": true, @@ -5925,7 +9036,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "8.0.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -5940,7 +9051,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_bps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_disk_cache.*[[fs:regex]]_write_s3_qps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -5948,7 +9059,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "write_bps", + "title": "write_s3_qps", "tooltip": { "shared": true, "sort": 0, @@ -5963,7 +9074,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "binBps", + "format": "short", "logBase": 1, "show": true }, @@ -5989,7 +9100,7 @@ }, "fieldConfig": { "defaults": { - "unit": "short" + "unit": "binBps" }, "overrides": [] }, @@ -5998,11 +9109,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 96 + "x": 12, + "y": 304 }, "hiddenSeries": false, - "id": 14, + "id": 82, "interval": "1s", "legend": { "alignAsTable": true, @@ -6021,7 +9132,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "8.0.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -6036,7 +9147,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_eps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_disk_cache.*[[fs:regex]]_write_s3_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -6044,7 +9155,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "read_eps", + "title": "write_s3_bps", "tooltip": { "shared": true, "sort": 0, @@ -6059,7 +9170,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "short", + "format": "binBps", "logBase": 1, "show": true }, @@ -6083,16 +9194,22 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, "fill": 1, "fillGradient": 0, "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 96 + "x": 0, + "y": 312 }, "hiddenSeries": false, - "id": 15, + "id": 83, "interval": "1s", "legend": { "alignAsTable": true, @@ -6111,7 +9228,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "8.0.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -6126,15 +9243,16 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_eps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_disk_cache.*[[fs:regex]]_write_s3_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "write_eps", + "title": "write_s3_latency", "tooltip": { "shared": true, "sort": 0, @@ -6163,7 +9281,34 @@ "yaxis": { "align": false } - }, + } + ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], + "title": "diskcache r/w s3 performance", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 13 + }, + "id": 111, + "panels": [ { "aliasColors": {}, "bars": false, @@ -6175,7 +9320,7 @@ }, "fieldConfig": { "defaults": { - "unit": "reqps" + "unit": "short" }, "overrides": [] }, @@ -6185,10 +9330,10 @@ "h": 8, "w": 12, "x": 0, - "y": 104 + "y": 321 }, "hiddenSeries": false, - "id": 42, + "id": 112, "interval": "1s", "legend": { "alignAsTable": true, @@ -6207,7 +9352,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "8.0.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -6222,7 +9367,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_rps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs.*_file_manager_num\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -6230,7 +9375,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "read_rps", + "title": "file_manager_num", "tooltip": { "shared": true, "sort": 0, @@ -6245,7 +9390,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "reqps", + "format": "short", "logBase": 1, "show": true }, @@ -6271,7 +9416,7 @@ }, "fieldConfig": { "defaults": { - "unit": "reqps" + "unit": "short" }, "overrides": [] }, @@ -6281,10 +9426,10 @@ "h": 8, "w": 12, "x": 12, - "y": 104 + "y": 321 }, "hiddenSeries": false, - "id": 55, + "id": 113, "interval": "1s", "legend": { "alignAsTable": true, @@ -6303,7 +9448,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "8.0.6", "pointradius": 2, "points": false, "renderer": "flot", @@ -6318,7 +9463,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_rps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs.*_chunk_manager_num\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -6326,7 +9471,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "write_rps", + "title": "chunk_manager_num", "tooltip": { "shared": true, "sort": 0, @@ -6341,7 +9486,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "reqps", + "format": "short", "logBase": 1, "show": true }, @@ -6355,7 +9500,34 @@ "yaxis": { "align": false } - }, + } + ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], + "title": "manager metric", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 14 + }, + "id": 121, + "panels": [ { "aliasColors": {}, "bars": false, @@ -6367,7 +9539,7 @@ }, "fieldConfig": { "defaults": { - "unit": "bytes" + "unit": "short" }, "overrides": [] }, @@ -6377,10 +9549,10 @@ "h": 8, "w": 12, "x": 0, - "y": 112 + "y": 63 }, "hiddenSeries": false, - "id": 60, + "id": 122, "interval": "1s", "legend": { "alignAsTable": true, @@ -6399,7 +9571,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -6414,7 +9586,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_size\", instance=~\"$instance\"}", + "expr": "{__name__=~\"diskcache_cache_count\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -6422,7 +9594,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "read_io_size", + "title": "diskcache_cache_count", "tooltip": { "shared": true, "sort": 0, @@ -6437,7 +9609,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "bytes", + "format": "short", "logBase": 1, "show": true }, @@ -6473,10 +9645,10 @@ "h": 8, "w": 12, "x": 12, - "y": 112 + "y": 63 }, "hiddenSeries": false, - "id": 61, + "id": 123, "interval": "1s", "legend": { "alignAsTable": true, @@ -6495,7 +9667,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -6510,7 +9682,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_size\", instance=~\"$instance\"}", + "expr": "{__name__=~\"diskcache_cache_bytes\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -6518,7 +9690,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "write_io_size", + "title": "diskcache_cache_bytes", "tooltip": { "shared": true, "sort": 0, @@ -6559,7 +9731,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "none" }, "overrides": [] }, @@ -6569,10 +9741,10 @@ "h": 8, "w": 12, "x": 0, - "y": 120 + "y": 71 }, "hiddenSeries": false, - "id": 26, + "id": 124, "interval": "1s", "legend": { "alignAsTable": true, @@ -6591,7 +9763,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -6606,16 +9778,15 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", - "hide": false, + "expr": "{__name__=~\"icache_cache_count\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", - "refId": "B" + "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "read_latency", + "title": "icache_cache_count", "tooltip": { "shared": true, "sort": 0, @@ -6630,7 +9801,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "µs", + "format": "none", "logBase": 1, "show": true }, @@ -6656,7 +9827,7 @@ }, "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "none" }, "overrides": [] }, @@ -6666,10 +9837,10 @@ "h": 8, "w": 12, "x": 12, - "y": 120 + "y": 71 }, "hiddenSeries": false, - "id": 27, + "id": 125, "interval": "1s", "legend": { "alignAsTable": true, @@ -6688,7 +9859,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -6703,16 +9874,15 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", - "hide": false, + "expr": "{__name__=~\"inode_s3_chunk_info_size\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", - "refId": "B" + "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "write_latency", + "title": "inode_s3_chunk_info_size", "tooltip": { "shared": true, "sort": 0, @@ -6727,7 +9897,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "µs", + "format": "none", "logBase": 1, "show": true }, @@ -6741,34 +9911,7 @@ "yaxis": { "align": false } - } - ], - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "refId": "A" - } - ], - "title": "s3_adaptor r/w performance", - "type": "row" - }, - { - "collapsed": true, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 56 - }, - "id": 72, - "panels": [ + }, { "aliasColors": {}, "bars": false, @@ -6790,10 +9933,10 @@ "h": 8, "w": 12, "x": 0, - "y": 198 + "y": 79 }, "hiddenSeries": false, - "id": 73, + "id": 126, "interval": "1s", "legend": { "alignAsTable": true, @@ -6812,7 +9955,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -6827,7 +9970,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_disk_cache_qps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"dcache_cache_count\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -6835,7 +9978,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "read_diskcache_qps", + "title": "dcache_cache_count", "tooltip": { "shared": true, "sort": 0, @@ -6886,10 +10029,10 @@ "h": 8, "w": 12, "x": 12, - "y": 198 + "y": 79 }, "hiddenSeries": false, - "id": 74, + "id": 127, "interval": "1s", "legend": { "alignAsTable": true, @@ -6908,7 +10051,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -6923,7 +10066,7 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_disk_cache_qps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"dcache_cache_bytes\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", "refId": "A" @@ -6931,7 +10074,7 @@ ], "thresholds": [], "timeRegions": [], - "title": "write_diskcache_qps", + "title": "dcache_cache_bytes", "tooltip": { "shared": true, "sort": 0, @@ -6960,7 +10103,34 @@ "yaxis": { "align": false } - }, + } + ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], + "title": "lru cache", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 15 + }, + "id": 115, + "panels": [ { "aliasColors": {}, "bars": false, @@ -6970,9 +10140,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "Total cache disk capacity", "fieldConfig": { "defaults": { - "unit": "binBps" + "unit": "bytes" }, "overrides": [] }, @@ -6982,10 +10153,10 @@ "h": 8, "w": 12, "x": 0, - "y": 206 + "y": 31 }, "hiddenSeries": false, - "id": 75, + "id": 209, "interval": "1s", "legend": { "alignAsTable": true, @@ -7004,7 +10175,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -7018,16 +10189,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_disk_cache_bps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_disk_cache.*[[fs:regex]]_diskcache_totalbytes\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "read_diskcache_bps", + "title": "total", "tooltip": { "shared": true, "sort": 0, @@ -7042,7 +10215,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "binBps", + "format": "bytes", "logBase": 1, "show": true }, @@ -7066,9 +10239,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "The size occupied by S3 objects cached in the cache disk.", "fieldConfig": { "defaults": { - "unit": "binBps" + "unit": "bytes" }, "overrides": [] }, @@ -7078,10 +10252,10 @@ "h": 8, "w": 12, "x": 12, - "y": 206 + "y": 31 }, "hiddenSeries": false, - "id": 76, + "id": 178, "interval": "1s", "legend": { "alignAsTable": true, @@ -7100,7 +10274,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -7114,16 +10288,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_disk_cache_bps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_disk_cache.*[[fs:regex]]_diskcache_usedbytes\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "write_diskcache_bps", + "title": "used", "tooltip": { "shared": true, "sort": 0, @@ -7138,7 +10314,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "binBps", + "format": "bytes", "logBase": 1, "show": true }, @@ -7162,9 +10338,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "Number of objects in cache", "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "short" }, "overrides": [] }, @@ -7174,10 +10351,10 @@ "h": 8, "w": 12, "x": 0, - "y": 214 + "y": 39 }, "hiddenSeries": false, - "id": 77, + "id": 210, "interval": "1s", "legend": { "alignAsTable": true, @@ -7196,7 +10373,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -7210,17 +10387,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_disk_cache_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", - "hide": false, + "expr": "{__name__=~\"diskcache_cache_count\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", - "refId": "B" + "range": true, + "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "read_diskcache_latency", + "title": "cache count", "tooltip": { "shared": true, "sort": 0, @@ -7235,7 +10413,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "µs", + "format": "short", "logBase": 1, "show": true }, @@ -7259,9 +10437,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "diskcache usage in lru", "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "bytes" }, "overrides": [] }, @@ -7271,10 +10450,10 @@ "h": 8, "w": 12, "x": 12, - "y": 214 + "y": 39 }, "hiddenSeries": false, - "id": 78, + "id": 217, "interval": "1s", "legend": { "alignAsTable": true, @@ -7293,7 +10472,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -7308,16 +10487,15 @@ "uid": "PBFA97CFB590B2093" }, "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_disk_cache_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", - "hide": false, + "expr": "{__name__=~\"diskcache_cache_bytes\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", - "refId": "B" + "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "write_diskcache_latency", + "title": "cache bytes", "tooltip": { "shared": true, "sort": 0, @@ -7332,7 +10510,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "µs", + "format": "bytes", "logBase": 1, "show": true }, @@ -7346,34 +10524,7 @@ "yaxis": { "align": false } - } - ], - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "refId": "A" - } - ], - "title": "s3_adaptor r/w diskcache performance", - "type": "row" - }, - { - "collapsed": true, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 57 - }, - "id": 69, - "panels": [ + }, { "aliasColors": {}, "bars": false, @@ -7383,6 +10534,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "Number of cache hits", "fieldConfig": { "defaults": { "unit": "short" @@ -7395,10 +10547,10 @@ "h": 8, "w": 12, "x": 0, - "y": 57 + "y": 47 }, "hiddenSeries": false, - "id": 62, + "id": 211, "interval": "1s", "legend": { "alignAsTable": true, @@ -7417,7 +10569,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -7431,16 +10583,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_s3_qps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"diskcache_cache_hit\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "read_s3_qps", + "title": "cache hit", "tooltip": { "shared": true, "sort": 0, @@ -7479,9 +10633,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "Cache hit rate", "fieldConfig": { "defaults": { - "unit": "short" + "unit": "percentunit" }, "overrides": [] }, @@ -7491,10 +10646,10 @@ "h": 8, "w": 12, "x": 12, - "y": 57 + "y": 47 }, "hiddenSeries": false, - "id": 63, + "id": 213, "interval": "1s", "legend": { "alignAsTable": true, @@ -7513,7 +10668,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -7527,16 +10682,44 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"diskcache_cache_hit\", instance=~\"$instance\"}", + "hide": true, + "interval": "", + "legendFormat": "", + "range": true, + "refId": "hit" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_s3_qps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"diskcache_cache_miss\", instance=~\"$instance\"}", + "hide": true, "interval": "", "legendFormat": "", - "refId": "A" + "range": true, + "refId": "miss" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "$hit/($hit+$miss)", + "hide": false, + "refId": "A", + "type": "math" } ], "thresholds": [], "timeRegions": [], - "title": "write_s3_qps", + "title": "cache hit rate", "tooltip": { "shared": true, "sort": 0, @@ -7551,7 +10734,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "short", + "format": "percentunit", "logBase": 1, "show": true }, @@ -7575,9 +10758,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "Number of cache misses", "fieldConfig": { "defaults": { - "unit": "binBps" + "unit": "short" }, "overrides": [] }, @@ -7587,10 +10771,10 @@ "h": 8, "w": 12, "x": 0, - "y": 65 + "y": 55 }, "hiddenSeries": false, - "id": 66, + "id": 212, "interval": "1s", "legend": { "alignAsTable": true, @@ -7609,7 +10793,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -7623,16 +10807,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_s3_bps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"diskcache_cache_miss\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "read_s3_bps", + "title": "cache miss", "tooltip": { "shared": true, "sort": 0, @@ -7647,7 +10833,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "binBps", + "format": "short", "logBase": 1, "show": true }, @@ -7671,6 +10857,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "This metric tracks the cache eviction throughput in terms of bandwidth. It measures how much data is being evicted from the cache disk per second, recorded in units like megabytes/second or gigabytes/second.", "fieldConfig": { "defaults": { "unit": "binBps" @@ -7683,10 +10870,10 @@ "h": 8, "w": 12, "x": 12, - "y": 65 + "y": 55 }, "hiddenSeries": false, - "id": 65, + "id": 215, "interval": "1s", "legend": { "alignAsTable": true, @@ -7705,7 +10892,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -7719,16 +10906,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_s3_bps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_disk_cache_[[fs:regex]]_diskcache_trim_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "write_s3_bps", + "title": "trim bps", "tooltip": { "shared": true, "sort": 0, @@ -7767,9 +10956,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "This metric measures the efficiency of evicting objects from the cache disk, recorded as the number of objects evicted from the cache per second", "fieldConfig": { "defaults": { - "unit": "µs" + "unit": "short" }, "overrides": [] }, @@ -7779,10 +10969,10 @@ "h": 8, "w": 12, "x": 0, - "y": 73 + "y": 63 }, "hiddenSeries": false, - "id": 64, + "id": 214, "interval": "1s", "legend": { "alignAsTable": true, @@ -7801,7 +10991,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -7815,17 +11005,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_read_s3_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", - "hide": false, + "expr": "{__name__=~\"curvefs_disk_cache.*[[fs:regex]]_diskcache_trim_qps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", - "refId": "B" + "range": true, + "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "read_s3_latency", + "title": "trim qps", "tooltip": { "shared": true, "sort": 0, @@ -7840,7 +11031,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "µs", + "format": "short", "logBase": 1, "show": true }, @@ -7864,6 +11055,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "This metric tracks the cache eviction latency. It measures how long it takes to evict objects from the cache disk, recorded in units like milliseconds or microseconds per eviction.", "fieldConfig": { "defaults": { "unit": "µs" @@ -7876,10 +11068,10 @@ "h": 8, "w": 12, "x": 12, - "y": 73 + "y": 63 }, "hiddenSeries": false, - "id": 67, + "id": 216, "interval": "1s", "legend": { "alignAsTable": true, @@ -7898,7 +11090,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "10.0.3", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -7912,17 +11104,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_s3.*[[fs:regex]]_adaptor_write_s3_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", - "hide": false, + "expr": "{__name__=~\"curvefs_disk_cache.*[[fs:regex]]_diskcache_trim_lat_[[quantile:regex]]\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", - "refId": "B" + "range": true, + "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "write_s3_latency", + "title": "trim latency", "tooltip": { "shared": true, "sort": 0, @@ -7962,22 +11155,18 @@ "refId": "A" } ], - "title": "s3_adaptor r/w s3 performance", + "title": "diskcache cache", "type": "row" }, { "collapsed": true, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 58 + "y": 16 }, - "id": 80, + "id": 218, "panels": [ { "aliasColors": {}, @@ -7988,6 +11177,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "Number of times using kvcache cache (set)", "fieldConfig": { "defaults": { "unit": "short" @@ -8000,10 +11190,10 @@ "h": 8, "w": 12, "x": 0, - "y": 248 + "y": 32 }, "hiddenSeries": false, - "id": 81, + "id": 219, "interval": "1s", "legend": { "alignAsTable": true, @@ -8022,7 +11212,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -8036,16 +11226,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_disk_cache.*[[fs:regex]]_write_s3_qps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_kvclient_manager.*[[fs:regex]]_count\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "write_s3_qps", + "title": "set count", "tooltip": { "shared": true, "sort": 0, @@ -8084,9 +11276,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "kvcache cache hit rate", "fieldConfig": { "defaults": { - "unit": "binBps" + "unit": "percentunit" }, "overrides": [] }, @@ -8096,10 +11289,10 @@ "h": 8, "w": 12, "x": 12, - "y": 248 + "y": 32 }, "hiddenSeries": false, - "id": 82, + "id": 220, "interval": "1s", "legend": { "alignAsTable": true, @@ -8118,7 +11311,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -8132,16 +11325,44 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_kvclient_manager.*[[fs:regex]]_hit\", instance=~\"$instance\"}", + "hide": true, + "interval": "", + "legendFormat": "", + "range": true, + "refId": "hit" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_disk_cache.*[[fs:regex]]_write_s3_bps\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_kvclient_manager.*[[fs:regex]]_miss\", instance=~\"$instance\"}", + "hide": true, "interval": "", "legendFormat": "", - "refId": "A" + "range": true, + "refId": "miss" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "$hit/($hit+$miss)", + "hide": false, + "refId": "hit rate", + "type": "math" } ], "thresholds": [], "timeRegions": [], - "title": "write_s3_bps", + "title": "hit rate", "tooltip": { "shared": true, "sort": 0, @@ -8156,7 +11377,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "binBps", + "format": "percentunit", "logBase": 1, "show": true }, @@ -8180,6 +11401,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "Number of kvcache cache hits", "fieldConfig": { "defaults": { "unit": "short" @@ -8192,10 +11414,10 @@ "h": 8, "w": 12, "x": 0, - "y": 256 + "y": 40 }, "hiddenSeries": false, - "id": 83, + "id": 221, "interval": "1s", "legend": { "alignAsTable": true, @@ -8214,7 +11436,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -8228,17 +11450,19 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_disk_cache.*[[fs:regex]]_write_s3_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_kvclient_manager.*[[fs:regex]]_hit\", instance=~\"$instance\"}", "hide": false, "interval": "", "legendFormat": "", - "refId": "B" + "range": true, + "refId": "hit" } ], "thresholds": [], "timeRegions": [], - "title": "write_s3_latency", + "title": "hit", "tooltip": { "shared": true, "sort": 0, @@ -8267,34 +11491,7 @@ "yaxis": { "align": false } - } - ], - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "refId": "A" - } - ], - "title": "diskcache r/w s3 performance", - "type": "row" - }, - { - "collapsed": true, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 59 - }, - "id": 111, - "panels": [ + }, { "aliasColors": {}, "bars": false, @@ -8304,6 +11501,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "Number of kvcache cache misses", "fieldConfig": { "defaults": { "unit": "short" @@ -8315,11 +11513,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 265 + "x": 12, + "y": 40 }, "hiddenSeries": false, - "id": 112, + "id": 222, "interval": "1s", "legend": { "alignAsTable": true, @@ -8338,7 +11536,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -8352,16 +11550,19 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs.*_file_manager_num\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_kvclient_manager.*[[fs:regex]]_miss\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "range": true, + "refId": "miss" } ], "thresholds": [], "timeRegions": [], - "title": "file_manager_num", + "title": "miss", "tooltip": { "shared": true, "sort": 0, @@ -8400,6 +11601,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "kvcache get qps", "fieldConfig": { "defaults": { "unit": "short" @@ -8411,11 +11613,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 265 + "x": 0, + "y": 48 }, "hiddenSeries": false, - "id": 113, + "id": 223, "interval": "1s", "legend": { "alignAsTable": true, @@ -8434,7 +11636,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -8448,16 +11650,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs.*_chunk_manager_num\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_kvclient_manager.*[[fs:regex]]_get_qps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "chunk_manager_num", + "title": "get qps", "tooltip": { "shared": true, "sort": 0, @@ -8486,34 +11690,7 @@ "yaxis": { "align": false } - } - ], - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "refId": "A" - } - ], - "title": "manager metric", - "type": "row" - }, - { - "collapsed": true, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 60 - }, - "id": 121, - "panels": [ + }, { "aliasColors": {}, "bars": false, @@ -8523,6 +11700,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "kvcache set qps", "fieldConfig": { "defaults": { "unit": "short" @@ -8534,11 +11712,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 202 + "x": 12, + "y": 48 }, "hiddenSeries": false, - "id": 122, + "id": 226, "interval": "1s", "legend": { "alignAsTable": true, @@ -8557,7 +11735,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -8571,16 +11749,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"diskcache_cache_count\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_kvclient_manager.*[[fs:regex]]_set_qps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "diskcache_cache_count", + "title": "set qps", "tooltip": { "shared": true, "sort": 0, @@ -8619,9 +11799,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "kvcache get latency", "fieldConfig": { "defaults": { - "unit": "bytes" + "unit": "µs" }, "overrides": [] }, @@ -8630,11 +11811,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 202 + "x": 0, + "y": 56 }, "hiddenSeries": false, - "id": 123, + "id": 225, "interval": "1s", "legend": { "alignAsTable": true, @@ -8653,7 +11834,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -8667,16 +11848,19 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"diskcache_cache_bytes\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_kvclient_manager.*[[fs:regex]]_get_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "range": true, + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "diskcache_cache_bytes", + "title": "get latency", "tooltip": { "shared": true, "sort": 0, @@ -8691,7 +11875,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "bytes", + "format": "µs", "logBase": 1, "show": true }, @@ -8715,9 +11899,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "kvcache set latency", "fieldConfig": { "defaults": { - "unit": "none" + "unit": "µs" }, "overrides": [] }, @@ -8726,11 +11911,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 210 + "x": 12, + "y": 56 }, "hiddenSeries": false, - "id": 124, + "id": 227, "interval": "1s", "legend": { "alignAsTable": true, @@ -8749,7 +11934,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -8763,16 +11948,19 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"icache_cache_count\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_kvclient_manager.*[[fs:regex]]_set_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "range": true, + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "icache_cache_count", + "title": "set latency", "tooltip": { "shared": true, "sort": 0, @@ -8787,7 +11975,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "none", + "format": "µs", "logBase": 1, "show": true }, @@ -8811,9 +11999,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "kvcache get bps", "fieldConfig": { "defaults": { - "unit": "none" + "unit": "binBps" }, "overrides": [] }, @@ -8822,11 +12011,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 210 + "x": 0, + "y": 64 }, "hiddenSeries": false, - "id": 125, + "id": 224, "interval": "1s", "legend": { "alignAsTable": true, @@ -8845,7 +12034,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -8859,16 +12048,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"inode_s3_chunk_info_size\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_kvclient_manager.*[[fs:regex]]_get_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "inode_s3_chunk_info_size", + "title": "get bps", "tooltip": { "shared": true, "sort": 0, @@ -8883,7 +12074,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "none", + "format": "binBps", "logBase": 1, "show": true }, @@ -8907,9 +12098,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "kvcache set bps", "fieldConfig": { "defaults": { - "unit": "short" + "unit": "binBps" }, "overrides": [] }, @@ -8918,11 +12110,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 218 + "x": 12, + "y": 64 }, "hiddenSeries": false, - "id": 126, + "id": 228, "interval": "1s", "legend": { "alignAsTable": true, @@ -8941,7 +12133,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -8955,16 +12147,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"dcache_cache_count\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_kvclient_manager.*[[fs:regex]]_set_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "dcache_cache_count", + "title": "set bps", "tooltip": { "shared": true, "sort": 0, @@ -8979,7 +12173,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "short", + "format": "binBps", "logBase": 1, "show": true }, @@ -8993,7 +12187,21 @@ "yaxis": { "align": false } - }, + } + ], + "title": "kvcache manager", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 17 + }, + "id": 229, + "panels": [ { "aliasColors": {}, "bars": false, @@ -9003,9 +12211,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "memcache client get latency", "fieldConfig": { "defaults": { - "unit": "short" + "unit": "µs" }, "overrides": [] }, @@ -9014,11 +12223,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 218 + "x": 0, + "y": 33 }, "hiddenSeries": false, - "id": 127, + "id": 232, "interval": "1s", "legend": { "alignAsTable": true, @@ -9037,7 +12246,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -9051,16 +12260,19 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"dcache_cache_bytes\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_memcache_client.*[[fs:regex]]_get_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "range": true, + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "dcache_cache_bytes", + "title": "get latency", "tooltip": { "shared": true, "sort": 0, @@ -9075,7 +12287,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "short", + "format": "µs", "logBase": 1, "show": true }, @@ -9089,34 +12301,7 @@ "yaxis": { "align": false } - } - ], - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "refId": "A" - } - ], - "title": "lru cache", - "type": "row" - }, - { - "collapsed": true, - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 61 - }, - "id": 115, - "panels": [ + }, { "aliasColors": {}, "bars": false, @@ -9126,6 +12311,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "memcache client set qps", "fieldConfig": { "defaults": { "unit": "short" @@ -9137,11 +12323,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 299 + "x": 12, + "y": 33 }, "hiddenSeries": false, - "id": 116, + "id": 231, "interval": "1s", "legend": { "alignAsTable": true, @@ -9160,7 +12346,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -9174,16 +12360,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs.*_read_data_cache_num\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_memcache_client.*[[fs:regex]]_set_qps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "read_data_cache_num", + "title": "set qps", "tooltip": { "shared": true, "sort": 0, @@ -9222,9 +12410,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "memcache client get bps", "fieldConfig": { "defaults": { - "unit": "short" + "unit": "binBps" }, "overrides": [] }, @@ -9233,11 +12422,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 299 + "x": 0, + "y": 41 }, "hiddenSeries": false, - "id": 117, + "id": 234, "interval": "1s", "legend": { "alignAsTable": true, @@ -9256,7 +12445,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -9270,16 +12459,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs.*_write_data_cache_num\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_memcache_client.*[[fs:regex]]_get_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "write_data_cache_num", + "title": "get bps", "tooltip": { "shared": true, "sort": 0, @@ -9294,7 +12485,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "short", + "format": "binBps", "logBase": 1, "show": true }, @@ -9318,9 +12509,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "memcache client set latency", "fieldConfig": { "defaults": { - "unit": "short" + "unit": "µs" }, "overrides": [] }, @@ -9329,11 +12521,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 307 + "x": 12, + "y": 41 }, "hiddenSeries": false, - "id": 118, + "id": 233, "interval": "1s", "legend": { "alignAsTable": true, @@ -9352,7 +12544,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -9366,16 +12558,19 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs.*_read_data_cache_byte\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_memcache_client.*[[fs:regex]]_set_lat_[[quantile:regex]]\", job=\"client\", instance=~\"$instance\"}", + "hide": false, "interval": "", "legendFormat": "", - "refId": "A" + "range": true, + "refId": "B" } ], "thresholds": [], "timeRegions": [], - "title": "read_data_cache_byte", + "title": "set latency", "tooltip": { "shared": true, "sort": 0, @@ -9390,7 +12585,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "short", + "format": "µs", "logBase": 1, "show": true }, @@ -9414,6 +12609,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "memcache get qps", "fieldConfig": { "defaults": { "unit": "short" @@ -9425,11 +12621,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 307 + "x": 0, + "y": 49 }, "hiddenSeries": false, - "id": 119, + "id": 230, "interval": "1s", "legend": { "alignAsTable": true, @@ -9448,7 +12644,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -9462,16 +12658,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs.*_write_data_cache_byte\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_memcache_client.*[[fs:regex]]_get_qps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "write_data_cache_byte", + "title": "get qps", "tooltip": { "shared": true, "sort": 0, @@ -9510,9 +12708,10 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "description": "memcache client set bps", "fieldConfig": { "defaults": { - "unit": "bytes" + "unit": "binBps" }, "overrides": [] }, @@ -9521,11 +12720,11 @@ "gridPos": { "h": 8, "w": 12, - "x": 0, - "y": 315 + "x": 12, + "y": 49 }, "hiddenSeries": false, - "id": 178, + "id": 235, "interval": "1s", "legend": { "alignAsTable": true, @@ -9544,7 +12743,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -9558,16 +12757,18 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, + "editorMode": "code", "exemplar": true, - "expr": "{__name__=~\"curvefs_disk_cache_[[fs:regex]]_diskcache_usedbytes\", instance=~\"$instance\"}", + "expr": "{__name__=~\"curvefs_memcache_client.*[[fs:regex]]_set_bps\", instance=~\"$instance\"}", "interval": "", "legendFormat": "", + "range": true, "refId": "A" } ], "thresholds": [], "timeRegions": [], - "title": "diskcache_usedbytes", + "title": "set bps", "tooltip": { "shared": true, "sort": 0, @@ -9582,7 +12783,7 @@ "yaxes": [ { "$$hashKey": "object:212", - "format": "bytes", + "format": "binBps", "logBase": 1, "show": true }, @@ -9598,16 +12799,7 @@ } } ], - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "refId": "A" - } - ], - "title": "diskcache cache num/byte", + "title": "memcache client", "type": "row" }, { @@ -9620,7 +12812,7 @@ "h": 1, "w": 24, "x": 0, - "y": 62 + "y": 18 }, "id": 32, "panels": [ @@ -9645,7 +12837,7 @@ "h": 6, "w": 12, "x": 0, - "y": 324 + "y": 138 }, "hiddenSeries": false, "id": 36, @@ -9667,7 +12859,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -9741,7 +12933,7 @@ "h": 6, "w": 12, "x": 12, - "y": 324 + "y": 138 }, "hiddenSeries": false, "id": 128, @@ -9763,7 +12955,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -9837,7 +13029,7 @@ "h": 6, "w": 12, "x": 0, - "y": 330 + "y": 144 }, "hiddenSeries": false, "id": 129, @@ -9859,7 +13051,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -9933,7 +13125,7 @@ "h": 6, "w": 12, "x": 12, - "y": 330 + "y": 144 }, "hiddenSeries": false, "id": 130, @@ -9955,7 +13147,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -10029,7 +13221,7 @@ "h": 6, "w": 12, "x": 0, - "y": 336 + "y": 150 }, "hiddenSeries": false, "id": 131, @@ -10051,7 +13243,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -10125,7 +13317,7 @@ "h": 6, "w": 12, "x": 12, - "y": 336 + "y": 150 }, "hiddenSeries": false, "id": 132, @@ -10147,7 +13339,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -10221,7 +13413,7 @@ "h": 6, "w": 12, "x": 0, - "y": 342 + "y": 156 }, "hiddenSeries": false, "id": 133, @@ -10317,7 +13509,7 @@ "h": 6, "w": 12, "x": 12, - "y": 342 + "y": 156 }, "hiddenSeries": false, "id": 134, @@ -10413,7 +13605,7 @@ "h": 6, "w": 12, "x": 0, - "y": 348 + "y": 162 }, "hiddenSeries": false, "id": 135, @@ -10509,7 +13701,7 @@ "h": 6, "w": 12, "x": 12, - "y": 348 + "y": 162 }, "hiddenSeries": false, "id": 136, @@ -10605,7 +13797,7 @@ "h": 6, "w": 12, "x": 0, - "y": 354 + "y": 168 }, "hiddenSeries": false, "id": 137, @@ -10701,7 +13893,7 @@ "h": 6, "w": 12, "x": 12, - "y": 354 + "y": 168 }, "hiddenSeries": false, "id": 138, @@ -10797,7 +13989,7 @@ "h": 6, "w": 12, "x": 0, - "y": 360 + "y": 174 }, "hiddenSeries": false, "id": 139, @@ -10893,7 +14085,7 @@ "h": 6, "w": 12, "x": 12, - "y": 360 + "y": 174 }, "hiddenSeries": false, "id": 140, @@ -10988,7 +14180,7 @@ "h": 6, "w": 12, "x": 0, - "y": 366 + "y": 180 }, "hiddenSeries": false, "id": 141, @@ -11083,7 +14275,7 @@ "h": 6, "w": 12, "x": 12, - "y": 366 + "y": 180 }, "hiddenSeries": false, "id": 142, @@ -11179,7 +14371,7 @@ "h": 6, "w": 12, "x": 0, - "y": 372 + "y": 186 }, "hiddenSeries": false, "id": 143, @@ -11275,7 +14467,7 @@ "h": 6, "w": 12, "x": 12, - "y": 372 + "y": 186 }, "hiddenSeries": false, "id": 144, @@ -11371,7 +14563,7 @@ "h": 6, "w": 12, "x": 0, - "y": 378 + "y": 192 }, "hiddenSeries": false, "id": 145, @@ -11467,7 +14659,7 @@ "h": 6, "w": 12, "x": 12, - "y": 378 + "y": 192 }, "hiddenSeries": false, "id": 146, @@ -11563,7 +14755,7 @@ "h": 6, "w": 12, "x": 0, - "y": 384 + "y": 198 }, "hiddenSeries": false, "id": 147, @@ -11659,7 +14851,7 @@ "h": 6, "w": 12, "x": 12, - "y": 384 + "y": 198 }, "hiddenSeries": false, "id": 148, @@ -11755,7 +14947,7 @@ "h": 6, "w": 12, "x": 0, - "y": 390 + "y": 204 }, "hiddenSeries": false, "id": 149, @@ -11851,7 +15043,7 @@ "h": 6, "w": 12, "x": 12, - "y": 390 + "y": 204 }, "hiddenSeries": false, "id": 150, @@ -11949,7 +15141,7 @@ "h": 1, "w": 24, "x": 0, - "y": 63 + "y": 19 }, "id": 34, "panels": [ @@ -11974,7 +15166,7 @@ "h": 6, "w": 12, "x": 0, - "y": 397 + "y": 66 }, "hiddenSeries": false, "id": 155, @@ -11996,7 +15188,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -12070,7 +15262,7 @@ "h": 6, "w": 12, "x": 12, - "y": 397 + "y": 66 }, "hiddenSeries": false, "id": 152, @@ -12092,7 +15284,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -12166,7 +15358,7 @@ "h": 6, "w": 12, "x": 0, - "y": 403 + "y": 72 }, "hiddenSeries": false, "id": 153, @@ -12188,7 +15380,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -12262,7 +15454,7 @@ "h": 6, "w": 12, "x": 12, - "y": 403 + "y": 72 }, "hiddenSeries": false, "id": 156, @@ -12284,7 +15476,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -12358,7 +15550,7 @@ "h": 6, "w": 12, "x": 0, - "y": 409 + "y": 78 }, "hiddenSeries": false, "id": 157, @@ -12380,7 +15572,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -12454,7 +15646,7 @@ "h": 6, "w": 12, "x": 12, - "y": 409 + "y": 78 }, "hiddenSeries": false, "id": 154, @@ -12476,7 +15668,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -12550,7 +15742,7 @@ "h": 6, "w": 12, "x": 0, - "y": 415 + "y": 84 }, "hiddenSeries": false, "id": 151, @@ -12646,7 +15838,7 @@ "h": 6, "w": 12, "x": 12, - "y": 415 + "y": 84 }, "hiddenSeries": false, "id": 158, @@ -12742,7 +15934,7 @@ "h": 6, "w": 12, "x": 0, - "y": 421 + "y": 90 }, "hiddenSeries": false, "id": 159, @@ -12838,7 +16030,7 @@ "h": 6, "w": 12, "x": 12, - "y": 421 + "y": 90 }, "hiddenSeries": false, "id": 160, @@ -12934,7 +16126,7 @@ "h": 6, "w": 12, "x": 0, - "y": 427 + "y": 96 }, "hiddenSeries": false, "id": 161, @@ -13030,7 +16222,7 @@ "h": 6, "w": 12, "x": 12, - "y": 427 + "y": 96 }, "hiddenSeries": false, "id": 162, @@ -13126,7 +16318,7 @@ "h": 6, "w": 12, "x": 0, - "y": 433 + "y": 102 }, "hiddenSeries": false, "id": 163, @@ -13222,7 +16414,7 @@ "h": 6, "w": 12, "x": 12, - "y": 433 + "y": 102 }, "hiddenSeries": false, "id": 164, @@ -13318,7 +16510,7 @@ "h": 6, "w": 12, "x": 0, - "y": 439 + "y": 108 }, "hiddenSeries": false, "id": 165, @@ -13414,7 +16606,7 @@ "h": 6, "w": 12, "x": 12, - "y": 439 + "y": 108 }, "hiddenSeries": false, "id": 166, @@ -13510,7 +16702,7 @@ "h": 6, "w": 12, "x": 0, - "y": 445 + "y": 114 }, "hiddenSeries": false, "id": 167, @@ -13606,7 +16798,7 @@ "h": 6, "w": 12, "x": 12, - "y": 445 + "y": 114 }, "hiddenSeries": false, "id": 168, @@ -13702,7 +16894,7 @@ "h": 6, "w": 12, "x": 0, - "y": 451 + "y": 120 }, "hiddenSeries": false, "id": 169, @@ -13798,7 +16990,7 @@ "h": 6, "w": 12, "x": 12, - "y": 451 + "y": 120 }, "hiddenSeries": false, "id": 170, @@ -13894,7 +17086,7 @@ "h": 6, "w": 12, "x": 0, - "y": 457 + "y": 126 }, "hiddenSeries": false, "id": 171, @@ -13990,7 +17182,7 @@ "h": 6, "w": 12, "x": 12, - "y": 457 + "y": 126 }, "hiddenSeries": false, "id": 172, @@ -14086,7 +17278,7 @@ "h": 6, "w": 12, "x": 0, - "y": 463 + "y": 132 }, "hiddenSeries": false, "id": 173, @@ -14182,7 +17374,7 @@ "h": 6, "w": 12, "x": 12, - "y": 463 + "y": 132 }, "hiddenSeries": false, "id": 174, @@ -14276,7 +17468,7 @@ "h": 1, "w": 24, "x": 0, - "y": 64 + "y": 20 }, "id": 180, "panels": [ @@ -14341,7 +17533,7 @@ "h": 8, "w": 12, "x": 0, - "y": 166 + "y": 222 }, "id": 182, "options": { @@ -14436,7 +17628,7 @@ "h": 8, "w": 12, "x": 12, - "y": 166 + "y": 222 }, "id": 184, "options": { @@ -14532,7 +17724,7 @@ "h": 8, "w": 12, "x": 0, - "y": 174 + "y": 230 }, "id": 186, "options": { @@ -14577,13 +17769,9 @@ "list": [ { "current": { - "selected": true, - "text": [ - "fuxi-hangyan-01:9000" - ], - "value": [ - "fuxi-hangyan-01:9000" - ] + "selected": false, + "text": "All", + "value": "$__all" }, "datasource": { "type": "prometheus", @@ -14642,10 +17830,10 @@ "current": { "selected": true, "text": [ - "All" + "latency" ], "value": [ - "$__all" + "latency" ] }, "datasource": { @@ -14710,6 +17898,6 @@ "timezone": "", "title": "client", "uid": "I2_uSSenk", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/curvefs/monitor/grafana/provisioning/dashboards/cluster.json b/curvefs/monitor/grafana/provisioning/dashboards/cluster.json new file mode 100644 index 0000000000..2dcae0ec8e --- /dev/null +++ b/curvefs/monitor/grafana/provisioning/dashboards/cluster.json @@ -0,0 +1,1014 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Curvefs cluster", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 9, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 2, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [], + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 16, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 7, + "interval": "1s", + "options": { + "legend": { + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "pieType": "pie", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "10.1.4", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "code", + "exemplar": false, + "expr": "{__name__=~\"fs_usage_info_fs_[[fsName:regex]]_used\", job=\"mds\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "", + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "fs used", + "type": "piechart" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "displayName": "cluster total used", + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 5, + "interval": "1s", + "options": { + "legend": { + "calcs": [ + "mean", + "max", + "min" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "10.1.4", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum({__name__=~\"fs_usage_info_fs_[[fsName:regex]]_used\",job=\"mds\"})", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "title": "cluster total used", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 9 + }, + "id": 4, + "interval": "1s", + "options": { + "legend": { + "calcs": [ + "mean", + "max", + "min" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "10.1.4", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "code", + "exemplar": false, + "expr": "{__name__=~\"fs_usage_info_fs_[[fsName:regex]]_used\", job=\"mds\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "interval": "", + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "fs used", + "type": "timeseries" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "none" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 17 + }, + "hiddenSeries": false, + "id": 8, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"topology_fs_id_[[fsId:regex]]_.*inode_num\",job=\"mds\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "inode_num_by_type", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "transformations": [ + { + "id": "sortBy", + "options": {} + } + ], + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "none" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 17 + }, + "hiddenSeries": false, + "id": 13, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum({__name__=~\"topology_fs_id_[0-9]*_inode_num\",job=\"mds\"})", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "cluster inode", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "transformations": [ + { + "id": "sortBy", + "options": {} + } + ], + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "none" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 25 + }, + "hiddenSeries": false, + "id": 10, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum({__name__=~\"topology_.*_type_file_inode_num\",job=\"mds\"})", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "cluster file inode", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "transformations": [ + { + "id": "sortBy", + "options": {} + } + ], + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "none" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 25 + }, + "hiddenSeries": false, + "id": 9, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum({__name__=~\"topology_.*_type_directory_inode_num\",job=\"mds\"})", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "cluster directory inode", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "transformations": [ + { + "id": "sortBy", + "options": {} + } + ], + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "none" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 33 + }, + "hiddenSeries": false, + "id": 12, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum({__name__=~\"topology_.*_type_sym_link_inode_num\",job=\"mds\"})", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "cluster sym_link inode", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "transformations": [ + { + "id": "sortBy", + "options": {} + } + ], + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "none" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 33 + }, + "hiddenSeries": false, + "id": 11, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "sum({__name__=~\"topology_.*_type_s3_inode_num\",job=\"mds\"})", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "cluster s3 inode", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "transformations": [ + { + "id": "sortBy", + "options": {} + } + ], + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + } + ], + "title": "fs usage", + "type": "row" + } + ], + "refresh": "5s", + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "definition": "{__name__=~\"fs_usage_info_fs_.*_used\",job=\"mds\"}", + "hide": 0, + "includeAll": true, + "label": "fsName", + "multi": false, + "name": "fsName", + "options": [], + "query": { + "query": "{__name__=~\"fs_usage_info_fs_.*_used\",job=\"mds\"}", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "/fs_usage_info_fs_(.*)_used.*/", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "definition": "{__name__=~\"topology_fs_id_[0-9]*_inode_num\",job=\"mds\"}", + "hide": 0, + "includeAll": true, + "label": "fsId", + "multi": false, + "name": "fsId", + "options": [], + "query": { + "query": "{__name__=~\"topology_fs_id_[0-9]*_inode_num\",job=\"mds\"}", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "/topology_fs_id_([0-9]*)_inode_num.*/", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "cluster", + "uid": "c57406c1-8262-4bf8-85c4-f4f65f336f96", + "version": 1, + "weekStart": "" +} diff --git a/curvefs/monitor/grafana/provisioning/dashboards/memcached.json b/curvefs/monitor/grafana/provisioning/dashboards/memcached.json new file mode 100644 index 0000000000..b1cc362ccf --- /dev/null +++ b/curvefs/monitor/grafana/provisioning/dashboards/memcached.json @@ -0,0 +1,1917 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Memcached dashboard for grafana 6.5.1 or above.\r\nDataSource: Prometheus\r\nCollector: Memcached official exporter : https://github.com/prometheus/memcached_exporter/releases \r\n", + "editable": true, + "fiscalYearStartMonth": 0, + "gnetId": 11527, + "graphTooltip": 0, + "id": 15, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "0": { + "text": "DOWN" + }, + "1": { + "text": "UP" + } + }, + "type": "value" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#d44a3a", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 0.1 + }, + { + "color": "#299c46", + "value": 0.9 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 8, + "x": 0, + "y": 0 + }, + "id": 6, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "background", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.4", + "repeatDirection": "h", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": false, + "expr": "memcached_up{instance=~\"$instance\"}", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "title": "Instance State", + "type": "stat" + }, + { + "aliasColors": { + "ratio": "#6ED0E0" + }, + "bars": true, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 0, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 6, + "w": 8, + "x": 8, + "y": 0 + }, + "hiddenSeries": false, + "id": 25, + "legend": { + "alignAsTable": false, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": false, + "show": false, + "total": false, + "values": false + }, + "lines": false, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "sum (memcached_commands_total{command=\"get\",job=\"$job\"}) / (sum (memcached_commands_total{command=\"get\",job=\"$job\"}) + sum (memcached_commands_total{command=\"set\",job=\"$job\"}))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Get", + "refId": "A", + "step": 5, + "target": "" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "sum (memcached_commands_total{command=\"set\",job=\"$job\"}) / (sum (memcached_commands_total{command=\"get\",job=\"$job\"}) + sum (memcached_commands_total{command=\"set\",job=\"$job\"}))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "Set", + "refId": "B", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Get & Set ratio", + "tooltip": { + "msResolution": false, + "shared": false, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "series", + "show": true, + "values": [ + "current" + ] + }, + "yaxes": [ + { + "format": "percentunit", + "logBase": 1, + "max": "1", + "min": "0", + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": true, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 6, + "w": 8, + "x": 16, + "y": 0 + }, + "height": "120px", + "hiddenSeries": false, + "id": 29, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": false, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "miss", + "color": "#E24D42" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "sum (memcached_commands_total{status=\"hit\",command=\"get\",}) / sum (memcached_commands_total{command=\"get\",job=\"$job\"})", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "hit", + "refId": "C", + "step": 5 + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "sum (memcached_commands_total{status=\"miss\",command=\"get\",job=\"$job\"}) / sum (memcached_commands_total{command=\"get\",job=\"$job\"})", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "miss", + "refId": "A", + "step": 5 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Hit & Miss ratio", + "tooltip": { + "msResolution": true, + "shared": false, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "series", + "show": true, + "values": [ + "current" + ] + }, + "yaxes": [ + { + "format": "percentunit", + "logBase": 1, + "max": "1", + "min": 0, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 4, + "x": 0, + "y": 4 + }, + "id": 35, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.4", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "sum (memcached_items_evicted_total{job=\"$job\"})", + "format": "time_series", + "intervalFactor": 1, + "refId": "A", + "step": 20 + } + ], + "title": "Evicts (total)", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 4, + "x": 4, + "y": 4 + }, + "id": 37, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.4", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "sum (memcached_items_reclaimed_total{job=\"$job\"})", + "format": "time_series", + "intervalFactor": 1, + "refId": "A", + "step": 20 + } + ], + "title": "Reclaims (total)", + "type": "stat" + }, + { + "aliasColors": { + "evicts": "#890F02", + "memcached_items_evicted_total{instance=\"172.17.0.1:9150\",job=\"prometheus\"}": "#890F02", + "reclaims": "#3F6833" + }, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 6 + }, + "height": "240px", + "hiddenSeries": false, + "id": 27, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "reclaims", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "sum (irate (memcached_items_evicted_total{job=\"$job\"}[5m]))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "evicts", + "refId": "A", + "step": 5, + "target": "" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "sum (irate (memcached_items_reclaimed_total{job=\"$job\"}[5m]))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "reclaims", + "refId": "B", + "step": 5 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Evicts & Reclaims rate", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 6 + }, + "hiddenSeries": false, + "id": 10, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "expr": "memcached_current_connections{job=\"$job\", instance=~\"$instance\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Connections", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 6 + }, + "height": "240px", + "hiddenSeries": false, + "id": 31, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "expr": "sum (irate (memcached_commands_total{status=\"hit\",command=\"get\",job=\"$job\"}[5m])) / sum (irate (memcached_commands_total{command=\"get\",job=\"$job\"}[5m]\n))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Hit", + "refId": "A", + "step": 5 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Hit rate", + "tooltip": { + "msResolution": true, + "shared": false, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [ + "total" + ] + }, + "yaxes": [ + { + "format": "percentunit", + "logBase": 1, + "min": 0, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 13 + }, + "hiddenSeries": false, + "id": 19, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "expr": "delta(memcached_read_bytes_total{job=\"$job\", instance=~\"$instance\"}[1m])", + "format": "time_series", + "interval": "1m", + "intervalFactor": 1, + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Read", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 13 + }, + "hiddenSeries": false, + "id": 5, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "expr": "memcached_current_bytes{job=\"$job\", instance=~\"$instance\"}/memcached_limit_bytes{job=\"$job\", instance=~\"$instance\"}", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Used Ratio", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 13 + }, + "hiddenSeries": false, + "id": 4, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "expr": "memcached_current_items{job=\"$job\", instance=~\"$instance\"}", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Items in cache", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 20 + }, + "hiddenSeries": false, + "id": 38, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "expr": "delta(memcached_written_bytes_total{job=\"$job\", instance=~\"$instance\"}[1m])", + "format": "time_series", + "interval": "1m", + "intervalFactor": 1, + "legendFormat": "", + "range": true, + "refId": "B" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Write[1min]", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 20 + }, + "hiddenSeries": false, + "id": 41, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "expr": "delta(memcached_read_bytes_total{job=\"$job\", instance=~\"$instance\"}[1m])", + "format": "time_series", + "interval": "1m", + "intervalFactor": 1, + "legendFormat": "", + "range": true, + "refId": "B" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Read(1min)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 2, + "links": [], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 20 + }, + "id": 11, + "links": [], + "options": { + "legend": { + "calcs": [ + "mean", + "lastNotNull", + "max", + "min" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "10.1.4", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": false, + "expr": "sum (delta(memcached_commands_total{job=\"$job\", status=\"hit\",command=\"get\"}[1m])) / sum (delta(memcached_commands_total{job=\"$job\",command=\"get\"}[1m])) * 100", + "format": "time_series", + "hide": false, + "instant": false, + "interval": "", + "intervalFactor": 1, + "legendFormat": "get ratio", + "range": true, + "refId": "A" + } + ], + "title": "Get Hit Ratio Command(1m)", + "type": "timeseries" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editable": true, + "error": false, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "grid": {}, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 27 + }, + "hiddenSeries": false, + "id": 33, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "hideEmpty": false, + "hideZero": false, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sideWidth": 120, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "expr": "sum (irate (memcached_commands_total{job=\"$job\", instance=~\"$instance\"}[5m])) by (command)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "", + "range": true, + "refId": "A", + "step": 4, + "target": "" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Commands", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": false + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 27 + }, + "hiddenSeries": false, + "id": 20, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "expr": "sum(delta(memcached_commands_total{job=\"$job\", instance=~\"$instance\"}[30s]))/30", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "QPS", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "links": [], + "unit": "bytes" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 35 + }, + "hiddenSeries": false, + "id": 39, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "expr": "memcached_read_bytes_total{job=\"$job\", instance=~\"$instance\"}", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Read Bytes Total", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "links": [], + "unit": "bytes" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 35 + }, + "hiddenSeries": false, + "id": 42, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "expr": "memcached_written_bytes_total{job=\"$job\", instance=~\"$instance\"}", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Read Bytes Total", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + } + ], + "refresh": "5s", + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "memcached", + "value": "memcached" + }, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "definition": "", + "hide": 0, + "includeAll": false, + "multi": false, + "name": "job", + "options": [], + "query": "label_values(memcached_up, job)", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "current": { + "selected": true, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "definition": "{__name__=~\"memcached_up\", job=\"memcached\"}", + "hide": 0, + "includeAll": true, + "label": "Addr", + "multi": false, + "name": "instance", + "options": [], + "query": { + "query": "{__name__=~\"memcached_up\", job=\"memcached\"}", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "/.*instance=\"([^\"]*).*/", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-5m", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "", + "title": "Memcached", + "uid": "AQxf3X-mk", + "version": 1, + "weekStart": "" +} \ No newline at end of file diff --git a/curvefs/monitor/grafana/provisioning/dashboards/metaserver.json b/curvefs/monitor/grafana/provisioning/dashboards/metaserver.json index c21f1bf870..a4395d2af3 100644 --- a/curvefs/monitor/grafana/provisioning/dashboards/metaserver.json +++ b/curvefs/monitor/grafana/provisioning/dashboards/metaserver.json @@ -3,7 +3,10 @@ "list": [ { "builtIn": 1, - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -20,543 +23,1019 @@ }, "description": "Curvefs mds server", "editable": true, - "gnetId": null, + "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 5, - "iteration": 1660902423620, + "id": 8, "links": [], + "liveNow": false, "panels": [ { - "collapsed": false, - "datasource": null, + "collapsed": true, "gridPos": { "h": 1, "w": 24, "x": 0, "y": 0 }, - "id": 6, - "panels": [], - "title": "process usage", - "type": "row" - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": null, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 1 - }, - "hiddenSeries": false, - "id": 4, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "8.0.6", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ + "id": 70, + "panels": [ { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, "datasource": { - "type": "prometheus" + "type": "prometheus", + "uid": "PBFA97CFB590B2093" }, - "exemplar": true, - "expr": "process_memory_resident{instance=~\"$instance\"}", - "interval": "", - "legendFormat": "process_memory_resident {{hostname}}", - "refId": "process_memory_resident" - }, - { - "datasource": { - "type": "prometheus" - }, - "exemplar": true, - "expr": "process_memory_virtual{instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "process_memory_virtual {{hostname}}", - "refId": "process_memory_virtual" - }, - { - "datasource": { - "type": "prometheus" + "fieldConfig": { + "defaults": { + "unit": "binBps" + }, + "overrides": [] }, - "exemplar": true, - "expr": "process_memory_shared{instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "process_memory_shared {{hostname}}", - "refId": "A" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "process memory usage", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:63", - "format": "decbytes", - "logBase": 1, - "show": true - }, - { - "$$hashKey": "object:64", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": null, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 1 - }, - "hiddenSeries": false, - "id": 2, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "rightSide": false, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "8.0.6", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "datasource": { - "type": "prometheus" + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 1 }, - "exemplar": true, - "expr": "process_cpu_usage{instance=~\"$instance\"}", - "interval": "", - "legendFormat": "process_cpu_usage {{hostname}}", - "refId": "process_cpu_usage" - }, - { - "datasource": { - "type": "prometheus" - }, - "exemplar": true, - "expr": "process_cpu_usage_system{instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "process_cpu_usage_system {{hostname}}", - "refId": "process_cpu_usage_system" - }, - { - "datasource": { - "type": "prometheus" - }, - "exemplar": true, - "expr": "process_cpu_usage_user{instance=~\"$instance\"}", - "hide": false, - "interval": "", - "legendFormat": "process_cpu_usage_user {{hostname}}", - "refId": "process_cpu_usage_user" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "process cpu usage", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:495", - "format": "percentunit", - "logBase": 1, - "show": true - }, - { - "$$hashKey": "object:496", - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "collapsed": false, - "datasource": null, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 9 - }, - "id": 14, - "panels": [], - "title": "metaserver config", - "type": "row" - }, - { - "datasource": null, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "displayMode": "auto" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null + "hiddenSeries": false, + "id": 69, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" }, - { - "color": "red", - "value": 80 - } - ] + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_metaserver_s3_client_adaptor_delete_inode_bps\",job=\"metaserver\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "delete inode bps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:63", + "format": "binBps", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:64", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false } }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 10 - }, - "id": 16, - "interval": "1s", - "options": { - "showHeader": true - }, - "pluginVersion": "8.0.6", - "targets": [ - { - "exemplar": true, - "expr": "{__name__=~\"curvefs_metaserver_config.*\", job=\"metaserver\", instance=~\"$instance\"}", - "format": "table", - "instant": true, - "interval": "", - "legendFormat": "", - "refId": "A" - } - ], - "title": "metaserver config", - "transformations": [ { - "id": "organize", + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 1 + }, + "hiddenSeries": false, + "id": 71, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", "options": { - "excludeByName": { - "Time": true, - "Value": true, - "__name__": true, - "hostname": true, - "job": true + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_metaserver_s3_client_adaptor_delete_inode_qps\",job=\"metaserver\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "delete inode qps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:63", + "format": "short", + "logBase": 1, + "show": true }, - "indexByName": {}, - "renameByName": {} + { + "$$hashKey": "object:64", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false } - } - ], - "type": "table" - }, - { - "collapsed": false, - "datasource": null, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 18 - }, - "id": 30, - "panels": [], - "title": "service total performance", - "type": "row" - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": null, - "fieldConfig": { - "defaults": { - "unit": "qps" }, - "overrides": [] + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "µs" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 9 + }, + "hiddenSeries": false, + "id": 72, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_metaserver_s3_client_adaptor_delete_inode_lat_[[quantile:regex]]\",job=\"metaserver\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "delete inode latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:63", + "format": "µs", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:64", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 9 + }, + "hiddenSeries": false, + "id": 73, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "editorMode": "code", + "exemplar": true, + "expr": "{__name__=~\"curvefs_metaserver_s3_client_adaptor_delete_inode_eps\",job=\"metaserver\", instance=~\"$instance\"}", + "interval": "", + "legendFormat": "", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "delete inode eps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:63", + "format": "short", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:64", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + } + ], + "title": "s3 client adaptor", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" }, - "fill": 1, - "fillGradient": 0, "gridPos": { - "h": 8, - "w": 12, + "h": 1, + "w": 24, "x": 0, - "y": 19 - }, - "hiddenSeries": false, - "id": 31, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true + "y": 1 }, - "percentage": false, - "pluginVersion": "8.0.6", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ + "id": 6, + "panels": [ { - "exemplar": true, - "expr": "sum({__name__=~\".*curvefs_metaserver_meta_server_service.*_qps\",job=\"metaserver\", instance=~\"$instance\"})", - "interval": "", - "legendFormat": "", - "refId": "A" + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 1 + }, + "hiddenSeries": false, + "id": 4, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "process_memory_resident{instance=~\"$instance\"}", + "interval": "", + "legendFormat": "process_memory_resident {{hostname}}", + "refId": "process_memory_resident" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "process_memory_virtual{instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "process_memory_virtual {{hostname}}", + "refId": "process_memory_virtual" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "process_memory_shared{instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "process_memory_shared {{hostname}}", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "process memory usage", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:63", + "format": "decbytes", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:64", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 1 + }, + "hiddenSeries": false, + "id": 2, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "process_cpu_usage{instance=~\"$instance\"}", + "interval": "", + "legendFormat": "process_cpu_usage {{hostname}}", + "refId": "process_cpu_usage" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "process_cpu_usage_system{instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "process_cpu_usage_system {{hostname}}", + "refId": "process_cpu_usage_system" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "process_cpu_usage_user{instance=~\"$instance\"}", + "hide": false, + "interval": "", + "legendFormat": "process_cpu_usage_user {{hostname}}", + "refId": "process_cpu_usage_user" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "process cpu usage", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:495", + "format": "percentunit", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:496", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } } ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "total_qps", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "$$hashKey": "object:63", - "format": "qps", - "logBase": 1, - "show": true - }, + "targets": [ { - "$$hashKey": "object:64", - "format": "short", - "logBase": 1, - "show": true + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" } ], - "yaxis": { - "align": false - } + "title": "process usage", + "type": "row" }, { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": null, - "fieldConfig": { - "defaults": { - "unit": "none" - }, - "overrides": [] + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" }, - "fill": 1, - "fillGradient": 0, "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 19 - }, - "hiddenSeries": false, - "id": 32, - "interval": "1s", - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true + "h": 1, + "w": 24, + "x": 0, + "y": 2 }, - "percentage": false, - "pluginVersion": "8.0.6", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, + "id": 14, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 10 + }, + "id": 16, + "interval": "1s", + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "10.1.4", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "{__name__=~\"curvefs_metaserver_config.*\", job=\"metaserver\", instance=~\"$instance\"}", + "format": "table", + "instant": true, + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "title": "metaserver config", + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true, + "Value": true, + "__name__": true, + "hostname": true, + "job": true + }, + "indexByName": {}, + "renameByName": {} + } + } + ], + "type": "table" + } + ], "targets": [ { - "exemplar": true, - "expr": "sum({__name__=~\".*curvefs_metaserver_meta_server_service.*_error\",job=\"metaserver\", instance=~\"$instance\"}) by (instance)", - "interval": "", - "legendFormat": "", + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "refId": "A" } ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "total_error_count", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" + "title": "metaserver config", + "type": "row" + }, + { + "collapsed": true, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 3 }, - "yaxes": [ + "id": 30, + "panels": [ { - "$$hashKey": "object:63", - "format": "none", - "logBase": 1, - "show": true + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "qps" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 11 + }, + "hiddenSeries": false, + "id": 31, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "sum({__name__=~\".*curvefs_metaserver_meta_server_service.*_qps\",job=\"metaserver\", instance=~\"$instance\"})", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "total_qps", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:63", + "format": "qps", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:64", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } }, { - "$$hashKey": "object:64", - "format": "short", - "logBase": 1, - "show": true + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "unit": "none" + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 11 + }, + "hiddenSeries": false, + "id": 32, + "interval": "1s", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "10.1.4", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "sum({__name__=~\".*curvefs_metaserver_meta_server_service.*_error\",job=\"metaserver\", instance=~\"$instance\"}) by (instance)", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "total_error_count", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:63", + "format": "none", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:64", + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + } + ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" } ], - "yaxis": { - "align": false - } + "title": "service total performance", + "type": "row" }, { "collapsed": true, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 27 + "y": 4 }, "id": 8, "panels": [ @@ -565,7 +1044,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -578,7 +1060,7 @@ "h": 8, "w": 12, "x": 0, - "y": 28 + "y": 21 }, "hiddenSeries": false, "id": 9, @@ -600,7 +1082,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -610,6 +1092,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_create_inode\",job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -618,9 +1104,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "create_inode", "tooltip": { "shared": true, @@ -629,9 +1113,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -658,7 +1140,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -671,7 +1156,7 @@ "h": 8, "w": 12, "x": 12, - "y": 28 + "y": 21 }, "hiddenSeries": false, "id": 10, @@ -693,7 +1178,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -703,6 +1188,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_create_dentry\",job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -711,9 +1200,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "create_dentry", "tooltip": { "shared": true, @@ -722,9 +1209,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -751,7 +1236,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -764,7 +1252,7 @@ "h": 8, "w": 12, "x": 0, - "y": 36 + "y": 29 }, "hiddenSeries": false, "id": 17, @@ -786,7 +1274,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -796,6 +1284,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_delete_inode\",job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -804,9 +1296,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "delete_inode", "tooltip": { "shared": true, @@ -815,9 +1305,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -844,7 +1332,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -857,7 +1348,7 @@ "h": 8, "w": 12, "x": 12, - "y": 36 + "y": 29 }, "hiddenSeries": false, "id": 18, @@ -879,7 +1370,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -889,6 +1380,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_delete_dentry\",job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -897,9 +1392,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "delete_dentry", "tooltip": { "shared": true, @@ -908,9 +1401,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -937,7 +1428,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -950,7 +1444,7 @@ "h": 8, "w": 12, "x": 0, - "y": 44 + "y": 37 }, "hiddenSeries": false, "id": 11, @@ -972,7 +1466,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -982,6 +1476,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_get_inode\",job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -990,9 +1488,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "get_inode", "tooltip": { "shared": true, @@ -1001,9 +1497,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -1030,7 +1524,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -1043,7 +1540,7 @@ "h": 8, "w": 12, "x": 12, - "y": 44 + "y": 37 }, "hiddenSeries": false, "id": 12, @@ -1065,7 +1562,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -1075,6 +1572,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_get_dentry\",job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -1083,9 +1584,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "get_dentry", "tooltip": { "shared": true, @@ -1094,9 +1593,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -1123,7 +1620,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -1136,7 +1636,7 @@ "h": 8, "w": 12, "x": 0, - "y": 52 + "y": 45 }, "hiddenSeries": false, "id": 19, @@ -1158,7 +1658,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -1168,6 +1668,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_batch_get_inode_attr\",job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -1176,9 +1680,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "batch_get_inode_attr", "tooltip": { "shared": true, @@ -1187,9 +1689,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -1216,7 +1716,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -1229,7 +1732,7 @@ "h": 8, "w": 12, "x": 12, - "y": 52 + "y": 45 }, "hiddenSeries": false, "id": 20, @@ -1251,7 +1754,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -1261,6 +1764,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_list_dentry\",job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -1269,9 +1776,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "list_dentry", "tooltip": { "shared": true, @@ -1280,9 +1785,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -1309,7 +1812,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -1322,7 +1828,7 @@ "h": 8, "w": 12, "x": 0, - "y": 60 + "y": 53 }, "hiddenSeries": false, "id": 21, @@ -1344,7 +1850,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -1354,6 +1860,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_update_inode\",job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -1362,9 +1872,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "update_inode", "tooltip": { "shared": true, @@ -1373,9 +1881,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -1402,7 +1908,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -1415,7 +1924,7 @@ "h": 8, "w": 12, "x": 12, - "y": 60 + "y": 53 }, "hiddenSeries": false, "id": 22, @@ -1437,7 +1946,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -1447,6 +1956,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_batch_get_xattr\",job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -1455,9 +1968,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "batch_get_xattr", "tooltip": { "shared": true, @@ -1466,9 +1977,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -1495,7 +2004,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -1508,7 +2020,7 @@ "h": 8, "w": 12, "x": 0, - "y": 68 + "y": 61 }, "hiddenSeries": false, "id": 23, @@ -1530,7 +2042,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -1540,6 +2052,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_prepare_rename_tx\", job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -1548,9 +2064,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "prepare_rename_tx", "tooltip": { "shared": true, @@ -1559,9 +2073,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -1588,7 +2100,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -1601,7 +2116,7 @@ "h": 8, "w": 12, "x": 12, - "y": 68 + "y": 61 }, "hiddenSeries": false, "id": 24, @@ -1623,7 +2138,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -1633,6 +2148,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_get_or_modify_s3_chunk_info\",job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -1641,9 +2160,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "get_or_modify_s3_chunk_info", "tooltip": { "shared": true, @@ -1652,9 +2169,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -1681,7 +2196,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -1694,7 +2212,7 @@ "h": 8, "w": 12, "x": 0, - "y": 76 + "y": 69 }, "hiddenSeries": false, "id": 25, @@ -1716,7 +2234,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -1726,6 +2244,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_create_partition\",job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -1734,9 +2256,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "create_partition", "tooltip": { "shared": true, @@ -1745,9 +2265,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -1774,7 +2292,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -1787,7 +2308,7 @@ "h": 8, "w": 12, "x": 12, - "y": 76 + "y": 69 }, "hiddenSeries": false, "id": 26, @@ -1809,7 +2330,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -1819,6 +2340,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_delete_partition\",job=\"metaserver\", instance=~\"$instance\", quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -1827,9 +2352,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "delete_partition", "tooltip": { "shared": true, @@ -1838,9 +2361,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -1867,7 +2388,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -1880,7 +2404,7 @@ "h": 8, "w": 12, "x": 0, - "y": 84 + "y": 77 }, "hiddenSeries": false, "id": 27, @@ -1902,7 +2426,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -1912,6 +2436,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_get_volume_extent\",job=\"metaserver\", instance=~\"$instance\",quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -1920,9 +2448,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "get_volume_extent", "tooltip": { "shared": true, @@ -1931,9 +2457,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -1960,7 +2484,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -1973,7 +2500,7 @@ "h": 8, "w": 12, "x": 12, - "y": 84 + "y": 77 }, "hiddenSeries": false, "id": 28, @@ -1995,7 +2522,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2005,6 +2532,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*curvefs_metaserver_meta_server_service_update_volume_extent\",job=\"metaserver\", instance=~\"$instance\",quantile=~\"[[service_quantile]]\"}", "interval": "", @@ -2013,9 +2544,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "update_volume_extent", "tooltip": { "shared": true, @@ -2024,9 +2553,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2049,17 +2576,29 @@ } } ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], "title": "service latency", "type": "row" }, { "collapsed": true, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 28 + "y": 5 }, "id": 34, "panels": [ @@ -2068,7 +2607,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "qps" @@ -2081,7 +2623,7 @@ "h": 8, "w": 8, "x": 0, - "y": 29 + "y": 13 }, "hiddenSeries": false, "id": 35, @@ -2103,7 +2645,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2113,6 +2655,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"op_apply_pool_[[pool:regex]]_copyset_[[copyset:regex]]_[[op:regex]]_qps\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -2121,9 +2667,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "op_qps", "tooltip": { "shared": true, @@ -2132,9 +2676,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2161,7 +2703,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "reqps" @@ -2174,7 +2719,7 @@ "h": 8, "w": 8, "x": 8, - "y": 29 + "y": 13 }, "hiddenSeries": false, "id": 36, @@ -2196,7 +2741,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2206,6 +2751,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"op_apply_pool_[[pool:regex]]_copyset_[[copyset:regex]]_[[op:regex]]_rps\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -2214,9 +2763,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "op_rps", "tooltip": { "shared": true, @@ -2225,9 +2772,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2254,7 +2799,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "eps" @@ -2267,7 +2815,7 @@ "h": 8, "w": 8, "x": 16, - "y": 29 + "y": 13 }, "hiddenSeries": false, "id": 37, @@ -2289,7 +2837,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2299,6 +2847,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"op_apply_pool_[[pool:regex]]_copyset_[[copyset:regex]]_[[op:regex]]_eps\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -2307,9 +2859,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "op_eps", "tooltip": { "shared": true, @@ -2318,9 +2868,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2347,7 +2895,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -2360,7 +2911,7 @@ "h": 8, "w": 8, "x": 0, - "y": 37 + "y": 21 }, "hiddenSeries": false, "id": 38, @@ -2382,7 +2933,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2392,6 +2943,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"op_apply_pool_[[pool:regex]]_copyset_[[copyset:regex]]_[[op:regex]]_[[quantile:regex]]\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -2400,9 +2955,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "op_apply_latency", "tooltip": { "shared": true, @@ -2411,9 +2964,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2440,7 +2991,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -2453,7 +3007,7 @@ "h": 8, "w": 8, "x": 8, - "y": 37 + "y": 21 }, "hiddenSeries": false, "id": 39, @@ -2475,7 +3029,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2485,6 +3039,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"op_apply_pool_[[pool:regex]]_copyset_[[copyset:regex]]_[[op:regex]]_execute_[[quantile:regex]]\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -2493,9 +3051,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "op_apply_execute_latency", "tooltip": { "shared": true, @@ -2504,9 +3060,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2533,7 +3087,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -2546,7 +3103,7 @@ "h": 8, "w": 8, "x": 16, - "y": 37 + "y": 21 }, "hiddenSeries": false, "id": 40, @@ -2568,7 +3125,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2578,6 +3135,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"op_apply_pool_[[pool:regex]]_copyset_[[copyset:regex]]_[[op:regex]]_wait_in_queue_[[quantile:regex]]\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -2586,9 +3147,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "op_apply_wait_in_queue_latency", "tooltip": { "shared": true, @@ -2597,9 +3156,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2622,17 +3179,29 @@ } } ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], "title": "raft op metric", "type": "row" }, { "collapsed": true, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 29 + "y": 6 }, "id": 42, "panels": [ @@ -2641,7 +3210,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -2654,7 +3226,7 @@ "h": 8, "w": 12, "x": 0, - "y": 30 + "y": 14 }, "hiddenSeries": false, "id": 43, @@ -2676,7 +3248,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2686,6 +3258,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"copyset_snapshot_[[quantile:regex]]\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -2694,9 +3270,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "copyset_snapshot_latency", "tooltip": { "shared": true, @@ -2705,9 +3279,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2734,7 +3306,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "short" @@ -2747,7 +3322,7 @@ "h": 8, "w": 12, "x": 12, - "y": 30 + "y": 14 }, "hiddenSeries": false, "id": 44, @@ -2769,7 +3344,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2779,6 +3354,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"copyset_snapshot_error_count\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -2787,9 +3366,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "copyset_snapshot_error_count", "tooltip": { "shared": true, @@ -2798,9 +3375,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2827,7 +3402,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "short" @@ -2840,7 +3418,7 @@ "h": 8, "w": 12, "x": 0, - "y": 38 + "y": 22 }, "hiddenSeries": false, "id": 45, @@ -2862,7 +3440,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2872,6 +3450,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"copyset_snapshot_flying_count\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -2880,9 +3462,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "copyset_snapshot_flying_count", "tooltip": { "shared": true, @@ -2891,9 +3471,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2916,17 +3494,29 @@ } } ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], "title": "raft snapshot metric", "type": "row" }, { "collapsed": true, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 30 + "y": 7 }, "id": 47, "panels": [ @@ -2935,7 +3525,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "short" @@ -2948,7 +3541,7 @@ "h": 8, "w": 12, "x": 0, - "y": 31 + "y": 15 }, "hiddenSeries": false, "id": 48, @@ -2970,7 +3563,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -2980,6 +3573,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"rocksdb_flushing\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -2988,9 +3585,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "rocksdb_flushing", "tooltip": { "shared": true, @@ -2999,9 +3594,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3028,7 +3621,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -3041,7 +3637,7 @@ "h": 8, "w": 12, "x": 12, - "y": 31 + "y": 15 }, "hiddenSeries": false, "id": 49, @@ -3063,7 +3659,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3073,6 +3669,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"rocksdb_flush_[[quantile:regex]]\", job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -3081,9 +3681,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "rocksdb_flush_latency", "tooltip": { "shared": true, @@ -3092,9 +3690,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3121,7 +3717,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "short" @@ -3134,7 +3733,7 @@ "h": 8, "w": 12, "x": 0, - "y": 39 + "y": 23 }, "hiddenSeries": false, "id": 50, @@ -3156,7 +3755,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3166,6 +3765,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"rocksdb_compacting\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -3174,9 +3777,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "rocksdb_compacting", "tooltip": { "shared": true, @@ -3185,9 +3786,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3214,7 +3813,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -3227,7 +3829,7 @@ "h": 8, "w": 12, "x": 12, - "y": 39 + "y": 23 }, "hiddenSeries": false, "id": 51, @@ -3249,7 +3851,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3259,6 +3861,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"rocksdb_compaction_[[quantile:regex]]\", job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -3267,9 +3873,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "rocksdb_compaction_latency", "tooltip": { "shared": true, @@ -3278,9 +3882,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3307,7 +3909,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "short" @@ -3320,7 +3925,7 @@ "h": 8, "w": 8, "x": 0, - "y": 47 + "y": 31 }, "hiddenSeries": false, "id": 52, @@ -3342,7 +3947,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3352,6 +3957,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"rocksdb_sealed_memtable\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -3360,9 +3969,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "rocksdb_sealed_memtable", "tooltip": { "shared": true, @@ -3371,9 +3978,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3400,7 +4005,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "short" @@ -3413,7 +4021,7 @@ "h": 8, "w": 8, "x": 8, - "y": 47 + "y": 31 }, "hiddenSeries": false, "id": 53, @@ -3435,7 +4043,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3445,6 +4053,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"rocksdb_delayed_write\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -3453,9 +4065,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "rocksdb_delayed_write", "tooltip": { "shared": true, @@ -3464,9 +4074,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3493,7 +4101,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "short" @@ -3506,7 +4117,7 @@ "h": 8, "w": 8, "x": 16, - "y": 47 + "y": 31 }, "hiddenSeries": false, "id": 54, @@ -3528,7 +4139,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3538,6 +4149,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"rocksdb_stopped_write\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -3546,9 +4161,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "rocksdb_stopped_write", "tooltip": { "shared": true, @@ -3557,9 +4170,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3582,17 +4193,29 @@ } } ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], "title": "rocksdb metric", "type": "row" }, { "collapsed": true, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 31 + "y": 8 }, "id": 56, "panels": [ @@ -3601,7 +4224,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "short" @@ -3614,7 +4240,7 @@ "h": 8, "w": 12, "x": 0, - "y": 32 + "y": 16 }, "hiddenSeries": false, "id": 57, @@ -3636,7 +4262,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3646,6 +4272,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"raft_apply_tasks_batch_avg_counter\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -3653,6 +4283,10 @@ "refId": "A" }, { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"raft_apply_tasks_batch_counter_.*\",job=\"metaserver\", instance=~\"$instance\"}", "hide": false, @@ -3662,9 +4296,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "raft_apply_tasks_batch_counter", "tooltip": { "shared": true, @@ -3673,9 +4305,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3702,7 +4332,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "short" @@ -3715,7 +4348,7 @@ "h": 8, "w": 12, "x": 12, - "y": 32 + "y": 16 }, "hiddenSeries": false, "id": 59, @@ -3737,7 +4370,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3747,6 +4380,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"raft_send_entries_batch_avg_counter\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -3754,6 +4391,10 @@ "refId": "A" }, { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"raft_send_entries_batch_counter_.*\",job=\"metaserver\", instance=~\"$instance\"}", "hide": false, @@ -3763,9 +4404,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "raft_send_entries_batch_counter", "tooltip": { "shared": true, @@ -3774,9 +4413,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3803,7 +4440,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "qps" @@ -3816,7 +4456,7 @@ "h": 8, "w": 12, "x": 0, - "y": 40 + "y": 24 }, "hiddenSeries": false, "id": 61, @@ -3838,7 +4478,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3848,6 +4488,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"raft_send_entries_qps\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -3856,9 +4500,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "raft_send_entries_qps", "tooltip": { "shared": true, @@ -3867,9 +4509,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3896,7 +4536,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -3909,7 +4552,7 @@ "h": 8, "w": 12, "x": 12, - "y": 40 + "y": 24 }, "hiddenSeries": false, "id": 60, @@ -3931,7 +4574,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -3941,6 +4584,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"raft_send_entries_[[quantile:regex]]\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -3949,9 +4596,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "raft_send_entries_latency", "tooltip": { "shared": true, @@ -3960,9 +4605,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3989,7 +4632,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "qps" @@ -4002,7 +4648,7 @@ "h": 8, "w": 12, "x": 0, - "y": 48 + "y": 32 }, "hiddenSeries": false, "id": 62, @@ -4024,7 +4670,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -4034,6 +4680,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*raft_service_append_entries_qps\",job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -4042,9 +4692,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "raft_service_append_entries_qps", "tooltip": { "shared": true, @@ -4053,9 +4701,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -4082,7 +4728,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -4095,7 +4744,7 @@ "h": 8, "w": 12, "x": 12, - "y": 48 + "y": 32 }, "hiddenSeries": false, "id": 63, @@ -4117,7 +4766,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -4127,6 +4776,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*raft_service_append_entries\", job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -4135,9 +4788,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "raft_service_append_entries_latency", "tooltip": { "shared": true, @@ -4146,9 +4797,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -4175,7 +4824,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -4188,7 +4840,7 @@ "h": 8, "w": 12, "x": 0, - "y": 56 + "y": 40 }, "hiddenSeries": false, "id": 64, @@ -4210,7 +4862,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -4220,6 +4872,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*raft_storage_append_entries_[[quantile:regex]]\", job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -4228,9 +4884,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "raft_storage_append_entries_latency", "tooltip": { "shared": true, @@ -4239,9 +4893,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -4268,7 +4920,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "µs" @@ -4281,7 +4936,7 @@ "h": 8, "w": 12, "x": 12, - "y": 56 + "y": 40 }, "hiddenSeries": false, "id": 65, @@ -4303,7 +4958,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -4313,6 +4968,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"raft_storage_append_entries_normalized_[[quantile:regex]]\", job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -4321,9 +4980,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "raft_storage_append_entries_normalized_latency", "tooltip": { "shared": true, @@ -4332,9 +4989,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -4361,7 +5016,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "short" @@ -4374,7 +5032,7 @@ "h": 8, "w": 12, "x": 0, - "y": 64 + "y": 48 }, "hiddenSeries": false, "id": 66, @@ -4396,7 +5054,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -4406,6 +5064,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"raft_storage_flush_batch_avg_counter\", job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -4413,6 +5075,10 @@ "refId": "A" }, { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"raft_storage_flush_batch_counter_[[quantile:regex]]\", job=\"metaserver\", instance=~\"$instance\"}", "hide": false, @@ -4422,9 +5088,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "raft_storage_flush_batch_counter", "tooltip": { "shared": true, @@ -4433,9 +5097,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -4462,7 +5124,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "short" @@ -4475,7 +5140,7 @@ "h": 8, "w": 12, "x": 12, - "y": 64 + "y": 48 }, "hiddenSeries": false, "id": 67, @@ -4497,7 +5162,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "8.0.6", + "pluginVersion": "10.1.4", "pointradius": 2, "points": false, "renderer": "flot", @@ -4507,6 +5172,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\"raft_num_log_entries\", job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -4515,9 +5184,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "raft_num_log_entries", "tooltip": { "shared": true, @@ -4526,9 +5193,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -4555,7 +5220,10 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "fieldConfig": { "defaults": { "unit": "qps" @@ -4568,7 +5236,7 @@ "h": 8, "w": 12, "x": 0, - "y": 72 + "y": 56 }, "hiddenSeries": false, "id": 68, @@ -4600,6 +5268,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "exemplar": true, "expr": "{__name__=~\".*raft_service_install_snapshot_qps\", job=\"metaserver\", instance=~\"$instance\"}", "interval": "", @@ -4608,9 +5280,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "raft_service_install_snapshot_qps", "tooltip": { "shared": true, @@ -4619,9 +5289,7 @@ }, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -4644,20 +5312,28 @@ } } ], + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "refId": "A" + } + ], "title": "raft builtin metric", "type": "row" } ], - "refresh": "", - "schemaVersion": 30, + "refresh": "5s", + "schemaVersion": 38, "style": "dark", "tags": [], "templating": { "list": [ { - "allValue": null, "current": { - "selected": false, + "selected": true, "text": [ "All" ], @@ -4665,10 +5341,11 @@ "$__all" ] }, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "definition": "{__name__=~\"bthread_count\", job=\"metaserver\"}", - "description": null, - "error": null, "hide": 0, "includeAll": true, "label": "Addr", @@ -4686,9 +5363,8 @@ "type": "query" }, { - "allValue": null, "current": { - "selected": false, + "selected": true, "text": [ "All" ], @@ -4696,10 +5372,11 @@ "$__all" ] }, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "definition": "{__name__=~\"op_apply_pool_.*_copyset.*create_inode_count\", job=\"metaserver\"}", - "description": null, - "error": null, "hide": 0, "includeAll": true, "label": "pool", @@ -4717,9 +5394,8 @@ "type": "query" }, { - "allValue": null, "current": { - "selected": false, + "selected": true, "text": [ "All" ], @@ -4727,10 +5403,11 @@ "$__all" ] }, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "definition": "{__name__=~\".*copyset_.*_create_inode_count\", job=\"metaserver\"}", - "description": null, - "error": null, "hide": 0, "includeAll": true, "label": "copyset", @@ -4750,7 +5427,7 @@ { "allValue": "", "current": { - "selected": false, + "selected": true, "text": [ "latency" ], @@ -4758,10 +5435,11 @@ "latency" ] }, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "definition": "{__name__=~\".*(latency_[0-9]*|latency)\", job=\"metaserver\"}", - "description": null, - "error": null, "hide": 0, "includeAll": true, "label": "latency_quantile", @@ -4779,9 +5457,8 @@ "type": "query" }, { - "allValue": null, "current": { - "selected": false, + "selected": true, "text": [ "All" ], @@ -4789,10 +5466,11 @@ "$__all" ] }, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "definition": "{__name__=~\".*curvefs_metaserver_meta_server_service_.*_qps\", job=\"metaserver\"}", - "description": null, - "error": null, "hide": 0, "includeAll": true, "label": "op", @@ -4812,7 +5490,7 @@ { "allValue": "", "current": { - "selected": false, + "selected": true, "text": [ "1" ], @@ -4820,10 +5498,11 @@ "1" ] }, - "datasource": null, + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, "definition": "{__name__=~\".*curvefs_metaserver_meta_server_service.*\", job=\"metaserver\"}", - "description": null, - "error": null, "hide": 0, "includeAll": true, "label": "service_quantile", @@ -4851,4 +5530,4 @@ "title": "metaserver", "uid": "d12ivuiVz", "version": 8 -} +} \ No newline at end of file diff --git a/curvefs/monitor/target_json.py b/curvefs/monitor/target_json.py index 3b36e2e617..ebb726229d 100644 --- a/curvefs/monitor/target_json.py +++ b/curvefs/monitor/target_json.py @@ -11,6 +11,7 @@ CURVEFS_TOOL = "curvefs_tool" JSON_PATH = "/tmp/topology.json" +PLUGIN_PATH = "plugin" HOSTNAME_PORT_REGEX = r"[^\"\ ]\S*:\d+" IP_PORT_REGEX = r"[0-9]+(?:\.[0-9]+){3}:\d+" @@ -97,6 +98,16 @@ def unitValue(lables, targets): unit["targets"] = targets return unit +def loadPlugin(): + # load *.json file in plugin dir + # merge to one json + data = [] + for filename in os.listdir(PLUGIN_PATH): + if filename.endswith('.json'): + with open(os.path.join(PLUGIN_PATH, filename)) as f: + plugin_data = json.load(f) + data.append(unitValue(plugin_data["labels"], plugin_data["targets"]) + return data def refresh(): targets = [] @@ -113,6 +124,8 @@ def refresh(): # load client client = loadClient() targets.append(client) + plugin = loadPlugin() + targets += plugin with open(targetPath+'.new', 'w', 0o777) as fd: json.dump(targets, fd, indent=4) diff --git a/curvefs/proto/mds.proto b/curvefs/proto/mds.proto index eebec8ee34..a3c6ca1c26 100644 --- a/curvefs/proto/mds.proto +++ b/curvefs/proto/mds.proto @@ -105,6 +105,10 @@ message FsInfo { optional uint32 recycleTimeHour =15; } +message FsUsage { + optional uint64 usedBytes = 1; +} + message GetFsInfoResponse { required FSStatusCode statusCode = 1; optional FsInfo fsInfo = 2; @@ -145,16 +149,14 @@ message UmountFsResponse { required FSStatusCode statusCode = 1; } -/* UpdateFsInfoRequest comment now message UpdateFsInfoRequest { required string fsName = 1; - // todo + optional uint64 capacity = 2; } + message UpdateFsInfoResponse { required FSStatusCode statusCode = 1; - optional FsInfo fsInfo = 2; } -*/ message DeleteFsRequest { required string fsName = 1; @@ -182,17 +184,24 @@ message ListClusterFsInfoResponse { repeated FsInfo fsInfo = 1; } +message FsDelta { + optional int64 bytes = 1; +} + message RefreshSessionRequest { repeated topology.PartitionTxId txIds = 1; // used for client timeout required string fsName = 2; required Mountpoint mountpoint = 3; + optional FsDelta fsDelta = 4; } message RefreshSessionResponse { required FSStatusCode statusCode = 1; repeated topology.PartitionTxId latestTxIdList = 2; optional bool enableSumInDir = 3; + optional uint64 fsCapacity = 4; + optional uint64 fsUsedBytes = 5; } message DLockValue { @@ -232,7 +241,7 @@ service MdsService { rpc UmountFs(UmountFsRequest) returns (UmountFsResponse); // TODO(chengyi01): move to GetFssInfo rpc GetFsInfo(GetFsInfoRequest) returns (GetFsInfoResponse); - // rpc UpdateFsInfo(UpdateFsInfoRequest) returns (UpdateFsInfoResponse); + rpc UpdateFsInfo(UpdateFsInfoRequest) returns (UpdateFsInfoResponse); rpc DeleteFs(DeleteFsRequest) returns (DeleteFsResponse); rpc AllocateS3Chunk(AllocateS3ChunkRequest) returns (AllocateS3ChunkResponse); rpc ListClusterFsInfo (ListClusterFsInfoRequest) returns (ListClusterFsInfoResponse); diff --git a/curvefs/sdk/.clang-format b/curvefs/sdk/.clang-format new file mode 100644 index 0000000000..47a38a93f2 --- /dev/null +++ b/curvefs/sdk/.clang-format @@ -0,0 +1,2 @@ +DisableFormat: true +SortIncludes: Never diff --git a/curvefs/sdk/README.md b/curvefs/sdk/README.md new file mode 100644 index 0000000000..c58aa8feba --- /dev/null +++ b/curvefs/sdk/README.md @@ -0,0 +1,18 @@ +Hadoop SDK +=== + +How to build +--- + +``` bash +$ git clone git@github.com:opencurve/curve.git +$ cd curve +$ make dep stor=fs +$ make sdk +``` + +It will generate a jar after build success: + +``` +Build SDK success => /curve/curvefs/sdk/output/curvefs-hadoop-1.0-SNAPSHOT.jar +``` diff --git a/curvefs/sdk/java/native/BUILD b/curvefs/sdk/java/native/BUILD new file mode 100644 index 0000000000..3361aeea44 --- /dev/null +++ b/curvefs/sdk/java/native/BUILD @@ -0,0 +1,36 @@ +# +# Copyright (c) 2023 NetEase Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +load("//:copts.bzl", "CURVE_DEFAULT_COPTS") + +cc_binary( + name = "curvefs_jni", + srcs = glob([ + "*.h", + "*.cpp", + ]), + visibility = ["//visibility:public"], + copts = CURVE_DEFAULT_COPTS, + linkopts = [ + "-Wl,-rpath=/tmp/libcurvefs,--disable-new-dtags", + ], + deps = [ + "@com_google_absl//absl/cleanup", + "@jni//:copy_jni_hdr_lib", + "//curvefs/sdk/libcurvefs:curvefs_lib", + ], + linkshared = True, +) diff --git a/curvefs/sdk/java/native/io_opencurve_curve_fs_libfs_CurveFSMount.cpp b/curvefs/sdk/java/native/io_opencurve_curve_fs_libfs_CurveFSMount.cpp new file mode 100644 index 0000000000..d9c0abed81 --- /dev/null +++ b/curvefs/sdk/java/native/io_opencurve_curve_fs_libfs_CurveFSMount.cpp @@ -0,0 +1,688 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-08 + * Author: Jingli Chen (Wine93) + */ + +#include +#include + +#include "absl/cleanup/cleanup.h" +#include "curvefs/sdk/libcurvefs/libcurvefs.h" +#include "curvefs/sdk/java/native/io_opencurve_curve_fs_libfs_CurveFSMount.h" + +/* Cached field IDs for io.opencurve.curve.fs.CurveStat */ +static jfieldID curvestat_mode_fid; +static jfieldID curvestat_uid_fid; +static jfieldID curvestat_gid_fid; +static jfieldID curvestat_size_fid; +static jfieldID curvestat_blksize_fid; +static jfieldID curvestat_blocks_fid; +static jfieldID curvestat_a_time_fid; +static jfieldID curvestat_m_time_fid; +static jfieldID curvestat_is_file_fid; +static jfieldID curvestat_is_directory_fid; +static jfieldID curvestat_is_symlink_fid; + +/* Cached field IDs for io.opencurve.curve.fs.CurveStatVFS */ +static jfieldID curvestatvfs_bsize_fid; +static jfieldID curvestatvfs_frsize_fid; +static jfieldID curvestatvfs_blocks_fid; +static jfieldID curvestatvfs_bavail_fid; +static jfieldID curvestatvfs_files_fid; +static jfieldID curvestatvfs_fsid_fid; +static jfieldID curvestatvfs_namemax_fid; + +/* + * Setup cached field IDs + */ +static void setup_field_ids(JNIEnv* env) { + jclass curvestat_cls; + jclass curvestatvfs_cls; + +/* + * Get a fieldID from a class with a specific type + * + * clz: jclass + * field: field in clz + * type: integer, long, etc.. + * + * This macro assumes some naming convention that is used + * only in this file: + * + * GETFID(curvestat, mode, I) gets translated into + * curvestat_mode_fid = env->GetFieldID(curvestat_cls, "mode", "I"); + */ +#define GETFID(clz, field, type) do { \ + clz ## _ ## field ## _fid = env->GetFieldID(clz ## _cls, #field, #type); \ + if (!clz ## _ ## field ## _fid) \ + return; \ + } while (0) + + /* Cache CurveStat fields */ + + curvestat_cls = env->FindClass("io/opencurve/curve/fs/libfs/CurveFSStat"); + if (!curvestat_cls) { + return; + } + + GETFID(curvestat, mode, I); + GETFID(curvestat, uid, I); + GETFID(curvestat, gid, I); + GETFID(curvestat, size, J); + GETFID(curvestat, blksize, J); + GETFID(curvestat, blocks, J); + GETFID(curvestat, a_time, J); + GETFID(curvestat, m_time, J); + GETFID(curvestat, is_file, Z); + GETFID(curvestat, is_directory, Z); + GETFID(curvestat, is_symlink, Z); + + /* Cache CurveStatVFS fields */ + + curvestatvfs_cls = + env->FindClass("io/opencurve/curve/fs/libfs/CurveFSStatVFS"); + if (!curvestatvfs_cls) { + return; + } + + GETFID(curvestatvfs, bsize, J); + GETFID(curvestatvfs, frsize, J); + GETFID(curvestatvfs, blocks, J); + GETFID(curvestatvfs, bavail, J); + GETFID(curvestatvfs, files, J); + GETFID(curvestatvfs, fsid, J); + GETFID(curvestatvfs, namemax, J); + +#undef GETFID +} + +static void fill_curvestat(JNIEnv* env, + jobject j_curvestat, + struct stat* stat) { + env->SetIntField(j_curvestat, curvestat_mode_fid, stat->st_mode); + env->SetIntField(j_curvestat, curvestat_uid_fid, stat->st_uid); + env->SetIntField(j_curvestat, curvestat_gid_fid, stat->st_gid); + env->SetLongField(j_curvestat, curvestat_size_fid, stat->st_size); + env->SetLongField(j_curvestat, curvestat_blksize_fid, stat->st_blksize); + env->SetLongField(j_curvestat, curvestat_blocks_fid, stat->st_blocks); + + // mtime + uint64_t time = stat->st_mtim.tv_sec; + time *= 1000; + time += stat->st_mtim.tv_nsec / 1000000; + env->SetLongField(j_curvestat, curvestat_m_time_fid, time); + + // atime + time = stat->st_atim.tv_sec; + time *= 1000; + time += stat->st_atim.tv_nsec / 1000000; + env->SetLongField(j_curvestat, curvestat_a_time_fid, time); + + env->SetBooleanField(j_curvestat, curvestat_is_file_fid, + S_ISREG(stat->st_mode) ? JNI_TRUE : JNI_FALSE); + + env->SetBooleanField(j_curvestat, curvestat_is_directory_fid, + S_ISDIR(stat->st_mode) ? JNI_TRUE : JNI_FALSE); + + env->SetBooleanField(j_curvestat, curvestat_is_symlink_fid, + S_ISLNK(stat->st_mode) ? JNI_TRUE : JNI_FALSE); +} + +static void fill_curvestatvfs(JNIEnv* env, + jobject j_curvestatvfs, + struct statvfs st) { + env->SetLongField(j_curvestatvfs, curvestatvfs_bsize_fid, st.f_bsize); + env->SetLongField(j_curvestatvfs, curvestatvfs_frsize_fid, st.f_frsize); + env->SetLongField(j_curvestatvfs, curvestatvfs_blocks_fid, st.f_blocks); + env->SetLongField(j_curvestatvfs, curvestatvfs_bavail_fid, st.f_bavail); + env->SetLongField(j_curvestatvfs, curvestatvfs_files_fid, st.f_files); + env->SetLongField(j_curvestatvfs, curvestatvfs_fsid_fid, st.f_fsid); + env->SetLongField(j_curvestatvfs, curvestatvfs_namemax_fid, st.f_namemax); +} + +/* Map io_opencurve_curve_fs_libfs_CurveFSMount_O_* open flags to values in libc */ +static inline uint32_t fixup_open_flags(jint jflags) { + uint32_t flags = 0; + +#define FIXUP_OPEN_FLAG(name) \ + if (jflags & io_opencurve_curve_fs_libfs_CurveFSMount_##name) \ + flags |= name; + + FIXUP_OPEN_FLAG(O_RDONLY) + FIXUP_OPEN_FLAG(O_RDWR) + FIXUP_OPEN_FLAG(O_APPEND) + FIXUP_OPEN_FLAG(O_CREAT) + FIXUP_OPEN_FLAG(O_TRUNC) + FIXUP_OPEN_FLAG(O_EXCL) + FIXUP_OPEN_FLAG(O_WRONLY) + FIXUP_OPEN_FLAG(O_DIRECTORY) + +#undef FIXUP_OPEN_FLAG + + return flags; +} + +#define CURVEFS_SETATTR_MODE (1 << 0) +#define CURVEFS_SETATTR_UID (1 << 1) +#define CURVEFS_SETATTR_GID (1 << 2) +#define CURVEFS_SETATTR_SIZE (1 << 3) +#define CURVEFS_SETATTR_ATIME (1 << 4) +#define CURVEFS_SETATTR_MTIME (1 << 5) +#define CURVEFS_SETATTR_ATIME_NOW (1 << 7) +#define CURVEFS_SETATTR_MTIME_NOW (1 << 8) +#define CURVEFS_SETATTR_CTIME (1 << 10) + +/* Map JAVA_SETATTR_* to values in curve lib */ +static inline int fixup_attr_mask(jint jmask) { + int mask = 0; + +#define FIXUP_ATTR_MASK(name) \ + if (jmask & io_opencurve_curve_fs_libfs_CurveFSMount_##name) \ + mask |= CURVEFS_##name; + + FIXUP_ATTR_MASK(SETATTR_MODE) + FIXUP_ATTR_MASK(SETATTR_UID) + FIXUP_ATTR_MASK(SETATTR_GID) + FIXUP_ATTR_MASK(SETATTR_MTIME) + FIXUP_ATTR_MASK(SETATTR_ATIME) + +#undef FIXUP_ATTR_MASK + return mask; +} + +/* + * Exception throwing helper. Adapted from Apache Hadoop header + * org_apache_hadoop.h by adding the do {} while (0) construct. + */ +#define THROW(env, exception_name, message) \ + do { \ + jclass ecls = env->FindClass(exception_name); \ + if (ecls) { \ + int ret = env->ThrowNew(ecls, message); \ + if (ret < 0) { \ + printf("(CurveFS) Fatal Error\n"); \ + } \ + env->DeleteLocalRef(ecls); \ + } \ + } while (0) + +static void handle_error(JNIEnv* env, int rc) { + switch (rc) { + case ENOENT: + THROW(env, "java/io/FileNotFoundException", ""); + return; + case EEXIST: + THROW(env, "org/apache/hadoop/fs/FileAlreadyExistsException", ""); + return; + case ENOTDIR: + THROW(env, "org/apache/hadoop/fs/ParentNotDirectoryException", ""); + return; + default: + break; + } + + THROW(env, "java/io/IOException", strerror(rc)); +} + +// nativeCurveFSCreate: curvefs_create +JNIEXPORT jlong +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSCreate + (JNIEnv* env, jobject) { + setup_field_ids(env); + uintptr_t instance = curvefs_create(); + return reinterpret_cast(instance); +} + +// nativeCurveFSRelease: curvefs_release +JNIEXPORT void +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSRelease + (JNIEnv* env, jobject, jlong j_instance) { + uintptr_t instance = static_cast(j_instance); + return curvefs_release(instance); +} + +// nativeCurveFSConfSet: curvefs_conf_set +JNIEXPORT void +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSConfSet + (JNIEnv* env, jclass, jlong j_instance, jstring j_key, jstring j_value) { + uintptr_t instance = static_cast(j_instance); + const char* key = env->GetStringUTFChars(j_key, NULL); + const char* value = env->GetStringUTFChars(j_value, NULL); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseStringUTFChars(j_key, key); + env->ReleaseStringUTFChars(j_value, value); + }); + + return curvefs_conf_set(instance, key, value); +} + +// nativeCurveFSMount: curvefs_mount +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSMount + (JNIEnv* env, jclass, jlong j_instance, + jstring j_fsname, jstring j_mountpoint) { + uintptr_t instance = static_cast(j_instance); + const char* fsname = env->GetStringUTFChars(j_fsname, NULL); + const char* mountpoint = env->GetStringUTFChars(j_mountpoint, NULL); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseStringUTFChars(j_fsname, fsname); + env->ReleaseStringUTFChars(j_mountpoint, mountpoint); + }); + + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + handle_error(env, rc); + } + return rc; +} + +// nativeCurveFSUmount: curvefs_umount +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSUmount + (JNIEnv* env, jclass, jlong j_instance, + jstring j_fsname, jstring j_mountpoint) { + uintptr_t instance = static_cast(j_instance); + const char* fsname = env->GetStringUTFChars(j_fsname, NULL); + const char* mountpoint = env->GetStringUTFChars(j_mountpoint, NULL); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseStringUTFChars(j_fsname, fsname); + env->ReleaseStringUTFChars(j_mountpoint, mountpoint); + }); + + int rc = curvefs_umonut(instance, fsname, mountpoint); + if (rc != 0) { + handle_error(env, rc); + } + return rc; +} + +// nativeCurveFSMkDirs: curvefs_mkdirs +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSMkDirs + (JNIEnv* env, jclass, jlong j_instance, jstring j_path, jint j_mode) { + uintptr_t instance = static_cast(j_instance); + const char* path = env->GetStringUTFChars(j_path, NULL); + uint16_t mode = static_cast(j_mode); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseStringUTFChars(j_path, path); + }); + + int rc = curvefs_mkdirs(instance, path, mode); + if (rc == EEXIST) { + rc = 0; + } else if (rc != 0) { + handle_error(env, rc); + } + return rc; +} + +// nativeCurveFSRmDir: curvefs_rmdir +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSRmDir + (JNIEnv* env, jclass, jlong j_instance, jstring j_path) { + uintptr_t instance = static_cast(j_instance); + const char* path = env->GetStringUTFChars(j_path, NULL); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseStringUTFChars(j_path, path); + }); + + int rc = curvefs_rmdir(instance, path); + if (rc != 0) { + handle_error(env, rc); + } + return rc; +} + +// nativeCurveFSListDir: curvefs_opendir/curvefs_readdir/curvefs_closedir +JNIEXPORT jobjectArray +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSListDir + (JNIEnv* env, jclass, jlong j_instance, jstring j_path) { + uintptr_t instance = static_cast(j_instance); + const char* path = env->GetStringUTFChars(j_path, NULL); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseStringUTFChars(j_path, path); + }); + + // curvefs_opendir + dir_stream_t dir_stream; + auto rc = curvefs_opendir(instance, path, &dir_stream); + if (rc != 0) { + handle_error(env, rc); + return NULL; + } + + // curvefs_readdir + std::vector dirents; + dirent_t dirent; + for ( ;; ) { + ssize_t n = curvefs_readdir(instance, &dir_stream, &dirent); + if (n < 0) { + handle_error(env, rc); + return NULL; + } else if (n == 0) { + break; + } + dirents.push_back(dirent); + } + + // closedir + rc = curvefs_closedir(instance, &dir_stream); + if (rc != 0) { + handle_error(env, rc); + return NULL; + } + + // extract entry name + jobjectArray j_names = env->NewObjectArray( + dirents.size(), env->FindClass("java/lang/String"), NULL); + + for (int i = 0; i < dirents.size(); i++) { + jstring j_name = env->NewStringUTF(dirents[i].name); + env->SetObjectArrayElement(j_names, i, j_name); + env->DeleteLocalRef(j_name); + } + return j_names; +} + +// nativeCurveFSOpen: curvefs_open +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSOpen + (JNIEnv* env, jclass, + jlong j_instance, jstring j_path, jint j_flags, jint j_mode) { + uintptr_t instance = static_cast(j_instance); + const char* path = env->GetStringUTFChars(j_path, NULL); + uint32_t flags = fixup_open_flags(j_flags); + uint16_t mode = static_cast(j_mode); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseStringUTFChars(j_path, path); + }); + + int fd = curvefs_open(instance, path, flags, mode); + if (fd < 0) { + handle_error(env, fd); + } + return fd; +} + +// nativeCurveFSLSeek: curvefs_lseek +JNIEXPORT jlong +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSLSeek + (JNIEnv* env, jclass, + jlong j_instance, jint j_fd, jlong j_offset, jint j_whence) { + uintptr_t instance = static_cast(j_instance); + int fd = static_cast(j_fd); + uint64_t offset = static_cast(j_offset); + + int whence; + switch (j_whence) { + case io_opencurve_curve_fs_libfs_CurveFSMount_SEEK_SET: + whence = SEEK_SET; + break; + case io_opencurve_curve_fs_libfs_CurveFSMount_SEEK_CUR: + whence = SEEK_CUR; + break; + case io_opencurve_curve_fs_libfs_CurveFSMount_SEEK_END: + whence = SEEK_END; + break; + default: + return -1; + } + + int rc = curvefs_lseek(instance, fd, offset, whence); + if (rc != 0) { + handle_error(env, rc); + } + return rc; +} + +// nativieCurveFSRead: curvefs_read +JNIEXPORT jlong +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativieCurveFSRead + (JNIEnv* env, jclass, jlong j_instance, jint j_fd, + jbyteArray j_buffer, jlong j_size, jlong j_offset) { + uintptr_t instance = static_cast(j_instance); + int fd = static_cast(j_fd); + jbyte* c_buffer = env->GetByteArrayElements(j_buffer, NULL); + char* buffer = reinterpret_cast(c_buffer); + size_t count = static_cast(j_size); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseByteArrayElements(j_buffer, c_buffer, 0); + }); + + ssize_t n = curvefs_read(instance, fd, buffer, count); + if (n < 0) { + handle_error(env, n); + } + return static_cast(n); +} + +// nativieCurveFSWrite: curvefs_write +JNIEXPORT jlong +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativieCurveFSWrite + (JNIEnv* env, jclass, jlong j_instance, jint j_fd, + jbyteArray j_buffer, jlong j_size, jlong j_offset) { + uintptr_t instance = static_cast(j_instance); + int fd = static_cast(j_fd); + jbyte* c_buffer = env->GetByteArrayElements(j_buffer, NULL); + char* buffer = reinterpret_cast(c_buffer); + size_t count = static_cast(j_size); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseByteArrayElements(j_buffer, c_buffer, 0); + }); + + ssize_t n = curvefs_write(instance, fd, buffer, count); + if (n < 0) { + handle_error(env, n); + } + return static_cast(n); +} + +// nativeCurveFSFSync: curvefs_fsync +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSFSync + (JNIEnv* env, jclass, jlong j_instance, jint j_fd) { + uintptr_t instance = static_cast(j_instance); + int fd = static_cast(j_fd); + + int rc = curvefs_fsync(instance, fd); + if (rc != 0) { + handle_error(env, rc); + } + return rc; +} + +// nativeCurveFSClose: curvefs_close +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSClose + (JNIEnv* env, jclass, jlong j_instance, jint j_fd) { + uintptr_t instance = static_cast(j_instance); + int fd = static_cast(j_fd); + + int rc = curvefs_close(instance, fd); + if (rc != 0) { + handle_error(env, rc); + } + return rc; +} + +// nativeCurveFSUnlink: curvefs_unlink +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSUnlink + (JNIEnv* env, jclass, jlong j_instance, jstring j_path) { + uintptr_t instance = static_cast(j_instance); + const char* path = env->GetStringUTFChars(j_path, NULL); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseStringUTFChars(j_path, path); + }); + + int rc = curvefs_unlink(instance, path); + if (rc != 0) { + handle_error(env, rc); + } + return rc; +} + +// nativeCurveFSStatFs: curvefs_statfs +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSStatFs + (JNIEnv* env, jclass, + jlong j_instance, jobject j_curvestatvfs) { + uintptr_t instance = static_cast(j_instance); + + struct statvfs statvfs; + int rc = curvefs_statfs(instance, &statvfs); + if (rc != 0) { + handle_error(env, rc); + return rc; + } + + fill_curvestatvfs(env, j_curvestatvfs, statvfs); + return rc; +} + +// nativeCurveFSLstat: curvefs_lstat +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSLstat + (JNIEnv* env, jclass, + jlong j_instance, jstring j_path, jobject j_curvestat) { + uintptr_t instance = static_cast(j_instance); + const char* path = env->GetStringUTFChars(j_path, NULL); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseStringUTFChars(j_path, path); + }); + + // curvefs_lstat + struct stat stat; + auto rc = curvefs_lstat(instance, path, &stat); + if (rc != 0) { + handle_error(env, rc); + return rc; + } + + fill_curvestat(env, j_curvestat, &stat); + return rc; +} + +// nativeCurveFSFStat: curvefs_fstat +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSFStat + (JNIEnv* env, jclass, jlong j_instance, jint j_fd, jobject j_curvestat) { + uintptr_t instance = static_cast(j_instance); + int fd = static_cast(j_fd); + + // curvefs_fstat + struct stat stat; + auto rc = curvefs_fstat(instance, fd, &stat); + if (rc != 0) { + handle_error(env, rc); + return rc; + } + + fill_curvestat(env, j_curvestat, &stat); + return rc; +} + +// nativeCurveFSSetAttr: curvefs_setattr +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSSetAttr + (JNIEnv* env, jclass, + jlong j_instance, jstring j_path, jobject j_curvestat, jint j_mask) { + uintptr_t instance = static_cast(j_instance); + const char* path = env->GetStringUTFChars(j_path, NULL); + int to_set = fixup_attr_mask(j_mask); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseStringUTFChars(j_path, path); + }); + + struct stat stat; + memset(&stat, 0, sizeof(stat)); + stat.st_mode = env->GetIntField(j_curvestat, curvestat_mode_fid); + stat.st_uid = env->GetIntField(j_curvestat, curvestat_uid_fid); + stat.st_gid = env->GetIntField(j_curvestat, curvestat_gid_fid); + uint64_t mtime_msec = env->GetLongField(j_curvestat, curvestat_m_time_fid); + uint64_t atime_msec = env->GetLongField(j_curvestat, curvestat_a_time_fid); + stat.st_mtim.tv_sec = mtime_msec / 1000; + stat.st_mtim.tv_nsec = (mtime_msec % 1000) * 1000000; + stat.st_atim.tv_sec = atime_msec / 1000; + stat.st_atim.tv_nsec = (atime_msec % 1000) * 1000000; + + int rc = curvefs_setattr(instance, path, &stat, to_set); + if (rc != 0) { + handle_error(env, rc); + } + return rc; +} + +// nativeCurveFSChmod: curvefs_chmod +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSChmod + (JNIEnv* env, jclass, jlong j_instance, jstring j_path, jint j_mode) { + uintptr_t instance = static_cast(j_instance); + uint16_t mode = static_cast(j_mode); + const char* path = env->GetStringUTFChars(j_path, NULL); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseStringUTFChars(j_path, path); + }); + + int rc = curvefs_chmod(instance, path, mode); + if (rc != 0) { + handle_error(env, rc); + } + return rc; +} + +// nativeCurveFSChown: curvefs_chown +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSChown + (JNIEnv* env, jclass, + jlong j_instance, jstring j_path, jint j_uid, jint j_gid) { + uintptr_t instance = static_cast(j_instance); + uint32_t uid = static_cast(j_uid); + uint32_t gid = static_cast(j_gid); + const char* path = env->GetStringUTFChars(j_path, NULL); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseStringUTFChars(j_path, path); + }); + + int rc = curvefs_chown(instance, path, uid, gid); + if (rc != 0) { + handle_error(env, rc); + } + return rc; +} + +// nativeCurveFSRename: curvefs_rename +JNIEXPORT jint +JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSRename + (JNIEnv* env, jclass, jlong j_instance, jstring j_src, jstring j_dst) { + uintptr_t instance = static_cast(j_instance); + const char* src = env->GetStringUTFChars(j_src, NULL); + const char* dst = env->GetStringUTFChars(j_dst, NULL); + auto defer = absl::MakeCleanup([&]() { + env->ReleaseStringUTFChars(j_src, src); + env->ReleaseStringUTFChars(j_dst, dst); + }); + + int rc = curvefs_rename(instance, src, dst); + if (rc != 0) { + handle_error(env, rc); + } + return rc; +} diff --git a/curvefs/sdk/java/native/io_opencurve_curve_fs_libfs_CurveFSMount.h b/curvefs/sdk/java/native/io_opencurve_curve_fs_libfs_CurveFSMount.h new file mode 100644 index 0000000000..05d0a21e3f --- /dev/null +++ b/curvefs/sdk/java/native/io_opencurve_curve_fs_libfs_CurveFSMount.h @@ -0,0 +1,221 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class io_opencurve_curve_fs_libfs_CurveFSMount */ + +#ifndef _Included_io_opencurve_curve_fs_libfs_CurveFSMount +#define _Included_io_opencurve_curve_fs_libfs_CurveFSMount +#ifdef __cplusplus +extern "C" { +#endif +#undef io_opencurve_curve_fs_libfs_CurveFSMount_O_RDONLY +#define io_opencurve_curve_fs_libfs_CurveFSMount_O_RDONLY 1L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_O_RDWR +#define io_opencurve_curve_fs_libfs_CurveFSMount_O_RDWR 2L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_O_APPEND +#define io_opencurve_curve_fs_libfs_CurveFSMount_O_APPEND 4L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_O_CREAT +#define io_opencurve_curve_fs_libfs_CurveFSMount_O_CREAT 8L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_O_TRUNC +#define io_opencurve_curve_fs_libfs_CurveFSMount_O_TRUNC 16L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_O_EXCL +#define io_opencurve_curve_fs_libfs_CurveFSMount_O_EXCL 32L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_O_WRONLY +#define io_opencurve_curve_fs_libfs_CurveFSMount_O_WRONLY 64L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_O_DIRECTORY +#define io_opencurve_curve_fs_libfs_CurveFSMount_O_DIRECTORY 128L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_SEEK_SET +#define io_opencurve_curve_fs_libfs_CurveFSMount_SEEK_SET 0L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_SEEK_CUR +#define io_opencurve_curve_fs_libfs_CurveFSMount_SEEK_CUR 1L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_SEEK_END +#define io_opencurve_curve_fs_libfs_CurveFSMount_SEEK_END 2L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_SETATTR_MODE +#define io_opencurve_curve_fs_libfs_CurveFSMount_SETATTR_MODE 1L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_SETATTR_UID +#define io_opencurve_curve_fs_libfs_CurveFSMount_SETATTR_UID 2L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_SETATTR_GID +#define io_opencurve_curve_fs_libfs_CurveFSMount_SETATTR_GID 4L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_SETATTR_MTIME +#define io_opencurve_curve_fs_libfs_CurveFSMount_SETATTR_MTIME 8L +#undef io_opencurve_curve_fs_libfs_CurveFSMount_SETATTR_ATIME +#define io_opencurve_curve_fs_libfs_CurveFSMount_SETATTR_ATIME 16L +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSCreate + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSCreate + (JNIEnv *, jobject); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSRelease + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSRelease + (JNIEnv *, jobject, jlong); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSConfSet + * Signature: (JLjava/lang/String;Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSConfSet + (JNIEnv *, jclass, jlong, jstring, jstring); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSMount + * Signature: (JLjava/lang/String;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSMount + (JNIEnv *, jclass, jlong, jstring, jstring); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSUmount + * Signature: (JLjava/lang/String;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSUmount + (JNIEnv *, jclass, jlong, jstring, jstring); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSMkDirs + * Signature: (JLjava/lang/String;I)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSMkDirs + (JNIEnv *, jclass, jlong, jstring, jint); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSRmDir + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSRmDir + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSListDir + * Signature: (JLjava/lang/String;)[Ljava/lang/String; + */ +JNIEXPORT jobjectArray JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSListDir + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSOpen + * Signature: (JLjava/lang/String;II)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSOpen + (JNIEnv *, jclass, jlong, jstring, jint, jint); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSLSeek + * Signature: (JIJI)J + */ +JNIEXPORT jlong JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSLSeek + (JNIEnv *, jclass, jlong, jint, jlong, jint); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativieCurveFSRead + * Signature: (JI[BJJ)J + */ +JNIEXPORT jlong JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativieCurveFSRead + (JNIEnv *, jclass, jlong, jint, jbyteArray, jlong, jlong); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativieCurveFSWrite + * Signature: (JI[BJJ)J + */ +JNIEXPORT jlong JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativieCurveFSWrite + (JNIEnv *, jclass, jlong, jint, jbyteArray, jlong, jlong); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSFSync + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSFSync + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSClose + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSClose + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSUnlink + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSUnlink + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSStatFs + * Signature: (JLio/opencurve/curve/fs/libfs/CurveFSStatVFS;)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSStatFs + (JNIEnv *, jclass, jlong, jobject); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSLstat + * Signature: (JLjava/lang/String;Lio/opencurve/curve/fs/libfs/CurveFSStat;)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSLstat + (JNIEnv *, jclass, jlong, jstring, jobject); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSFStat + * Signature: (JILio/opencurve/curve/fs/libfs/CurveFSStat;)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSFStat + (JNIEnv *, jclass, jlong, jint, jobject); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSSetAttr + * Signature: (JLjava/lang/String;Lio/opencurve/curve/fs/libfs/CurveFSStat;I)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSSetAttr + (JNIEnv *, jclass, jlong, jstring, jobject, jint); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSChmod + * Signature: (JLjava/lang/String;I)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSChmod + (JNIEnv *, jclass, jlong, jstring, jint); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSChown + * Signature: (JLjava/lang/String;II)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSChown + (JNIEnv *, jclass, jlong, jstring, jint, jint); + +/* + * Class: io_opencurve_curve_fs_libfs_CurveFSMount + * Method: nativeCurveFSRename + * Signature: (JLjava/lang/String;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_io_opencurve_curve_fs_libfs_CurveFSMount_nativeCurveFSRename + (JNIEnv *, jclass, jlong, jstring, jstring); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/curvefs/sdk/java/pom.xml b/curvefs/sdk/java/pom.xml new file mode 100644 index 0000000000..b3f15f585c --- /dev/null +++ b/curvefs/sdk/java/pom.xml @@ -0,0 +1,92 @@ + + + + 4.0.0 + + io.opencurve.curve.fs.hadoop + curvefs-hadoop + 1.0-SNAPSHOT + + + 8 + 8 + UTF-8 + 2.7.3 + 0.80.5 + 1.15.4 + + + + + ali-maven + http://maven.aliyun.com/nexus/content/groups/public + + + + + + + native/build + + + + + + + net.java.dev.jna + jna-platform + 4.0.0 + + + + org.apache.hadoop + hadoop-common + ${hadoop.version} + provided + + + + org.apache.commons + commons-compress + 1.24.0 + + + + org.apache.flink + flink-hadoop-fs + ${flink.version} + provided + + + + org.apache.flink + flink-core + ${flink.version} + provided + + + + junit + junit + 4.13.1 + test + + + + org.apache.flink + flink-connector-files + ${flink.version} + provided + + + + org.apache.flink + flink-table-common + 1.15.4 + provided + + + + diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/flink/CurveFileSystemFactory.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/flink/CurveFileSystemFactory.java new file mode 100644 index 0000000000..ac42dfaf82 --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/flink/CurveFileSystemFactory.java @@ -0,0 +1,48 @@ +package io.opencurve.curve.fs.flink; + +import io.opencurve.curve.fs.hadoop.CurveFileSystem; +import org.apache.flink.core.fs.FileSystem; +import org.apache.flink.core.fs.FileSystemFactory; +import org.apache.flink.runtime.fs.hdfs.HadoopFileSystem; +import org.apache.hadoop.conf.Configuration; + +import java.io.IOException; +import java.net.URI; + +public class CurveFileSystemFactory implements FileSystemFactory { + private org.apache.hadoop.conf.Configuration conf; + + private static final String CURVE_FS_CONFIG_PREFIXES = "curvefs."; + private static final String FLINK_CONFIG_PREFIXES = "fs."; + public static String SCHEME = "curvefs"; + + @Override + public void configure(org.apache.flink.configuration.Configuration config) { + conf = new Configuration(); + if (config != null) { + for (String key : config.keySet()) { + if (key.startsWith(CURVE_FS_CONFIG_PREFIXES) || key.startsWith(FLINK_CONFIG_PREFIXES)) { + String value = config.getString(key, null); + if (value != null) { + if (CurveFileSystem.class.getCanonicalName().equals(value.trim())) { + SCHEME = key.split("\\.")[1]; + } + conf.set(key, value); + } + } + } + } + } + + @Override + public String getScheme() { + return SCHEME; + } + + @Override + public FileSystem create(URI uri) throws IOException { + CurveFileSystem fs = new CurveFileSystem(); + fs.initialize(uri, conf); + return new HadoopFileSystem(fs); + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/flink/CurveFileSystemTableFactory.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/flink/CurveFileSystemTableFactory.java new file mode 100644 index 0000000000..da68151bbd --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/flink/CurveFileSystemTableFactory.java @@ -0,0 +1,10 @@ +package io.opencurve.curve.fs.flink; + +import org.apache.flink.connector.file.table.FileSystemTableFactory; + +public class CurveFileSystemTableFactory extends FileSystemTableFactory { + @Override + public String factoryIdentifier() { + return CurveFileSystemFactory.SCHEME; + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFS.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFS.java new file mode 100644 index 0000000000..f15008a363 --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFS.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-01 + * Author: NetEase Media Bigdata + */ + +package io.opencurve.curve.fs.hadoop; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.AbstractFileSystem; +import org.apache.hadoop.fs.DelegateToFileSystem; +import io.opencurve.curve.fs.flink.CurveFileSystemFactory; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +/** + * The CurveFS implementation of AbstractFileSystem. + * This impl delegates to the old FileSystem + */ +public class CurveFS extends DelegateToFileSystem { + /** + * This constructor has the signature needed by + * {@link AbstractFileSystem#createFileSystem(URI, Configuration)}. + * + * @param theUri which must be that of localFs + * @param conf + * @throws IOException + * @throws URISyntaxException + */ + CurveFS(final URI theUri, final Configuration conf) throws IOException, + URISyntaxException { + super(theUri, new CurveFileSystem(conf), conf, CurveFileSystemFactory.SCHEME, true); + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFSInputStream.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFSInputStream.java new file mode 100644 index 0000000000..2dd1be8d1d --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFSInputStream.java @@ -0,0 +1,251 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-01 + * Author: NetEase Media Bigdata + */ + +package io.opencurve.curve.fs.hadoop; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FSInputStream; +import io.opencurve.curve.fs.libfs.CurveFSMount; + +import java.io.IOException; + +/** + *

+ * An {@link FSInputStream} for a CurveFileSystem and corresponding + * Curve instance. + */ +public class CurveFSInputStream extends FSInputStream { + private static final Log LOG = LogFactory.getLog(CurveFSInputStream.class); + private boolean closed; + + private int fileHandle; + + private long fileLength; + + private CurveFSProto curve; + + private byte[] buffer; + private int bufPos = 0; + private int bufValid = 0; + private long curvePos = 0; + + /** + * Create a new CurveInputStream. + * @param conf The system configuration. Unused. + * @param fh The filehandle provided by Curve to reference. + * @param flength The current length of the file. If the length changes + * you will need to close and re-open it to access the new data. + */ + public CurveFSInputStream(Configuration conf, CurveFSProto curvefs, + int fh, long flength, int bufferSize) { + // Whoever's calling the constructor is responsible for doing the actual curve_open + // call and providing the file handle. + fileLength = flength; + fileHandle = fh; + closed = false; + curve = curvefs; + buffer = new byte[1<<21]; + LOG.debug("CurveInputStream constructor: initializing stream with fh " + + fh + " and file length " + flength); + } + + /** Curve likes things to be closed before it shuts down, + * so closing the IOStream stuff voluntarily in a finalizer is good + */ + protected void finalize() throws Throwable { + try { + if (!closed) { + close(); + } + } finally { + super.finalize(); + } + } + + private synchronized boolean fillBuffer() throws IOException { + bufValid = curve.read(fileHandle, buffer, buffer.length, -1); + bufPos = 0; + if (bufValid < 0) { + int err = bufValid; + + bufValid = 0; + + // attempt to reset to old position. If it fails, too bad. + curve.lseek(fileHandle, curvePos, CurveFSMount.SEEK_SET); + throw new IOException("Failed to fill read buffer! Error code:" + err); + } + curvePos += bufValid; + return (bufValid != 0); + } + + /* + * Get the current position of the stream. + */ + public synchronized long getPos() throws IOException { + return curvePos - bufValid + bufPos; + } + + /** + * Find the number of bytes remaining in the file. + */ + @Override + public synchronized int available() throws IOException { + if (closed) { + throw new IOException("file is closed"); + } + return (int) (fileLength - getPos()); + } + + public synchronized void seek(long targetPos) throws IOException { + LOG.trace("CurveInputStream.seek: Seeking to position " + targetPos + " on fd " + + fileHandle); + if (targetPos > fileLength) { + throw new IOException("CurveInputStream.seek: failed seek to position " + + targetPos + " on fd " + fileHandle + + ": Cannot seek after EOF " + fileLength); + } + long oldPos = curvePos; + + curvePos = curve.lseek(fileHandle, targetPos, CurveFSMount.SEEK_SET); + bufValid = 0; + bufPos = 0; + if (curvePos < 0) { + curvePos = oldPos; + throw new IOException("Curve failed to seek to new position!"); + } + } + + /** + * Failovers are handled by the Curve code at a very low level; + * if there are issues that can be solved by changing sources + * they'll be dealt with before anybody even tries to call this method! + * @return false. + */ + public synchronized boolean seekToNewSource(long targetPos) { + return false; + } + + /** + * Read a byte from the file. + * @return the next byte. + */ + @Override + public synchronized int read() throws IOException { + LOG.trace( + "CurveInputStream.read: Reading a single byte from fd " + fileHandle + + " by calling general read function"); + + byte result[] = new byte[1]; + + if (getPos() >= fileLength) { + return -1; + } + + if (-1 == read(result, 0, 1)) { + return -1; + } + + if (result[0] < 0) { + return 256 + (int) result[0]; + } else { + return result[0]; + } + } + + /** + * Read a specified number of bytes from the file into a byte[]. + * @param buf the byte array to read into. + * @param off the offset to start at in the file + * @param len the number of bytes to read + * @return 0 if successful, otherwise an error code. + * @throws IOException on bad input. + */ + @Override + public synchronized int read(byte buf[], int off, int len) throws IOException { + LOG.trace( + "CurveInputStream.read: Reading " + len + " bytes from fd " + fileHandle); + + if (closed) { + throw new IOException( + "CurveInputStream.read: cannot read " + len + " bytes from fd " + + fileHandle + ": stream closed"); + } + + // ensure we're not past the end of the file + if (getPos() >= fileLength) { + LOG.debug( + "CurveInputStream.read: cannot read " + len + " bytes from fd " + + fileHandle + ": current position is " + getPos() + + " and file length is " + fileLength); + + return -1; + } + + int totalRead = 0; + int initialLen = len; + int read; + + do { + read = Math.min(len, bufValid - bufPos); + try { + System.arraycopy(buffer, bufPos, buf, off, read); + } catch (IndexOutOfBoundsException ie) { + throw new IOException( + "CurveInputStream.read: Indices out of bounds:" + "read length is " + + len + ", buffer offset is " + off + ", and buffer size is " + + buf.length); + } catch (ArrayStoreException ae) { + throw new IOException( + "Uh-oh, CurveInputStream failed to do an array" + + "copy due to type mismatch..."); + } catch (NullPointerException ne) { + throw new IOException( + "CurveInputStream.read: cannot read " + len + "bytes from fd:" + + fileHandle + ": buf is null"); + } + bufPos += read; + len -= read; + off += read; + totalRead += read; + } while (len > 0 && fillBuffer()); + + LOG.trace( + "CurveInputStream.read: Reading " + initialLen + " bytes from fd " + + fileHandle + ": succeeded in reading " + totalRead + " bytes"); + return totalRead; + } + + /** + * Close the CurveInputStream and release the associated filehandle. + */ + @Override + public void close() throws IOException { + LOG.trace("CurveOutputStream.close:enter"); + if (!closed) { + curve.close(fileHandle); + closed = true; + LOG.trace("CurveOutputStream.close:exit"); + } + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFSOutputStream.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFSOutputStream.java new file mode 100644 index 0000000000..06855bcd7d --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFSOutputStream.java @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-01 + * Author: NetEase Media Bigdata + */ + +package io.opencurve.curve.fs.hadoop; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.conf.Configuration; +import io.opencurve.curve.fs.libfs.CurveFSMount; + +import java.io.IOException; +import java.io.OutputStream; + +/** + *

+ * An {@link OutputStream} for a CurveFileSystem and corresponding + * Curve instance. + * + * TODO: + * - When libcurvefs-jni supports ByteBuffer interface we can get rid of the + * use of the buffer here to reduce memory copies and just use buffers in + * libcurvefs. Currently it might be useful to reduce JNI crossings, but not + * much more. + */ +public class CurveFSOutputStream extends OutputStream { + private boolean closed; + + private CurveFSProto curve; + + private int fileHandle; + + private byte[] buffer; + private int bufUsed = 0; + + /** + * Construct the CurveOutputStream. + * @param conf The FileSystem configuration. + * @param fh The Curve filehandle to connect to. + */ + public CurveFSOutputStream(Configuration conf, CurveFSProto curvefs, + int fh, int bufferSize) { + curve = curvefs; + fileHandle = fh; + closed = false; + buffer = new byte[1<<21]; + } + + /** + * Close the Curve file handle if close() wasn't explicitly called. + */ + protected void finalize() throws Throwable { + try { + if (!closed) { + close(); + } + } finally { + super.finalize(); + } + } + + /** + * Ensure that the stream is opened. + */ + private synchronized void checkOpen() throws IOException { + if (closed) { + throw new IOException("operation on closed stream (fd=" + fileHandle + ")"); + } + } + + /** + * Get the current position in the file. + * @return The file offset in bytes. + */ + public synchronized long getPos() throws IOException { + checkOpen(); + return curve.lseek(fileHandle, 0, CurveFSMount.SEEK_CUR); + } + + @Override + public synchronized void write(int b) throws IOException { + byte buf[] = new byte[1]; + buf[0] = (byte) b; + write(buf, 0, 1); + } + + @Override + public synchronized void write(byte buf[], int off, int len) throws IOException { + checkOpen(); + + while (len > 0) { + int remaining = Math.min(len, buffer.length - bufUsed); + System.arraycopy(buf, off, buffer, bufUsed, remaining); + + bufUsed += remaining; + off += remaining; + len -= remaining; + + if (buffer.length == bufUsed) { + flushBuffer(); + } + } + } + + /* + * Moves data from the buffer into libcurvefs. + */ + private synchronized void flushBuffer() throws IOException { + if (bufUsed == 0) { + return; + } + + while (bufUsed > 0) { + int ret = curve.write(fileHandle, buffer, bufUsed, -1); + if (ret < 0) { + throw new IOException("curve.write: ret=" + ret); + } + + if (ret == bufUsed) { + bufUsed = 0; + return; + } + + assert(ret > 0); + assert(ret < bufUsed); + + /* + * TODO: handle a partial write by shifting the remainder of the data in + * the buffer back to the beginning and retrying the write. It would + * probably be better to use a ByteBuffer 'view' here, and I believe + * using a ByteBuffer has some other performance benefits but we'll + * likely need to update the libcurvefs-jni implementation. + */ + int remaining = bufUsed - ret; + System.arraycopy(buffer, ret, buffer, 0, remaining); + bufUsed -= ret; + } + + assert(bufUsed == 0); + } + + @Override + public synchronized void flush() throws IOException { + checkOpen(); + flushBuffer(); // buffer -> libcurvefs + curve.fsync(fileHandle); // libcurvefs -> cluster + } + + @Override + public synchronized void close() throws IOException { + checkOpen(); + flush(); + curve.close(fileHandle); + closed = true; + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFSProto.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFSProto.java new file mode 100644 index 0000000000..df8ab69b21 --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFSProto.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-01 + * Author: NetEase Media Bigdata + */ + +package io.opencurve.curve.fs.hadoop; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.Path; +import io.opencurve.curve.fs.libfs.CurveFSStat; +import io.opencurve.curve.fs.libfs.CurveFSStatVFS; + +import java.io.IOException; +import java.net.URI; + +abstract class CurveFSProto { + // init* + abstract void initialize(URI uri, Configuration conf) throws IOException; + abstract void shutdown() throws IOException; + // directory* + abstract void mkdirs(Path path, int mode) throws IOException; + abstract void rmdir(Path path) throws IOException; + abstract String[] listdir(Path path) throws IOException; + // file* + abstract int open(Path path, int flags, int mode) throws IOException; + abstract long lseek(int fd, long offset, int whence) throws IOException; + abstract int write(int fd, byte[] buf, long size, long offset) throws IOException; + abstract int read(int fd, byte[] buf, long size, long offset) throws IOException; + abstract void fsync(int fd) throws IOException; + abstract void close(int fd) throws IOException; + abstract void unlink(Path path) throws IOException; + // others + abstract void statfs(Path path, CurveFSStatVFS stat) throws IOException; + abstract void lstat(Path path, CurveFSStat stat) throws IOException; + abstract void fstat(int fd, CurveFSStat stat) throws IOException; + abstract void setattr(Path path, CurveFSStat stat, int mask) throws IOException; + abstract void chmod(Path path, int mode) throws IOException; + abstract void chown(Path path, int uid, int gid) throws IOException; + abstract void rename(Path src, Path dst) throws IOException; +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFSTalker.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFSTalker.java new file mode 100644 index 0000000000..90366cc210 --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFSTalker.java @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-01 + * Author: NetEase Media Bigdata + */ + +package io.opencurve.curve.fs.hadoop; + +import org.apache.commons.logging.Log; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.Path; +import io.opencurve.curve.fs.libfs.CurveFSMount; +import io.opencurve.curve.fs.libfs.CurveFSStat; +import io.opencurve.curve.fs.libfs.CurveFSStatVFS; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.URI; +import java.util.Map; + +class CurveFSTalker extends CurveFSProto { + private CurveFSMount mount; + private String fsname = null; + private boolean inited = false; + + private static final String PREFIX_KEY = "curvefs"; + + CurveFSTalker(Configuration conf, Log log) { + mount = null; + } + + private String tostr(Path path) { + if (null == path) { + return "/"; + } + return path.toUri().getPath(); + } + + private void loadCfg(Configuration conf) { + Map m = conf.getValByRegex("^" + PREFIX_KEY + "\\..*"); + for (Map.Entry entry : m.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key.equals(PREFIX_KEY + ".name")) { + fsname = value; + } else { + mount.confSet(key.substring(PREFIX_KEY.length() + 1), value); + } + } + } + + @Override + void initialize(URI uri, Configuration conf) throws IOException { + mount = new CurveFSMount(); + loadCfg(conf); + if (null == fsname || fsname.isEmpty()) { + throw new IOException("curvefs.name is not set"); + } + mount.mount(fsname, "/"); + inited = true; + } + + @Override + void shutdown() throws IOException { + if (inited) { + mount.umount(fsname, "/"); + mount = null; + inited = false; + } + } + + @Override + void mkdirs(Path path, int mode) throws IOException { + mount.mkdirs(tostr(path), mode); + } + + @Override + void rmdir(Path path) throws IOException { + mount.rmdir(tostr(path)); + } + + @Override + String[] listdir(Path path) throws IOException { + CurveFSStat stat = new CurveFSStat(); + try { + mount.lstat(tostr(path), stat); + } catch (FileNotFoundException e) { + return null; + } + if (!stat.isDir()) { + return null; + } + + return mount.listdir(tostr(path)); + } + + @Override + int open(Path path, int flags, int mode) throws IOException { + return mount.open(tostr(path), flags, mode); + } + + @Override + long lseek(int fd, long offset, int whence) throws IOException { + return mount.lseek(fd, offset, whence); + } + + @Override + int write(int fd, byte[] buf, long size, long offset) throws IOException { + return mount.write(fd, buf, size, offset); + } + + @Override + int read(int fd, byte[] buf, long size, long offset) throws IOException { + return mount.read(fd, buf, size, offset); + } + + @Override + void fsync(int fd) throws IOException { + mount.fsync(fd); + } + + @Override + void close(int fd) throws IOException { + mount.close(fd); + } + + @Override + void unlink(Path path) throws IOException { + mount.unlink(tostr(path)); + } + + @Override + void statfs(Path path, CurveFSStatVFS stat) throws IOException { + mount.statfs(tostr(path), stat); + } + + @Override + void lstat(Path path, CurveFSStat stat) throws IOException { + mount.lstat(tostr(path), stat); + } + + @Override + void fstat(int fd, CurveFSStat stat) throws IOException { + mount.fstat(fd, stat); + } + + @Override + void setattr(Path path, CurveFSStat stat, int mask) throws IOException { + mount.setattr(tostr(path), stat, mask); + } + + @Override + void chmod(Path path, int mode) throws IOException { + mount.chmod(tostr(path), mode); + } + + @Override + void chown(Path path, int uid, int gid) throws IOException { + mount.chown(tostr(path), uid, gid); + } + + @Override + void rename(Path src, Path dst) throws IOException { + mount.rename(tostr(src), tostr(dst)); + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFileSystem.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFileSystem.java new file mode 100644 index 0000000000..09df042c1b --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/CurveFileSystem.java @@ -0,0 +1,388 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-01 + * Author: NetEase Media Bigdata + */ + +package io.opencurve.curve.fs.hadoop; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.*; +import org.apache.hadoop.fs.permission.FsPermission; +import org.apache.hadoop.util.Progressable; +import io.opencurve.curve.fs.libfs.CurveFSMount; +import io.opencurve.curve.fs.libfs.CurveFSStat; +import io.opencurve.curve.fs.libfs.CurveFSStatVFS; +import io.opencurve.curve.fs.hadoop.permission.Permission; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.OutputStream; +import java.net.URI; + +public class CurveFileSystem extends FileSystem { + private static final Log LOG = LogFactory.getLog(CurveFileSystem.class); + + private URI uri; + private Path workingDir; + private CurveFSProto curve = null; + private Permission perm = null; + + public CurveFileSystem() {} + + public CurveFileSystem(Configuration conf) { + setConf(conf); + } + + private Path makeAbsolute(Path path) { + if (path.isAbsolute()) { + return path; + } + return new Path(workingDir, path); + } + + public URI getUri() { + return uri; + } + + public String getScheme() { + return uri.getScheme(); + } + + @Override + public void initialize(URI uri, Configuration conf) throws IOException { + super.initialize(uri, conf); + + if (curve == null) { + curve = new CurveFSTalker(conf, LOG); + } + if (perm == null) { + perm = new Permission(); + } + + perm.initialize(conf); + curve.initialize(uri, conf); + setConf(conf); + this.uri = URI.create(uri.getScheme() + "://" + uri.getAuthority()); + this.workingDir = getHomeDirectory(); + } + + + public FSDataInputStream open(Path path, int bufferSize) throws IOException { + path = makeAbsolute(path); + + // throws filenotfoundexception if path is a directory + int fd = curve.open(path, CurveFSMount.O_RDONLY, 0); + + /* get file size */ + CurveFSStat stat = new CurveFSStat(); + curve.fstat(fd, stat); + + CurveFSInputStream istream = new CurveFSInputStream(getConf(), curve, fd, stat.size, bufferSize); + return new FSDataInputStream(istream); + } + + @Override + public void close() throws IOException { + super.close(); // this method does stuff, make sure it's run! + curve.shutdown(); + } + + public FSDataOutputStream append(Path path, int bufferSize, Progressable progress) throws IOException { + path = makeAbsolute(path); + + if (progress != null) { + progress.progress(); + } + + int fd = curve.open(path, CurveFSMount.O_WRONLY | CurveFSMount.O_APPEND, 0); + if (progress != null) { + progress.progress(); + } + + CurveFSOutputStream ostream = new CurveFSOutputStream(getConf(), curve, fd, bufferSize); + return new FSDataOutputStream(ostream, statistics); + } + + public Path getWorkingDirectory() { + return workingDir; + } + + @Override + public void setWorkingDirectory(Path dir) { + workingDir = makeAbsolute(dir); + } + + @Override + public boolean mkdirs(Path path, FsPermission perms) throws IOException { + path = makeAbsolute(path); + curve.mkdirs(path, (int) perms.toShort()); + return true; + } + + @Override + public boolean mkdirs(Path f) throws IOException { + FsPermission perms = FsPermission.getDirDefault().applyUMask(FsPermission.getUMask(getConf()));; + return mkdirs(f, perms); + } + + public FileStatus getFileStatus(Path path) throws IOException { + path = makeAbsolute(path); + + CurveFSStat stat = new CurveFSStat(); + curve.lstat(path, stat); + String owner = perm.getUsername(stat.uid);; + String group = perm.getGroupname(stat.gid);; + + FileStatus status = new FileStatus( + stat.size, stat.isDir(), 1, stat.blksize, + stat.m_time, stat.a_time, + new FsPermission((short) stat.mode), owner, group, + path.makeQualified(this)); + return status; + } + + + public FileStatus[] listStatus(Path path) throws IOException { + path = makeAbsolute(path); + + if (isFile(path)) { + return new FileStatus[]{getFileStatus(path)}; + } + + String[] dirlist = curve.listdir(path); + if (dirlist != null) { + FileStatus[] status = new FileStatus[dirlist.length]; + for (int i = 0; i < status.length; i++) { + status[i] = getFileStatus(new Path(path, dirlist[i])); + } + curve.shutdown(); + return status; + } else { + throw new FileNotFoundException("File " + path + " does not exist."); + } + + } + + @Override + public void setPermission(Path path, FsPermission permission) throws IOException { + path = makeAbsolute(path); + curve.chmod(path, permission.toShort()); + } + + @Override + public void setTimes(Path path, long mtime, long atime) throws IOException { + path = makeAbsolute(path); + + CurveFSStat stat = new CurveFSStat(); + + int mask = 0; + if (mtime != -1) { + stat.m_time = mtime; + mask |= CurveFSMount.SETATTR_MTIME; + } + + if (atime != -1) { + stat.a_time = atime; + mask |= CurveFSMount.SETATTR_ATIME; + } + + curve.setattr(path, stat, mask); + } + + public FSDataOutputStream create(Path path, FsPermission permission, boolean overwrite, int bufferSize, + short replication, long blockSize, Progressable progress) throws IOException { + + path = makeAbsolute(path); + + boolean exists = exists(path); + + if (progress != null) { + progress.progress(); + } + + int flags = CurveFSMount.O_WRONLY | CurveFSMount.O_CREAT; + + if (exists) { + if (overwrite) { + flags |= CurveFSMount.O_TRUNC; + } else { + throw new FileAlreadyExistsException(); + } + } else { + Path parent = path.getParent(); + if (parent != null) { + if (!mkdirs(parent)) { + throw new IOException("mkdirs failed for " + parent.toString()); + } + } + } + + if (progress != null) { + progress.progress(); + } + + int fd = curve.open(path, flags, (int) permission.toShort()); + + if (progress != null) { + progress.progress(); + } + + OutputStream ostream = new CurveFSOutputStream(getConf(), curve, fd, bufferSize); + return new FSDataOutputStream(ostream, statistics); + } + + @Override + public void setOwner(Path path, String username, String groupname) throws IOException { + CurveFSStat stat = new CurveFSStat(); + curve.lstat(path, stat); + + int uid = stat.uid; + int gid = stat.gid; + if (username != null) { + uid = perm.getUid(username); + } + if (groupname != null) { + gid = perm.getGid(groupname); + } + + curve.chown(path, uid, gid); + } + + @Deprecated + public FSDataOutputStream createNonRecursive(Path path, FsPermission permission, + boolean overwrite, + int bufferSize, short replication, long blockSize, + Progressable progress) throws IOException { + path = makeAbsolute(path); + + Path parent = path.getParent(); + + if (parent != null) { + CurveFSStat stat = new CurveFSStat(); + curve.lstat(parent, stat); // handles FileNotFoundException case + if (stat.isFile()) { + throw new FileAlreadyExistsException(parent.toString()); + } + } + + return this.create(path, permission, overwrite, + bufferSize, replication, blockSize, progress); + } + + @Override + public boolean rename(Path src, Path dst) throws IOException { + src = makeAbsolute(src); + dst = makeAbsolute(dst); + + try { + CurveFSStat stat = new CurveFSStat(); + curve.lstat(dst, stat); + if (stat.isDir()) { + return rename(src, new Path(dst, src.getName())); + } + return false; + } catch (FileNotFoundException e) { + } + + try { + curve.rename(src, dst); + } catch (FileNotFoundException e) { + throw e; + } catch (Exception e) { + return false; + } + return true; + } + + @Deprecated + public boolean delete(Path path) throws IOException { + return delete(path, false); + } + + public boolean delete(Path path, boolean recursive) throws IOException { + path = makeAbsolute(path); + + /* path exists? */ + FileStatus status; + try { + status = getFileStatus(path); + } catch (FileNotFoundException e) { + return false; + } + + /* we're done if its a file */ + if (status.isFile()) { + curve.unlink(path); + return true; + } + + /* get directory contents */ + FileStatus[] dirlist = listStatus(path); + if (dirlist == null) { + return false; + } + + if (!recursive && dirlist.length > 0) { + throw new IOException("Directory " + path.toString() + "is not empty."); + } + + for (FileStatus fs : dirlist) { + if (!delete(fs.getPath(), recursive)) { + return false; + } + } + + curve.rmdir(path); + return true; + } + + @Override + public FsStatus getStatus(Path p) throws IOException { + CurveFSStatVFS stat = new CurveFSStatVFS(); + curve.statfs(p, stat); + + FsStatus status = new FsStatus(stat.bsize * stat.blocks, + stat.bsize * (stat.blocks - stat.bavail), + stat.bsize * stat.bavail); + return status; + } + + @Override + public short getDefaultReplication() { + return 1; + } + + @Override + public long getDefaultBlockSize() { + return super.getDefaultBlockSize(); + } + + @Override + protected int getDefaultPort() { + return super.getDefaultPort(); + } + + @Override + public String getCanonicalServiceName() { + return null; // Does not support Token + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/Main.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/Main.java new file mode 100644 index 0000000000..d488e309dc --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/Main.java @@ -0,0 +1,7 @@ +package io.opencurve.curve.fs.hadoop; + +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/permission/Group.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/permission/Group.java new file mode 100644 index 0000000000..d1605a863a --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/permission/Group.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-01 + * Author: Xianfei Cao (caoxianfei1) + */ + +package io.opencurve.curve.fs.hadoop.permission; + +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.security.UserGroupInformation; + +import java.util.HashMap; +import java.io.IOException; +import java.util.List; + +public class Group { + private HashMap groupnames; + private HashMap groupIDs; + private UserGroupInformation ugi; + + private static final String SUPER_GROUPNAME = "supergroup"; + private static final int SUPER_GID = 0; + + public Group() { + groupnames = new HashMap(); + groupIDs = new HashMap(); + } + + private int finger(String groupname) { + return Math.abs(groupname.hashCode()); + } + + private void addGroup(String groupname, int gid) { + groupnames.put(groupname, gid); + groupIDs.put(gid, groupname); + } + + private void loadGroupFromSystem() throws IOException { + List groups = Helper.getAllGroups(); + for (Entry group : groups) { + if (group.id == 0) { + group.id = finger(group.name); + } + addGroup(group.name, group.id); + } + addGroup(SUPER_GROUPNAME, SUPER_GID); + } + + private void loadGroupFromFile() throws IOException { + // implement it + } + + public void initialize(Path path) throws IOException { + this.ugi = UserGroupInformation.getCurrentUser(); + if (path != null) { + loadGroupFromFile(); + } else { + loadGroupFromSystem(); + } + } + + public int[] getCurrentGids() { + String[] groups = {"nogroup"}; + if (ugi.getGroupNames().length > 0) { + groups = ugi.getGroupNames(); + } + + int[] gids = new int[groups.length]; + for (int i = 0; i < groups.length; i++) { + gids[i] = getGid(groups[i]); + } + return gids; + } + + public int getGid(String groupname) { + Integer gid = groupnames.get(groupname); + if (null == gid) { + gid = finger(groupname); + addGroup(groupname, gid); + } + return gid; + } + + public String getGroupname(int gid) { + String groupname = groupIDs.get(gid); + if (null == groupname || groupname.isEmpty()) { + return String.valueOf(gid); + } + return groupname; + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/permission/Helper.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/permission/Helper.java new file mode 100644 index 0000000000..fe505123aa --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/permission/Helper.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-01 + * Author: Xianfei Cao (caoxianfei1) + */ + +package io.opencurve.curve.fs.hadoop.permission; + +import com.sun.jna.Library; +import com.sun.jna.Native; +import com.sun.jna.Pointer; +import com.sun.jna.Structure; +import io.opencurve.curve.fs.hadoop.permission.Helper.CLibrary.passwd; +import io.opencurve.curve.fs.hadoop.permission.Helper.CLibrary.group; + +import java.util.Arrays; +import java.util.List; +import java.util.ArrayList; + +class Entry { + String name; + int id; + + public Entry(String name, int id) { + this.name = name; + this.id = id; + } +} + +public class Helper { + public interface CLibrary extends Library { + CLibrary INSTANCE = (CLibrary)Native.loadLibrary("c", CLibrary.class); + passwd getpwent(); + void endpwent(); + group getgrent(); + void endgrent(); + + public static class passwd extends Structure { + public String pw_name; + public String pw_passwd; + public int pw_uid; + public int pw_gid; + public String pw_gecos; + public String pw_dir; + public String pw_shell; + + protected List getFieldOrder() { + return Arrays.asList(new String[] { + "pw_name", "pw_passwd", "pw_uid", "pw_gid", "pw_gecos", "pw_dir", "pw_shell", + }); + } + } + + public static class group extends Structure { + public String gr_name; + public String gr_passwd; + public int gr_gid; + public Pointer gr_mem; + + protected List getFieldOrder() { + return Arrays.asList(new String[] { + "gr_name", "gr_passwd", "gr_gid", "gr_mem", + }); + } + } + } + + public static List getAllUsers() { + CLibrary lib = CLibrary.INSTANCE; + List users = new ArrayList(); + passwd usr = new passwd(); + while ((usr = lib.getpwent()) != null) { + users.add(new Entry(usr.pw_name, usr.pw_uid)); + } + lib.endpwent(); + return users; + } + + public static List getAllGroups() { + CLibrary lib = CLibrary.INSTANCE; + List groups = new ArrayList(); + group grp = new group(); + while ((grp = lib.getgrent()) != null) { + groups.add(new Entry(grp.gr_name, grp.gr_gid)); + } + lib.endgrent(); + return groups; + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/permission/Permission.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/permission/Permission.java new file mode 100644 index 0000000000..82ce9c52e0 --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/permission/Permission.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-01 + * Author: Xianfei Cao (caoxianfei1) + */ + +package io.opencurve.curve.fs.hadoop.permission; + +import org.apache.hadoop.conf.Configuration; + +import java.io.IOException; + +public class Permission { + private static User user = null; + private static Group group = null; + + public Permission() { + user = new User(); + group = new Group(); + } + + public void initialize(Configuration conf) throws IOException { + user.initialize(null); + group.initialize(null); + } + + public int getCurrentUid() { + return user.getCurrentUid(); + } + + public int getUid(String username) { + return user.getUid(username); + } + + public String getUsername(int uid) { + return user.getUsername(uid); + } + + public int[] getCurrentGids() { + return group.getCurrentGids(); + } + + public int getGid(String groupname) { + return group.getGid(groupname); + } + + public String getGroupname(int gid) { + return group.getGroupname(gid); + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/permission/User.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/permission/User.java new file mode 100644 index 0000000000..7b892caf53 --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/hadoop/permission/User.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-01 + * Author: Xianfei Cao (caoxianfei1) + */ + +package io.opencurve.curve.fs.hadoop.permission; + +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.security.UserGroupInformation; + +import java.util.HashMap; +import java.io.IOException; +import java.util.List; + +public class User { + private HashMap usernames; + private HashMap userIDs; + private UserGroupInformation ugi; + + private static final String SUPER_USERNAME = "hdfs"; + private static final int SUPER_UID = 0; + + public User() { + usernames = new HashMap(); + userIDs = new HashMap(); + } + + private int finger(String groupname) { + return Math.abs(groupname.hashCode()); + } + + private void addUser(String username, int uid) { + usernames.put(username, uid); + userIDs.put(uid, username); + } + + private void loadUserFromSystem() throws IOException { + List users = Helper.getAllUsers(); + for (Entry user : users) { + if (user.id == 0) { + user.id = finger(user.name); + } + addUser(user.name, user.id); + } + addUser(SUPER_USERNAME, SUPER_UID); + } + + private void loadUserFromFile() throws IOException { + // TODO: implement it + } + + public void initialize(Path path) throws IOException { + this.ugi = UserGroupInformation.getCurrentUser(); + if (path != null) { + loadUserFromFile(); + } else { + loadUserFromSystem(); + } + } + + public int getCurrentUid() { + String username = ugi.getShortUserName(); + return getUid(username); + } + + public int getUid(String username) { + Integer gid = usernames.get(username); + if (null == gid) { + gid = finger(username); + addUser(username, gid); + } + return gid; + } + + public String getUsername(int uid) { + String username = userIDs.get(uid); + if (null == username || username.isEmpty()) { + return String.valueOf(uid); + } + return username; + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/libfs/CurveFSMount.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/libfs/CurveFSMount.java new file mode 100644 index 0000000000..7b423dcc0f --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/libfs/CurveFSMount.java @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-07-07 + * Author: Jingli Chen (Wine93) + */ +package io.opencurve.curve.fs.libfs; + +import java.io.IOException; + +public class CurveFSMount { + // init + private native long nativeCurveFSCreate(); + private native void nativeCurveFSRelease(long instancePtr); + private static native void nativeCurveFSConfSet(long instancePtr, String key, String value); + private static native int nativeCurveFSMount(long instancePtr, String fsname, String mountpoint); + private static native int nativeCurveFSUmount(long instancePtr, String fsname, String mountpoint); + // dir* + private static native int nativeCurveFSMkDirs(long instancePtr, String path, int mode); + private static native int nativeCurveFSRmDir(long instancePtr, String path); + private static native String[] nativeCurveFSListDir(long instancePtr, String path); + // file* + private static native int nativeCurveFSOpen(long instancePtr, String path, int flags, int mode); + private static native long nativeCurveFSLSeek(long instancePtr, int fd, long offset, int whence); + private static native long nativieCurveFSRead(long instancePtr, int fd, byte[] buffer, long size, long offset); + private static native long nativieCurveFSWrite(long instancePtr, int fd, byte[] buffer, long size, long offset); + private static native int nativeCurveFSFSync(long instancePtr, int fd); + private static native int nativeCurveFSClose(long instancePtr, int fd); + private static native int nativeCurveFSUnlink(long instancePtr, String path); + // others + private static native int nativeCurveFSStatFs(long instancePtr, CurveFSStatVFS statvfs); + private static native int nativeCurveFSLstat(long instancePtr, String path, CurveFSStat stat); + private static native int nativeCurveFSFStat(long instancePtr, int fd, CurveFSStat stat); + private static native int nativeCurveFSSetAttr(long instancePtr, String path, CurveFSStat stat, int mask); + private static native int nativeCurveFSChmod(long instancePtr, String path, int mode); + private static native int nativeCurveFSChown(long instancePtr, String path, int uid, int gid); + private static native int nativeCurveFSRename(long instancePtr, String src, String dst); + + /* + * Flags for open(). + * + * Must be synchronized with JNI if changed. + */ + public static final int O_RDONLY = 1; + public static final int O_RDWR = 2; + public static final int O_APPEND = 4; + public static final int O_CREAT = 8; + public static final int O_TRUNC = 16; + public static final int O_EXCL = 32; + public static final int O_WRONLY = 64; + public static final int O_DIRECTORY = 128; + + /* + * Whence flags for seek(). + * + * Must be synchronized with JNI if changed. + */ + public static final int SEEK_SET = 0; + public static final int SEEK_CUR = 1; + public static final int SEEK_END = 2; + + /* + * Attribute flags for setattr(). + * + * Must be synchronized with JNI if changed. + */ + public static final int SETATTR_MODE = 1; + public static final int SETATTR_UID = 2; + public static final int SETATTR_GID = 4; + public static final int SETATTR_MTIME = 8; + public static final int SETATTR_ATIME = 16; + + private static final String CURVEFS_DEBUG_ENV_VAR = "CURVEFS_DEBUG"; + private static final String CLASS_NAME = "io.opencurve.curve.fs.CurveFSMount"; + + private long instancePtr; + + private static void accessLog(String name, String... args) { + String value = System.getenv(CURVEFS_DEBUG_ENV_VAR); + if (!Boolean.valueOf(value)) { + return; + } + + String params = String.join(",", args); + String message = String.format("%s.%s(%s)", CLASS_NAME, name, params); + System.out.println(message); + } + + static { + accessLog("loadLibrary"); + try { + CurveFSNativeLoader.getInstance().loadLibrary(); + } catch(Exception e) {} + } + + protected void finalize() throws Throwable { + accessLog("finalize"); + } + + public CurveFSMount() { + accessLog("CurveMount"); + instancePtr = nativeCurveFSCreate(); + } + + public void confSet(String key, String value) { + accessLog("confSet", key, value); + nativeCurveFSConfSet(instancePtr, key, value); + } + + public void mount(String fsname, String mountpoint) throws IOException { + accessLog("mount"); + nativeCurveFSMount(instancePtr, fsname, mountpoint); + } + + public void umount(String fsname, String mountpoint) throws IOException { + accessLog("umount"); + nativeCurveFSUmount(instancePtr, fsname, mountpoint); + } + + public void shutdown() throws IOException { + accessLog("shutdown"); + } + + // directory* + public void mkdirs(String path, int mode) throws IOException { + accessLog("mkdirs", path.toString()); + nativeCurveFSMkDirs(instancePtr, path, mode); + } + + public void rmdir(String path) throws IOException { + accessLog("rmdir", path.toString()); + nativeCurveFSRmDir(instancePtr, path); + } + + public String[] listdir(String path) throws IOException { + accessLog("listdir", path.toString()); + return nativeCurveFSListDir(instancePtr, path); + } + + // file* + public int open(String path, int flags, int mode) throws IOException { + accessLog("open", path.toString()); + return nativeCurveFSOpen(instancePtr, path, flags, mode); + } + + public long lseek(int fd, long offset, int whence) throws IOException { + accessLog("lseek", String.valueOf(fd), String.valueOf(offset), String.valueOf(whence)); + return nativeCurveFSLSeek(instancePtr, fd, offset, whence); + } + + public int read(int fd, byte[] buf, long size, long offset) throws IOException { + accessLog("read", String.valueOf(fd), String.valueOf(size), String.valueOf(size)); + long rc = nativieCurveFSRead(instancePtr, fd, buf, size, offset); + return (int) rc; + } + + public int write(int fd, byte[] buf, long size, long offset) throws IOException { + accessLog("write", String.valueOf(fd), String.valueOf(size), String.valueOf(size)); + long rc = nativieCurveFSWrite(instancePtr, fd, buf, size, offset); + return (int) rc; + } + + public void fsync(int fd) throws IOException { + accessLog("fsync", String.valueOf(fd)); + nativeCurveFSFSync(instancePtr, fd); + } + + public void close(int fd) throws IOException { + accessLog("close", String.valueOf(fd)); + nativeCurveFSClose(instancePtr, fd); + } + + public void unlink(String path) throws IOException { + accessLog("unlink", path.toString()); + nativeCurveFSUnlink(instancePtr, path); + } + + // others + public void statfs(String path, CurveFSStatVFS statvfs) throws IOException { + accessLog("statfs", path.toString()); + nativeCurveFSStatFs(instancePtr, statvfs); + } + + public void lstat(String path, CurveFSStat stat) throws IOException { + accessLog("lstat", path.toString()); + nativeCurveFSLstat(instancePtr, path, stat); + } + + public void fstat(int fd, CurveFSStat stat) throws IOException { + accessLog("fstat", String.valueOf(fd)); + nativeCurveFSFStat(instancePtr, fd, stat); + } + + public void setattr(String path, CurveFSStat stat, int mask) throws IOException { + accessLog("setattr", path.toString()); + nativeCurveFSSetAttr(instancePtr, path, stat, mask); + } + + public void chmod(String path, int mode) throws IOException { + accessLog("chmod", path.toString()); + nativeCurveFSChmod(instancePtr, path, mode); + } + + public void chown(String path, int uid, int gid) throws IOException { + accessLog("chown", path.toString(), String.valueOf(uid), String.valueOf(gid)); + nativeCurveFSChown(instancePtr, path, uid, gid); + } + + public void rename(String src, String dst) throws IOException { + accessLog("rename", src.toString(), dst.toString()); + nativeCurveFSRename(instancePtr, src, dst); + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/libfs/CurveFSNativeLoader.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/libfs/CurveFSNativeLoader.java new file mode 100644 index 0000000000..7ba7a535e8 --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/libfs/CurveFSNativeLoader.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-07-07 + * Author: Jingli Chen (Wine93) + */ + +package io.opencurve.curve.fs.libfs; + +import java.net.URL; +import java.net.URLConnection; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; + +import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; +import org.apache.commons.compress.archivers.ArchiveEntry; +import org.apache.commons.compress.utils.IOUtils; + +public class CurveFSNativeLoader { + boolean initialized = false; + private static final CurveFSNativeLoader instance = new CurveFSNativeLoader(); + + private static final String TMP_DIR = "/tmp"; + private static final String CURVEFS_LIBRARY_PATH = "/tmp/libcurvefs"; + private static final String RESOURCE_TAR_NAME = "libcurvefs.tar"; + private static final String JNI_LIBRARY_NAME = "libcurvefs_jni.so"; + + private CurveFSNativeLoader() {} + + public static CurveFSNativeLoader getInstance() { + return instance; + } + + public long getJarModifiedTime() throws IOException { + URL location = CurveFSNativeLoader.class.getProtectionDomain().getCodeSource().getLocation(); + URLConnection conn = location.openConnection(); + return conn.getLastModified(); + } + + public void descompress(InputStream in, String dest) throws IOException { + File dir = new File(dest); + if (!dir.exists()) { + dir.mkdirs(); + } + + ArchiveEntry entry; + TarArchiveInputStream reader = new TarArchiveInputStream(in); + while ((entry = reader.getNextTarEntry()) != null) { + if (entry.isDirectory()) { + continue; + } + + String path = TMP_DIR + File.separator + entry.getName(); + File file = new File(path); + IOUtils.copy(reader, new FileOutputStream(file)); + } + reader.close(); + } + + public void loadJniLibrary() throws IOException { + File libFile = new File(CURVEFS_LIBRARY_PATH, JNI_LIBRARY_NAME); + System.load(libFile.getAbsolutePath()); + } + + public synchronized void loadLibrary() throws IOException { + if (initialized) { + return; + } + + long jarModifiedTime = getJarModifiedTime(); + File libDir = new File(CURVEFS_LIBRARY_PATH); + if (libDir.exists() && libDir.lastModified() == jarModifiedTime) { + loadJniLibrary(); + initialized = true; + return; + } + + InputStream reader = CurveFSNativeLoader.class.getResourceAsStream("/" + RESOURCE_TAR_NAME); + if (reader == null) { + throw new IOException("Cannot get resource " + RESOURCE_TAR_NAME + " from Jar file."); + } + descompress(reader, CURVEFS_LIBRARY_PATH); + reader.close(); + + libDir.setLastModified(jarModifiedTime); + loadJniLibrary(); + initialized = true; + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/libfs/CurveFSStat.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/libfs/CurveFSStat.java new file mode 100644 index 0000000000..d188ca93f5 --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/libfs/CurveFSStat.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-07-07 + * Author: Jingli Chen (Wine93) + */ + +package io.opencurve.curve.fs.libfs; + +public class CurveFSStat { + public boolean is_file; /* S_ISREG */ + public boolean is_directory; /* S_ISDIR */ + public boolean is_symlink; /* S_ISLNK */ + + public int mode; + public int uid; + public int gid; + public long size; + public long blksize; + public long blocks; + public long a_time; + public long m_time; + + public boolean isFile() { + return is_file; + } + + public boolean isDir() { + return is_directory; + } + + public boolean isSymlink() { + return is_symlink; + } +} diff --git a/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/libfs/CurveFSStatVFS.java b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/libfs/CurveFSStatVFS.java new file mode 100644 index 0000000000..5ee2c1b8b0 --- /dev/null +++ b/curvefs/sdk/java/src/main/java/io/opencurve/curve/fs/libfs/CurveFSStatVFS.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-07-07 + * Author: Jingli Chen (Wine93) + */ + +package io.opencurve.curve.fs.libfs; + +public class CurveFSStatVFS { + public long bsize; + public long frsize; + public long blocks; + public long bavail; + public long files; + public long fsid; + public long namemax; +} diff --git a/curvefs/sdk/java/src/main/resources/META-INF/services/org.apache.flink.core.fs.FileSystemFactory b/curvefs/sdk/java/src/main/resources/META-INF/services/org.apache.flink.core.fs.FileSystemFactory new file mode 100644 index 0000000000..49f845958d --- /dev/null +++ b/curvefs/sdk/java/src/main/resources/META-INF/services/org.apache.flink.core.fs.FileSystemFactory @@ -0,0 +1 @@ +io.opencurve.curve.fs.flink.CurveFileSystemFactory diff --git a/curvefs/sdk/java/src/main/resources/META-INF/services/org.apache.flink.table.factories.Factory b/curvefs/sdk/java/src/main/resources/META-INF/services/org.apache.flink.table.factories.Factory new file mode 100644 index 0000000000..767cc341af --- /dev/null +++ b/curvefs/sdk/java/src/main/resources/META-INF/services/org.apache.flink.table.factories.Factory @@ -0,0 +1 @@ +io.opencurve.curve.fs.flink.CurveFileSystemTableFactory diff --git a/curvefs/sdk/java/src/test/java/io/opencurve/curve/fs/others/TestOthers.java b/curvefs/sdk/java/src/test/java/io/opencurve/curve/fs/others/TestOthers.java new file mode 100644 index 0000000000..754e6cc797 --- /dev/null +++ b/curvefs/sdk/java/src/test/java/io/opencurve/curve/fs/others/TestOthers.java @@ -0,0 +1,15 @@ +package io.opencurve.curve.fs.others; + +import junit.framework.TestCase; +import io.opencurve.curve.fs.hadoop.CurveFileSystem; + +import java.io.IOException; +import java.net.URL; + +public class TestOthers extends TestCase { + public void testHelloWorld() throws IOException { + URL location = CurveFileSystem.class.getProtectionDomain().getCodeSource().getLocation(); + System.out.println("Hello World"); + System.out.println(location.getPath()); + } +} diff --git a/curvefs/sdk/libcurvefs/BUILD b/curvefs/sdk/libcurvefs/BUILD new file mode 100644 index 0000000000..44f0f8c703 --- /dev/null +++ b/curvefs/sdk/libcurvefs/BUILD @@ -0,0 +1,44 @@ +# +# Copyright (c) 2023 NetEase Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +load("//:copts.bzl", "CURVE_DEFAULT_COPTS") + +cc_binary( + name = "curvefs", + srcs = [ + "libcurvefs.h", + "libcurvefs.cpp", + ], + copts = CURVE_DEFAULT_COPTS, + visibility = ["//visibility:public"], + deps = [ + "//curvefs/src/client/vfs:vfs", + ], + linkshared = True, +) + +cc_library( + name = "curvefs_lib", + srcs = [ + "libcurvefs.h", + "libcurvefs.cpp", + ], + copts = CURVE_DEFAULT_COPTS, + visibility = ["//visibility:public"], + deps = [ + "//curvefs/src/client/vfs:vfs", + ], +) diff --git a/curvefs/sdk/libcurvefs/README.md b/curvefs/sdk/libcurvefs/README.md new file mode 100644 index 0000000000..839fe28f20 --- /dev/null +++ b/curvefs/sdk/libcurvefs/README.md @@ -0,0 +1,29 @@ +libcurvefs +=== + +SDK C/C++ library for CurveFS. + +Example +=== + +```c +#include "libcurvefs.h" + +int instance = curvefs_create(); +curvefs_conf_set(instance, "s3.ak", "xxx") +curvefs_conf_set(instance, "s3.sk", "xxx") + +... + +int rc = curvefs_mount(instance, "fsname", "/); +if (rc != 0) { + // mount failed +} + +rc = curvefs_mkdir(instance_ptr, "/mydir") +if (rc != 0) { + // mkdir failed +} +``` + +See [examples](examples) for more examples. diff --git a/curvefs/sdk/libcurvefs/examples/Makefile b/curvefs/sdk/libcurvefs/examples/Makefile new file mode 100644 index 0000000000..2e4acf367d --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/Makefile @@ -0,0 +1,24 @@ +# Copyright (C) 2024 Jingli Chen (Wine93), NetEase Inc. + +root= $(shell echo $${PWD%/curvefs/sdk/libcurvefs/examples}) +so_path?= $(root)/bazel-bin/curvefs/sdk/libcurvefs +hrd_opt?= -I/curve +build_opt?= -L$(so_path) +link_opt?= -Wl,-rpath=$(so_path) -Wall +flags?= $(hrd_opt) $(build_opt) $(link_opt) +targets= mkdir rmdir ls touch read write unlink append rename stat statfs fstat chmod + +libcurvefs: + mkdir -p bin + bazel build \ + --config=gcc7-later \ + --compilation_mode=opt \ + --copt -g \ + --copt -DUNINSTALL_SIGSEGV=1 \ + --copt -DCLIENT_CONF_PATH="\"$(root)/curvefs/conf/client.conf\"" \ + //curvefs/sdk/java/native:curvefs_jni + +$(targets): libcurvefs + gcc ${flags} $@.c -o bin/$@ -lcurvefs + +all: $(targets) diff --git a/curvefs/sdk/libcurvefs/examples/append.c b/curvefs/sdk/libcurvefs/examples/append.c new file mode 100644 index 0000000000..79aaa3f41b --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/append.c @@ -0,0 +1,48 @@ +#include + +#include "common.h" + +int +main(int argc, char** argv) { + exact_args(argc, 2); + + uintptr_t instance = curvefs_create(); + load_cfg_from_environ(instance); + + char* fsname = get_filesystem_name(); + char* mountpoint = get_mountpoint(); + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + fprintf(stderr, "mount failed: retcode = %d\n", rc); + return rc; + } + + int fd = curvefs_open(instance, argv[1], O_WRONLY, 0777); + if (fd != 0) { + rc = fd; + fprintf(stderr, "open failed: retcode = %d\n", rc); + return rc; + } + + rc = curvefs_lseek(instance, fd, 0, SEEK_END); + if (rc != 0) { + fprintf(stderr, "lseek failed: retcode = %d\n", rc); + return rc; + } + + ssize_t n = curvefs_write(instance, fd, argv[2], strlen(argv[2])); + if (n < 0) { + rc = n; + fprintf(stderr, "write failed: retcode = %d\n", rc); + return rc; + } else if (n != strlen(argv[2])) { + fprintf(stderr, "write failed: %zd != %zu\n", n, strlen(argv[2])); + return -1; + } + + rc = curvefs_close(instance, fd); + if (rc != 0) { + fprintf(stderr, "close failed: retcode = %d\n", rc); + } + return 0; +} diff --git a/curvefs/sdk/libcurvefs/examples/chmod.c b/curvefs/sdk/libcurvefs/examples/chmod.c new file mode 100644 index 0000000000..f6da02ee77 --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/chmod.c @@ -0,0 +1,24 @@ +#include "common.h" + +int +main(int argc, char** argv) { + exact_args(argc, 2); + + uintptr_t instance = curvefs_create(); + load_cfg_from_environ(instance); + + char* fsname = get_filesystem_name(); + char* mountpoint = get_mountpoint(); + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + fprintf(stderr, "mount failed: retcode = %d\n", rc); + return rc; + } + + rc = curvefs_chmod(instance, argv[1], atoi(argv[2])); + if (rc != 0) { + fprintf(stderr, "chmod failed: retcode = %d\n", rc); + return rc; + } + return 0; +} diff --git a/curvefs/sdk/libcurvefs/examples/common.h b/curvefs/sdk/libcurvefs/examples/common.h new file mode 100644 index 0000000000..dc262eb0b2 --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/common.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CURVEFS_SDK_LIBCURVEFS_EXAMPLES_COMMON_H_ +#define CURVEFS_SDK_LIBCURVEFS_EXAMPLES_COMMON_H_ + +#include +#include +#include + +#include "curvefs/sdk/libcurvefs/libcurvefs.h" + +const char* KEY_FSNAME = "CURVEFS_FSNAME"; +const char* KEY_S3_AK = "s3.ak"; +const char* KEY_S3_SK = "s3.sk"; +const char* KEY_S3_ENDPOINT = "s3.endpoint"; +const char* KEY_S3_BUCKET = "s3.bucket_name"; +const char* KEY_MDS_ADDRS = "mdsOpt.rpcRetryOpt.addrs"; + +char* +require_string(const char* name) { + char* value = getenv(name); + if (strlen(value) == 0) { + fprintf(stderr, "require %s\n", name); + exit(1); + } + return value; +} + +char* +get_filesystem_name() { + return require_string(KEY_FSNAME); +} + +char* +get_mountpoint() { + return "/"; +} + +void +load_cfg_from_environ(uintptr_t instance) { + curvefs_conf_set(instance, KEY_S3_AK, require_string(KEY_S3_AK)); + curvefs_conf_set(instance, KEY_S3_SK, require_string(KEY_S3_SK)); + curvefs_conf_set(instance, KEY_S3_ENDPOINT, + require_string(KEY_S3_ENDPOINT)); + curvefs_conf_set(instance, KEY_S3_BUCKET, require_string(KEY_S3_BUCKET)); + curvefs_conf_set(instance, KEY_MDS_ADDRS, require_string(KEY_MDS_ADDRS)); + curvefs_conf_set(instance, "fs.accessLogging", "true"); + curvefs_conf_set(instance, "client.loglevel", "6"); + curvefs_conf_set(instance, "diskCache.diskCacheType", "0"); +} + +void +exact_args(int argc, int number) { + if (--argc == number) { + return; + } + + fprintf(stderr, "requires exactly %d argument[s]\n", number); + exit(1); +} + +#endif // CURVEFS_SDK_LIBCURVEFS_EXAMPLES_COMMON_H_ diff --git a/curvefs/sdk/libcurvefs/examples/fstat.c b/curvefs/sdk/libcurvefs/examples/fstat.c new file mode 100644 index 0000000000..5745f19e05 --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/fstat.c @@ -0,0 +1,36 @@ +#include + +#include "common.h" + +int +main(int argc, char** argv) { + exact_args(argc, 1); + + uintptr_t instance = curvefs_create(); + load_cfg_from_environ(instance); + + char* fsname = get_filesystem_name(); + char* mountpoint = get_mountpoint(); + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + fprintf(stderr, "mount failed: retcode = %d\n", rc); + return rc; + } + + int fd = curvefs_open(instance, argv[1], O_WRONLY, 0777); + if (fd != 0) { + rc = fd; + fprintf(stderr, "open failed: retcode = %d\n", rc); + return rc; + } + + struct stat stat; + rc = curvefs_fstat(instance, fd, &stat); + if (rc != 0) { + fprintf(stderr, "fstat failed: retcode = %d\n", rc); + return rc; + } + + printf("ino=%d, size=%d\n", stat.st_ino, stat.st_size); + return 0; +} diff --git a/curvefs/sdk/libcurvefs/examples/ls.c b/curvefs/sdk/libcurvefs/examples/ls.c new file mode 100644 index 0000000000..71df5f30be --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/ls.c @@ -0,0 +1,49 @@ +#include "common.h" + +int +main(int argc, char** argv) { + exact_args(argc, 1); + + uintptr_t instance = curvefs_create(); + load_cfg_from_environ(instance); + + // mount + char* fsname = get_filesystem_name(); + char* mountpoint = get_mountpoint(); + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + fprintf(stderr, "mount failed: retcode = %d\n", rc); + return rc; + } + + // opendir + dir_stream_t dir_stream; + rc = curvefs_opendir(instance, argv[1], &dir_stream); + if (rc != 0) { + fprintf(stderr, "opendir failed: retcode = %d\n", rc); + return rc; + } + + // readdir + dirent_t dirent; + for ( ;; ) { + ssize_t n = curvefs_readdir(instance, &dir_stream, &dirent); + if (n < 0) { + rc = n; + fprintf(stderr, "readdir failed: retcode = %d\n", rc); + break; + } else if (n == 0) { + break; + } + + printf("%s: ino=%d size=%d\n", dirent.name, + dirent.stat.st_ino, + dirent.stat.st_size); + } + + rc = curvefs_closedir(instance, &dir_stream); + if (rc != 0) { + fprintf(stderr, "closedir failed: retcode = %d\n", rc); + } + return rc; +} diff --git a/curvefs/sdk/libcurvefs/examples/mkdir.c b/curvefs/sdk/libcurvefs/examples/mkdir.c new file mode 100644 index 0000000000..c2c5b4bce6 --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/mkdir.c @@ -0,0 +1,25 @@ +#include "common.h" + +int +main(int argc, char** argv) { + exact_args(argc, 1); + + uintptr_t instance = curvefs_create(); + load_cfg_from_environ(instance); + + char* fsname = get_filesystem_name(); + char* mountpoint = get_mountpoint(); + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + fprintf(stderr, "mount failed: retcode = %d\n", rc); + return rc; + } + + rc = curvefs_mkdir(instance, argv[1], 0755); + if (rc != 0) { + fprintf(stderr, "mkdir failed: retcode = %d\n", rc); + return rc; + } + + return 0; +} diff --git a/curvefs/sdk/libcurvefs/examples/read.c b/curvefs/sdk/libcurvefs/examples/read.c new file mode 100644 index 0000000000..3dcbd5d4ee --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/read.c @@ -0,0 +1,44 @@ +#include + +#include "common.h" + +#define MAX_BUFFER_SIZE 4096 + 5 + +int +main(int argc, char** argv) { + exact_args(argc, 1); + + uintptr_t instance = curvefs_create(); + load_cfg_from_environ(instance); + + char* fsname = get_filesystem_name(); + char* mountpoint = get_mountpoint(); + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + fprintf(stderr, "mount failed: retcode = %d\n", rc); + return rc; + } + + int fd = curvefs_open(instance, argv[1], O_WRONLY, 0777); + if (fd != 0) { + rc = fd; + fprintf(stderr, "open failed: retcode = %d\n", rc); + return rc; + } + + char buffer[MAX_BUFFER_SIZE]; + for ( ;; ) { + ssize_t n = curvefs_read(instance, fd, buffer, sizeof(buffer)); + if (n < 0) { + rc = n; + fprintf(stderr, "read failed: retcode = %d\n", rc); + return rc; + } else if (n == 0) { + break; + } + + buffer[n] = '\0'; + printf("%s", buffer); + } + return 0; +} diff --git a/curvefs/sdk/libcurvefs/examples/rename.c b/curvefs/sdk/libcurvefs/examples/rename.c new file mode 100644 index 0000000000..77f824531b --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/rename.c @@ -0,0 +1,24 @@ +#include "common.h" + +int +main(int argc, char** argv) { + exact_args(argc, 2); + + uintptr_t instance = curvefs_create(); + load_cfg_from_environ(instance); + + char* fsname = get_filesystem_name(); + char* mountpoint = get_mountpoint(); + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + fprintf(stderr, "mount failed: retcode = %d\n", rc); + return rc; + } + + rc = curvefs_rename(instance, argv[1], argv[2]); + if (rc != 0) { + fprintf(stderr, "rename failed: retcode = %d\n", rc); + return rc; + } + return 0; +} diff --git a/curvefs/sdk/libcurvefs/examples/rmdir.c b/curvefs/sdk/libcurvefs/examples/rmdir.c new file mode 100644 index 0000000000..7ae25a80a7 --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/rmdir.c @@ -0,0 +1,25 @@ +#include "common.h" + +int +main(int argc, char** argv) { + exact_args(argc, 1); + + uintptr_t instance = curvefs_create(); + load_cfg_from_environ(instance); + + char* fsname = get_filesystem_name(); + char* mountpoint = get_mountpoint(); + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + fprintf(stderr, "mount failed: retcode = %d\n", rc); + return rc; + } + + rc = curvefs_rmdir(instance, argv[1]); + if (rc != 0) { + fprintf(stderr, "rmdir failed: retcode = %d\n", rc); + return rc; + } + + return 0; +} diff --git a/curvefs/sdk/libcurvefs/examples/stat.c b/curvefs/sdk/libcurvefs/examples/stat.c new file mode 100644 index 0000000000..34589bc6fa --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/stat.c @@ -0,0 +1,27 @@ +#include "common.h" + +int +main(int argc, char** argv) { + exact_args(argc, 1); + + uintptr_t instance = curvefs_create(); + load_cfg_from_environ(instance); + + char* fsname = get_filesystem_name(); + char* mountpoint = get_mountpoint(); + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + fprintf(stderr, "mount failed: retcode = %d\n", rc); + return rc; + } + + struct stat stat; + rc = curvefs_lstat(instance, argv[1], &stat); + if (rc != 0) { + fprintf(stderr, "stat failed: retcode = %d\n", rc); + return rc; + } + + printf("ino=%d, size=%d\n", stat.st_ino, stat.st_size); + return 0; +} diff --git a/curvefs/sdk/libcurvefs/examples/statfs.c b/curvefs/sdk/libcurvefs/examples/statfs.c new file mode 100644 index 0000000000..81f0aee290 --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/statfs.c @@ -0,0 +1,29 @@ +#include + +#include "common.h" + +int +main(int argc, char** argv) { + exact_args(argc, 0); + + uintptr_t instance = curvefs_create(); + load_cfg_from_environ(instance); + + char* fsname = get_filesystem_name(); + char* mountpoint = get_mountpoint(); + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + fprintf(stderr, "mount failed: retcode = %d\n", rc); + return rc; + } + + struct statvfs statvfs; + rc = curvefs_statfs(instance, &statvfs); + if (rc != 0) { + fprintf(stderr, "statvfs failed: retcode = %d\n", rc); + return rc; + } + + printf("fsid = %d\n", statvfs.f_fsid); + return 0; +} diff --git a/curvefs/sdk/libcurvefs/examples/touch.c b/curvefs/sdk/libcurvefs/examples/touch.c new file mode 100644 index 0000000000..b3185eb6ec --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/touch.c @@ -0,0 +1,26 @@ +#include + +#include "common.h" + +int +main(int argc, char** argv) { + exact_args(argc, 1); + + uintptr_t instance = curvefs_create(); + load_cfg_from_environ(instance); + + char* fsname = get_filesystem_name(); + char* mountpoint = get_mountpoint(); + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + fprintf(stderr, "mount failed: retcode = %d\n", rc); + return rc; + } + + int fd = curvefs_open(instance, argv[1], O_CREAT, 0644); + if (fd < 0) { + rc = fd; + fprintf(stderr, "open failed: retcode = %d\n", rc); + } + return rc; +} diff --git a/curvefs/sdk/libcurvefs/examples/unlink.c b/curvefs/sdk/libcurvefs/examples/unlink.c new file mode 100644 index 0000000000..e20fbe5636 --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/unlink.c @@ -0,0 +1,25 @@ +#include "common.h" + +int +main(int argc, char** argv) { + exact_args(argc, 1); + + uintptr_t instance = curvefs_create(); + load_cfg_from_environ(instance); + + char* fsname = get_filesystem_name(); + char* mountpoint = get_mountpoint(); + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + fprintf(stderr, "mount failed: retcode = %d\n", rc); + return rc; + } + + rc = curvefs_unlink(instance, argv[1]); + if (rc != 0) { + fprintf(stderr, "unlink failed: retcode = %d\n", rc); + return rc; + } + + return 0; +} diff --git a/curvefs/sdk/libcurvefs/examples/write.c b/curvefs/sdk/libcurvefs/examples/write.c new file mode 100644 index 0000000000..d3f85c26fb --- /dev/null +++ b/curvefs/sdk/libcurvefs/examples/write.c @@ -0,0 +1,42 @@ +#include + +#include "common.h" + +int +main(int argc, char** argv) { + exact_args(argc, 2); + + uintptr_t instance = curvefs_create(); + load_cfg_from_environ(instance); + + char* fsname = get_filesystem_name(); + char* mountpoint = get_mountpoint(); + int rc = curvefs_mount(instance, fsname, mountpoint); + if (rc != 0) { + fprintf(stderr, "mount failed: retcode = %d\n", rc); + return rc; + } + + int fd = curvefs_open(instance, argv[1], O_WRONLY, 0777); + if (fd != 0) { + rc = fd; + fprintf(stderr, "open failed: retcode = %d\n", rc); + return rc; + } + + ssize_t n = curvefs_write(instance, fd, argv[2], strlen(argv[2])); + if (n < 0) { + rc = n; + fprintf(stderr, "write failed: retcode = %d\n", rc); + return rc; + } else if (n != strlen(argv[2])) { + fprintf(stderr, "write failed: %zd != %zu\n", n, strlen(argv[2])); + return -1; + } + + rc = curvefs_close(instance, fd); + if (rc != 0) { + fprintf(stderr, "close failed: retcode = %d\n", rc); + } + return 0; +} diff --git a/curvefs/sdk/libcurvefs/libcurvefs.cpp b/curvefs/sdk/libcurvefs/libcurvefs.cpp new file mode 100644 index 0000000000..d53c0b51b8 --- /dev/null +++ b/curvefs/sdk/libcurvefs/libcurvefs.cpp @@ -0,0 +1,256 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-07-12 + * Author: Jingli Chen (Wine93) + */ + +#include "curvefs/src/client/filesystem/error.h" +#include "curvefs/sdk/libcurvefs/libcurvefs.h" + +using ::curvefs::client::filesystem::CURVEFS_ERROR; +using ::curvefs::client::filesystem::SysErr; +using ::curvefs::client::vfs::DirStream; +using ::curvefs::client::vfs::DirEntry; + +static curvefs_mount_t* get_instance(uintptr_t instance_ptr) { + return reinterpret_cast(instance_ptr); +} + +static void stream_cast(DirStream* stream, dir_stream_t* dir_stream) { + dir_stream->fh = stream->fh; + dir_stream->ino = stream->ino; + dir_stream->offset = stream->offset; +} + +uintptr_t curvefs_create() { + auto mount = new curvefs_mount_t(); + mount->cfg = Configure::Default(); + return reinterpret_cast(mount); +} + +void curvefs_release(uintptr_t instance_ptr) { + auto mount = get_instance(instance_ptr); + delete mount; + mount = nullptr; +} + +void curvefs_conf_set(uintptr_t instance_ptr, + const char* key, + const char* value) { + auto mount = get_instance(instance_ptr); + return mount->cfg->Set(key, value); +} + +int curvefs_mount(uintptr_t instance_ptr, + const char* fsname, + const char* mountpoint) { + auto mount = get_instance(instance_ptr); + mount->vfs = std::make_shared(mount->cfg); + auto rc = mount->vfs->Mount(fsname, mountpoint); + return SysErr(rc); +} + +int curvefs_umonut(uintptr_t instance_ptr, + const char* fsname, + const char* mountpoint) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->Umount(fsname, mountpoint); + return SysErr(rc); +} + +int curvefs_mkdir(uintptr_t instance_ptr, const char* path, uint16_t mode) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->MkDir(path, mode); + return SysErr(rc); +} + +int curvefs_mkdirs(uintptr_t instance_ptr, const char* path, uint16_t mode) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->MkDirs(path, mode); + return SysErr(rc); +} + +int curvefs_rmdir(uintptr_t instance_ptr, const char* path) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->RmDir(path); + return SysErr(rc); +} + +int curvefs_opendir(uintptr_t instance_ptr, + const char* path, + dir_stream_t* dir_stream) { + DirStream stream; + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->OpenDir(path, &stream); + if (rc == CURVEFS_ERROR::OK) { + stream_cast(&stream, dir_stream); + } + return SysErr(rc); +} + +ssize_t curvefs_readdir(uintptr_t instance_ptr, + dir_stream_t* dir_stream, + dirent_t* dirent) { + DirEntry dirEntry; + auto mount = get_instance(instance_ptr); + DirStream* stream = reinterpret_cast(dir_stream); + auto rc = mount->vfs->ReadDir(stream, &dirEntry); + if (rc == CURVEFS_ERROR::OK) { + std::string name = dirEntry.name; + name.copy(dirent->name, name.size() ); + dirent->name[name.size()] = '\0'; + mount->vfs->Attr2Stat(&dirEntry.attr, &dirent->stat); + return 1; + } else if (rc == CURVEFS_ERROR::END_OF_FILE) { + return 0; + } + return SysErr(rc); +} + +int curvefs_closedir(uintptr_t instance_ptr, dir_stream_t* dir_stream) { + DirStream* stream = reinterpret_cast(dir_stream); + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->CloseDir(stream); + return SysErr(rc); +} + +int curvefs_open(uintptr_t instance_ptr, + const char* path, + uint32_t flags, + uint16_t mode) { + CURVEFS_ERROR rc; + auto mount = get_instance(instance_ptr); + if (flags & O_CREAT) { + rc = mount->vfs->Create(path, mode); + if (rc != CURVEFS_ERROR::OK) { + return SysErr(rc); + } + } + + uint64_t fd; + rc = mount->vfs->Open(path, flags, mode, &fd); + if (rc != CURVEFS_ERROR::OK) { + return SysErr(rc); + } + return static_cast(fd); +} + +int curvefs_lseek(uintptr_t instance_ptr, + int fd, + uint64_t offset, + int whence) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->LSeek(fd, offset, whence); + return SysErr(rc); +} + +ssize_t curvefs_read(uintptr_t instance_ptr, + int fd, + char* buffer, + size_t count) { + size_t nread; + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->Read(fd, buffer, count, &nread); + if (rc != CURVEFS_ERROR::OK) { + return SysErr(rc); + } + return nread; +} + +ssize_t curvefs_write(uintptr_t instance_ptr, + int fd, + char* buffer, + size_t count) { + size_t nwritten; + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->Write(fd, buffer, count, &nwritten); + if (rc != CURVEFS_ERROR::OK) { + return SysErr(rc); + } + return nwritten; +} + +int curvefs_fsync(uintptr_t instance_ptr, int fd) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->FSync(fd); + return SysErr(rc); +} + +int curvefs_close(uintptr_t instance_ptr, int fd) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->Close(fd); + return SysErr(rc); +} + +int curvefs_unlink(uintptr_t instance_ptr, const char* path) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->Unlink(path); + return SysErr(rc); +} + +int curvefs_statfs(uintptr_t instance_ptr, + struct statvfs* statvfs) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->StatFs(statvfs); + return SysErr(rc); +} + +int curvefs_lstat(uintptr_t instance_ptr, const char* path, struct stat* stat) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->LStat(path, stat); + return SysErr(rc); +} + +int curvefs_fstat(uintptr_t instance_ptr, int fd, struct stat* stat) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->FStat(fd, stat); + return SysErr(rc); +} + +int curvefs_setattr(uintptr_t instance_ptr, + const char* path, + struct stat* stat, + int to_set) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->SetAttr(path, stat, to_set); + return SysErr(rc); +} + +int curvefs_chmod(uintptr_t instance_ptr, const char* path, uint16_t mode) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->Chmod(path, mode); + return SysErr(rc); +} + +int curvefs_chown(uintptr_t instance_ptr, + const char* path, + uint32_t uid, + uint32_t gid) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->Chown(path, uid, gid); + return SysErr(rc); +} + +int curvefs_rename(uintptr_t instance_ptr, + const char* oldpath, + const char* newpath) { + auto mount = get_instance(instance_ptr); + auto rc = mount->vfs->Rename(oldpath, newpath); + return SysErr(rc); +} diff --git a/curvefs/sdk/libcurvefs/libcurvefs.h b/curvefs/sdk/libcurvefs/libcurvefs.h new file mode 100644 index 0000000000..35d2f743df --- /dev/null +++ b/curvefs/sdk/libcurvefs/libcurvefs.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-07-12 + * Author: Jingli Chen (Wine93) + */ + +#ifndef CURVEFS_SDK_LIBCURVEFS_LIBCURVEFS_H_ +#define CURVEFS_SDK_LIBCURVEFS_LIBCURVEFS_H_ + +#include +#include +#include + +#ifdef __cplusplus + +#include +#include +#include + +#include "curvefs/src/client/vfs/config.h" +#include "curvefs/src/client/vfs/vfs.h" + +using ::curvefs::client::vfs::Configure; +using ::curvefs::client::vfs::VFS; + +typedef struct { + std::shared_ptr cfg; + std::shared_ptr vfs; +} curvefs_mount_t; + +#endif // __cplusplus + +// Must be synchronized with DirStream if changed +typedef struct { + uint64_t ino; + uint64_t fh; + uint64_t offset; +} dir_stream_t; + +typedef struct { + struct stat stat; + char name[256]; +} dirent_t; + +#ifdef __cplusplus +extern "C" { +#endif + +uintptr_t curvefs_create(); + +void curvefs_release(uintptr_t instance_ptr); + +// NOTE: instance_ptr is the pointer of curvefs_mount_t instance. +void curvefs_conf_set(uintptr_t instance_ptr, + const char* key, + const char* value); + +int curvefs_mount(uintptr_t instance_ptr, + const char* fsname, + const char* mountpoint); + +int curvefs_umonut(uintptr_t instance_ptr, + const char* fsname, + const char* mountpoint); + +// directory +int curvefs_mkdir(uintptr_t instance_ptr, const char* path, uint16_t mode); + +int curvefs_mkdirs(uintptr_t instance_ptr, const char* path, uint16_t mode); + +int curvefs_rmdir(uintptr_t instance_ptr, const char* path); + +int curvefs_opendir(uintptr_t instance_ptr, + const char* path, + dir_stream_t* dir_stream); + +ssize_t curvefs_readdir(uintptr_t instance_ptr, + dir_stream_t* dir_stream, + dirent_t* dirent); + +int curvefs_closedir(uintptr_t instance_ptr, dir_stream_t* dir_stream); + +// file +int curvefs_open(uintptr_t instance_ptr, + const char* path, + uint32_t flags, + uint16_t mode); + +int curvefs_lseek(uintptr_t instance_ptr, + int fd, + uint64_t offset, + int whence); + +ssize_t curvefs_read(uintptr_t instance_ptr, + int fd, + char* buffer, + size_t count); + +ssize_t curvefs_write(uintptr_t instance_ptr, + int fd, + char* buffer, + size_t count); + +int curvefs_fsync(uintptr_t instance_ptr, int fd); + +int curvefs_close(uintptr_t instance_ptr, int fd); + +int curvefs_unlink(uintptr_t instance_ptr, const char* path); + +// others +int curvefs_statfs(uintptr_t instance_ptr, struct statvfs* statvfs); + +int curvefs_lstat(uintptr_t instance_ptr, const char* path, struct stat* stat); + +int curvefs_fstat(uintptr_t instance_ptr, int fd, struct stat* stat); + +int curvefs_setattr(uintptr_t instance_ptr, + const char* path, + struct stat* stat, + int to_set); + +int curvefs_chmod(uintptr_t instance_ptr, const char* path, uint16_t mode); + +int curvefs_chown(uintptr_t instance_ptr, + const char* path, + uint32_t uid, + uint32_t gid); + +int curvefs_rename(uintptr_t instance_ptr, + const char* oldpath, + const char* newpath); +#ifdef __cplusplus +} +#endif + +#endif // CURVEFS_SDK_LIBCURVEFS_LIBCURVEFS_H_ diff --git a/curvefs/src/client/BUILD b/curvefs/src/client/BUILD index b296af86f8..450e8b6ced 100644 --- a/curvefs/src/client/BUILD +++ b/curvefs/src/client/BUILD @@ -32,6 +32,29 @@ cc_binary( ], ) +cc_library( + name = "filesystem", + srcs = glob([ + "filesystem/*.cpp", + "filesystem/*.h", + ]), + copts = CURVE_DEFAULT_COPTS, + visibility = ["//visibility:public"], + deps = [ + ":fuse_client_lib", + ], +) + +cc_library( + name = "filesystem_xattr", + hdrs = ["filesystem/xattr.h"], + copts = CURVE_DEFAULT_COPTS, + visibility = ["//visibility:public"], + deps = [ + "//external:bvar", + ], +) + cc_library( name = "fuse_client_lib", srcs = glob( @@ -64,6 +87,8 @@ cc_library( "//curvefs/src/common:curvefs_common", "//curvefs/src/client/lease:curvefs_lease", "//curvefs/src/client/kvclient:memcached_client_lib", + "//curvefs/src/client/logger:logger", + ":filesystem_xattr", "//external:brpc", "//external:gflags", "//external:glog", @@ -80,6 +105,7 @@ cc_library( "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/meta:type_traits", "@com_google_absl//absl/types:optional", + "@com_google_absl//absl/container:btree", "@com_google_googletest//:gtest_prod", "@spdlog//:spdlog", ], diff --git a/curvefs/src/client/client_operator.cpp b/curvefs/src/client/client_operator.cpp index 8d44a5150f..720ce65ee3 100644 --- a/curvefs/src/client/client_operator.cpp +++ b/curvefs/src/client/client_operator.cpp @@ -153,7 +153,7 @@ CURVEFS_ERROR RenameOperator::CheckOverwrite() { if (rc == CURVEFS_ERROR::OK && !dentrys.empty()) { LOG(ERROR) << "The directory is not empty" << ", dentry = (" << dstDentry_.ShortDebugString() << ")"; - rc = CURVEFS_ERROR::NOTEMPTY; + rc = CURVEFS_ERROR::NOT_EMPTY; } return rc; @@ -170,7 +170,7 @@ CURVEFS_ERROR RenameOperator::Precheck() { } rc = dentryManager_->GetDentry(newParentId_, newname_, &dstDentry_); - if (rc == CURVEFS_ERROR::NOTEXIST) { + if (rc == CURVEFS_ERROR::NOT_EXIST) { return CURVEFS_ERROR::OK; } else if (rc == CURVEFS_ERROR::OK) { oldInodeId_ = dstDentry_.inodeid(); @@ -191,7 +191,7 @@ CURVEFS_ERROR RenameOperator::RecordOldInodeInfo() { oldInodeType_ = attr.type(); } else { LOG_ERROR("GetInode", rc); - return CURVEFS_ERROR::NOTEXIST; + return CURVEFS_ERROR::NOT_EXIST; } } diff --git a/curvefs/src/client/common/common.h b/curvefs/src/client/common/common.h index 0a1dd00d09..a76312b117 100644 --- a/curvefs/src/client/common/common.h +++ b/curvefs/src/client/common/common.h @@ -65,12 +65,6 @@ enum class MetaServerOpType { std::ostream &operator<<(std::ostream &os, MetaServerOpType optype); -const uint32_t MAX_XATTR_NAME_LENGTH = 255; -const uint32_t MAX_XATTR_VALUE_LENGTH = 64 * 1024; - -const char kCurveFsWarmupXAttr[] = "curvefs.warmup.op"; -const char kCurveFsWarmupXAttrList[] = "curvefs.warmup.op.list"; - constexpr size_t kMinWarmupOpArgsNum = 1; constexpr size_t kWarmupAddArgsNum = 6; constexpr size_t kWarmupCancelArgsNum = 2; diff --git a/curvefs/src/client/common/config.cpp b/curvefs/src/client/common/config.cpp index 10d64bea9a..dc80177ab3 100644 --- a/curvefs/src/client/common/config.cpp +++ b/curvefs/src/client/common/config.cpp @@ -39,6 +39,8 @@ namespace curvefs { namespace client { namespace common { DECLARE_bool(useFakeS3); +DEFINE_bool(fs_disableXattr, false, "disable xattr"); +DEFINE_validator(fs_disableXattr, [](const char*, bool value) { return true; }); } // namespace common } // namespace client } // namespace curvefs @@ -46,11 +48,13 @@ DECLARE_bool(useFakeS3); namespace curvefs { namespace client { namespace common { +static bool pass_bool(const char*, bool) { return true; } DEFINE_bool(enableCto, true, "acheieve cto consistency"); DEFINE_bool(useFakeS3, false, "Use fake s3 to inject more metadata for testing metaserver"); DEFINE_bool(supportKVcache, false, "use kvcache to speed up sharing"); DEFINE_bool(access_logging, true, "enable access log"); +DEFINE_validator(access_logging, &pass_bool); /** * use curl -L fuseclient:port/flags/fuseClientAvgWriteBytes?setvalue=true @@ -225,6 +229,16 @@ void InitS3Option(Configuration *conf, S3Option *s3Opt) { &s3Opt->s3ClientAdaptorOpt.writeCacheMaxByte); conf->GetValueFatalIfFail("s3.readCacheMaxByte", &s3Opt->s3ClientAdaptorOpt.readCacheMaxByte); + conf->GetValueFatalIfFail("s3.memClusterToLocal", + &s3Opt->s3ClientAdaptorOpt.memClusterToLocal); + conf->GetValueFatalIfFail("s3.s3ToLocal", + &s3Opt->s3ClientAdaptorOpt.s3ToLocal); + conf->GetValueFatalIfFail("s3.bigIoSize", + &s3Opt->s3ClientAdaptorOpt.bigIoSize); + conf->GetValueFatalIfFail("s3.bigIoRetryTimes", + &s3Opt->s3ClientAdaptorOpt.bigIoRetryTimes); + conf->GetValueFatalIfFail("s3.bigIoRetryIntervalUs", + &s3Opt->s3ClientAdaptorOpt.bigIoRetryIntervalUs); conf->GetValueFatalIfFail("s3.readCacheThreads", &s3Opt->s3ClientAdaptorOpt.readCacheThreads); conf->GetValueFatalIfFail("s3.nearfullRatio", @@ -238,6 +252,7 @@ void InitS3Option(Configuration *conf, S3Option *s3Opt) { &s3Opt->s3ClientAdaptorOpt.readRetryIntervalMs); ::curve::common::InitS3AdaptorOptionExceptS3InfoOption(conf, &s3Opt->s3AdaptrOpt); + InitDiskCacheOption(conf, &s3Opt->s3ClientAdaptorOpt.diskCacheOpt); } @@ -299,10 +314,44 @@ void InitKVClientManagerOpt(Configuration *conf, &config->getThreadPooln); } +void GetGids( + Configuration* c, const std::string& key, std::vector* gids) { + std::string str; + std::vector ss; + c->GetValueFatalIfFail(key, &str); + curve::common::SplitString(str, ",", &ss); + uint32_t gid; + for (const auto& s : ss) { + LOG_IF(FATAL, !curve::common::StringToUl(s, &gid)) + << "Invalid `" << key << "`: <" << s << ">"; + gids->push_back(static_cast(gid)); + } +} + +void GetUmask(Configuration* c, const std::string& key, uint16_t* umask) { + std::string str; + c->GetValueFatalIfFail(key, &str); + *umask = stoi(str, 0, 8); +} + +void InitVFSOption(Configuration* c, VFSOption* option) { + { // vfs cache option + auto o = &option->vfsCacheOption; + c->GetValueFatalIfFail("vfs.entryCache.lruSize", &o->entryCacheLruSize); + c->GetValueFatalIfFail("vfs.attrCache.lruSize", &o->attrCacheLruSize); + } + { // user permission option + auto o = &option->userPermissionOption; + c->GetValueFatalIfFail("vfs.userPermission.uid", &o->uid); + GetGids(c, "vfs.userPermission.gids", &o->gids); + GetUmask(c, "vfs.userPermission.umask", &o->umask); + } +} + void InitFileSystemOption(Configuration* c, FileSystemOption* option) { c->GetValueFatalIfFail("fs.cto", &option->cto); c->GetValueFatalIfFail("fs.cto", &FLAGS_enableCto); - c->GetValueFatalIfFail("fs.disableXattr", &option->disableXattr); + c->GetValueFatalIfFail("fs.disableXAttr", &option->disableXAttr); c->GetValueFatalIfFail("fs.maxNameLength", &option->maxNameLength); c->GetValueFatalIfFail("fs.accessLogging", &FLAGS_access_logging); { // kernel cache option @@ -368,6 +417,7 @@ void InitFuseClientOption(Configuration *conf, FuseClientOption *clientOption) { InitLeaseOpt(conf, &clientOption->leaseOpt); InitRefreshDataOpt(conf, &clientOption->refreshDataOption); InitKVClientManagerOpt(conf, &clientOption->kvClientManagerOpt); + InitVFSOption(conf, &clientOption->vfsOption); InitFileSystemOption(conf, &clientOption->fileSystemOption); conf->GetValueFatalIfFail("fuseClient.listDentryLimit", diff --git a/curvefs/src/client/common/config.h b/curvefs/src/client/common/config.h index 6d93f5a059..464b1550c4 100644 --- a/curvefs/src/client/common/config.h +++ b/curvefs/src/client/common/config.h @@ -25,9 +25,10 @@ #include #include +#include -#include "curvefs/src/client/common/common.h" #include "curvefs/proto/common.pb.h" +#include "curvefs/src/client/common/common.h" #include "src/client/config_info.h" #include "src/common/configuration.h" #include "src/common/s3_adapter.h" @@ -127,6 +128,11 @@ struct S3ClientAdaptorOption { uint32_t flushIntervalSec; uint64_t writeCacheMaxByte; uint64_t readCacheMaxByte; + bool memClusterToLocal; + bool s3ToLocal; + uint32_t bigIoSize; + uint32_t bigIoRetryTimes; + uint32_t bigIoRetryIntervalUs; uint32_t readCacheThreads; uint32_t nearfullRatio; uint32_t baseSleepUs; @@ -175,6 +181,24 @@ struct RefreshDataOption { uint32_t refreshDataIntervalSec = 30; }; +// { vfs option +struct UserPermissionOption { + uint32_t uid; + std::vector gids; + uint16_t umask; +}; + +struct VFSCacheOption { + uint32_t entryCacheLruSize; + uint32_t attrCacheLruSize; +}; + +struct VFSOption { + VFSCacheOption vfsCacheOption; + UserPermissionOption userPermissionOption; +}; +// } + // { filesystem option struct KernelCacheOption { uint32_t entryTimeoutSec; @@ -214,7 +238,7 @@ struct DeferSyncOption { struct FileSystemOption { bool cto; - bool disableXattr; + bool disableXAttr; uint32_t maxNameLength; uint32_t blockSize = 0x10000u; KernelCacheOption kernelCacheOption; @@ -239,6 +263,7 @@ struct FuseClientOption { LeaseOpt leaseOpt; RefreshDataOption refreshDataOption; KVClientManagerOpt kvClientManagerOpt; + VFSOption vfsOption; FileSystemOption fileSystemOption; uint32_t listDentryLimit; diff --git a/curvefs/src/client/curve_fuse_op.cpp b/curvefs/src/client/curve_fuse_op.cpp index 44e3f16a71..dd249c8892 100644 --- a/curvefs/src/client/curve_fuse_op.cpp +++ b/curvefs/src/client/curve_fuse_op.cpp @@ -32,12 +32,13 @@ #include "curvefs/src/client/common/common.h" #include "curvefs/src/client/common/config.h" -#include "curvefs/src/client/filesystem/access_log.h" #include "curvefs/src/client/filesystem/error.h" #include "curvefs/src/client/filesystem/meta.h" +#include "curvefs/src/client/filesystem/xattr.h" #include "curvefs/src/client/fuse_client.h" #include "curvefs/src/client/fuse_s3_client.h" #include "curvefs/src/client/fuse_volume_client.h" +#include "curvefs/src/client/logger/access_log.h" #include "curvefs/src/client/metric/client_metric.h" #include "curvefs/src/client/rpcclient/base_client.h" #include "curvefs/src/client/rpcclient/mds_client.h" @@ -61,16 +62,17 @@ using ::curvefs::client::common::kWarmupCacheStorageType; using ::curvefs::client::common::kWarmupDataType; using ::curvefs::client::common::kWarmupOpType; using ::curvefs::client::common::WarmupStorageType; -using ::curvefs::client::filesystem::AccessLogGuard; using ::curvefs::client::filesystem::AttrOut; using ::curvefs::client::filesystem::EntryOut; using ::curvefs::client::filesystem::FileOut; -using ::curvefs::client::filesystem::InitAccessLog; -using ::curvefs::client::filesystem::Logger; +using ::curvefs::client::filesystem::IsListWarmupXAttr; +using ::curvefs::client::filesystem::IsWarmupXAttr; using ::curvefs::client::filesystem::StrAttr; using ::curvefs::client::filesystem::StrEntry; -using ::curvefs::client::filesystem::StrFormat; using ::curvefs::client::filesystem::StrMode; +using ::curvefs::client::logger::AccessLogGuard; +using ::curvefs::client::logger::InitAccessLog; +using ::curvefs::client::logger::StrFormat; using ::curvefs::client::metric::ClientOpMetric; using ::curvefs::client::metric::InflightGuard; using ::curvefs::client::rpcclient::MDSBaseClient; @@ -901,21 +903,6 @@ void FuseOpStatFs(fuse_req_t req, fuse_ino_t ino) { return fs->ReplyStatfs(req, &stbuf); } -const char* warmupXAttr = ::curvefs::client::common::kCurveFsWarmupXAttr; -const char* warmupListXAttr = - ::curvefs::client::common::kCurveFsWarmupXAttrList; - -bool IsWamupReq(const char* name) { - if (strlen(name) < strlen(warmupXAttr)) { - return false; - } - return strncmp(name, warmupXAttr, strlen(warmupXAttr)) == 0; -} - -bool IsWarmupListReq(const char* name) { - return IsWamupReq(name) && strcmp(name, warmupListXAttr) == 0; -} - void FuseOpSetXattr(fuse_req_t req, fuse_ino_t ino, const char* name, @@ -930,7 +917,7 @@ void FuseOpSetXattr(fuse_req_t req, ino, name, size, flags, StrErr(rc)); }); - if (IsWamupReq(name)) { + if (IsWarmupXAttr(name)) { return TriggerWarmup(req, ino, name, value, size); } rc = client->FuseOpSetXattr(req, ino, name, value, size, flags); @@ -951,9 +938,9 @@ void FuseOpGetXattr(fuse_req_t req, ino, name, size, StrErr(rc), value.size()); }); - if (IsWarmupListReq(name)) { + if (IsListWarmupXAttr(name)) { return ListWarmup(req, size); - } else if (IsWamupReq(name)) { + } else if (IsWarmupXAttr(name)) { return QueryWarmup(req, ino, size); } @@ -1018,5 +1005,5 @@ void FuseOpBmap(fuse_req_t req, auto client = Client(); auto fs = client->GetFileSystem(); - return fs->ReplyError(req, CURVEFS_ERROR::NOTSUPPORT); + return fs->ReplyError(req, CURVEFS_ERROR::NOT_SUPPORT); } diff --git a/curvefs/src/client/filesystem/.clang-format b/curvefs/src/client/filesystem/.clang-format new file mode 100644 index 0000000000..a5660a57d8 --- /dev/null +++ b/curvefs/src/client/filesystem/.clang-format @@ -0,0 +1,26 @@ +# I don't like current clang-formtter's specified style and +# and i think my style is more intuitive than it :), so I use +# this file to disable format, let us give some code snippet to prove it: +# +# my: +# std::vector tests { +# { " abc", "abc" }, +# { "abc ", "abc" }, +# { " abc ", "abc" }, +# { " a bc ", "a bc" }, +# { "a b c", "a b c" }, +# { " ", "" }, +# +# +# clang-formatter: +# std::vector tests{ +# {" abc", "abc"}, {"abc ", "abc"}, {" abc ", "abc"}, +# {" a bc ", "a bc"}, {"a b c", "a b c"}, {" ", ""}, +# }; +# +# Maybe you have different opinions, but please have a little mercy for me. +# +# by Wine93, 2023-10-16 + +DisableFormat: true +SortIncludes: Never diff --git a/curvefs/src/client/filesystem/defer_sync.cpp b/curvefs/src/client/filesystem/defer_sync.cpp index a69cdeb3ba..2b33e33ba4 100644 --- a/curvefs/src/client/filesystem/defer_sync.cpp +++ b/curvefs/src/client/filesystem/defer_sync.cpp @@ -81,6 +81,17 @@ void DeferSync::Push(const std::shared_ptr& inode) { inodes_.emplace_back(inode); } +bool DeferSync::IsDefered(Ino ino, InodeAttr* attr) { + LockGuard lk(mutex_); + for (const auto& inode : inodes_) { + if (inode->GetInodeId() == ino) { + inode->GetInodeAttr(attr); + return true; + } + } + return false; +} + } // namespace filesystem } // namespace client } // namespace curvefs diff --git a/curvefs/src/client/filesystem/defer_sync.h b/curvefs/src/client/filesystem/defer_sync.h index 0bd59bb9bc..41264a7e00 100644 --- a/curvefs/src/client/filesystem/defer_sync.h +++ b/curvefs/src/client/filesystem/defer_sync.h @@ -51,6 +51,8 @@ class DeferSync { void Push(const std::shared_ptr& inode); + bool IsDefered(Ino ino, InodeAttr* attr); + private: void SyncTask(); diff --git a/curvefs/src/client/filesystem/dir_cache.cpp b/curvefs/src/client/filesystem/dir_cache.cpp index 3beed645fe..f71a1651b8 100644 --- a/curvefs/src/client/filesystem/dir_cache.cpp +++ b/curvefs/src/client/filesystem/dir_cache.cpp @@ -33,7 +33,7 @@ DirEntryList::DirEntryList() : rwlock_(), mtime_(), entries_(), - attrs_() {} + index_() {} size_t DirEntryList::Size() { ReadLockGuard lk(rwlock_); @@ -43,39 +43,50 @@ size_t DirEntryList::Size() { void DirEntryList::Add(const DirEntry& dirEntry) { WriteLockGuard lk(rwlock_); entries_.push_back(std::move(dirEntry)); - attrs_[dirEntry.ino] = &entries_.back(); + index_[dirEntry.ino] = entries_.size() - 1; } bool DirEntryList::Get(Ino ino, DirEntry* dirEntry) { ReadLockGuard lk(rwlock_); - auto iter = attrs_.find(ino); - if (iter == attrs_.end()) { + auto iter = index_.find(ino); + if (iter == index_.end()) { return false; } - *dirEntry = *iter->second; + + *dirEntry = entries_[iter->second]; + return true; +} + +bool DirEntryList::At(uint32_t index, DirEntry* dirEntry) { + ReadLockGuard lk(rwlock_); + if (index >= entries_.size()) { + return false; + } + *dirEntry = entries_[index]; return true; } bool DirEntryList::UpdateAttr(Ino ino, const InodeAttr& attr) { WriteLockGuard lk(rwlock_); - auto iter = attrs_.find(ino); - if (iter == attrs_.end()) { + auto iter = index_.find(ino); + if (iter == index_.end()) { return false; } - DirEntry* dirEntry = iter->second; + DirEntry* dirEntry = &entries_[iter->second]; dirEntry->attr = std::move(attr); return true; } bool DirEntryList::UpdateLength(Ino ino, const InodeAttr& open) { WriteLockGuard lk(rwlock_); - auto iter = attrs_.find(ino); - if (iter == attrs_.end()) { + auto iter = index_.find(ino); + if (iter == index_.end()) { return false; } - InodeAttr* attr = &iter->second->attr; + DirEntry* dirEntry = &entries_[iter->second]; + InodeAttr* attr = &(dirEntry->attr); attr->set_length(open.length()); attr->set_mtime(open.mtime()); attr->set_mtime_ns(open.mtime_ns()); @@ -96,7 +107,7 @@ void DirEntryList::Iterate(IterateHandler handler) { void DirEntryList::Clear() { WriteLockGuard lk(rwlock_); entries_.clear(); - attrs_.clear(); + index_.clear(); } void DirEntryList::SetMtime(TimeSpec mtime) { @@ -118,6 +129,7 @@ DirCache::DirCache(DirCacheOption option) mq_->Subscribe([&](const std::shared_ptr& entries){ entries->Clear(); }); + metric_ = std::make_shared(); LOG(INFO) << "Using directory lru cache, capacity = " << option_.lruSize; } @@ -135,14 +147,16 @@ void DirCache::Stop() { void DirCache::Delete(Ino parent, std::shared_ptr entries, bool evit) { - nentries_ -= entries->Size(); + size_t ndelete = entries->Size(); + nentries_ -= ndelete; + metric_->AddEntries(-static_cast(ndelete)); mq_->Publish(entries); // clear entries in background lru_->Remove(parent); VLOG(1) << "Delete directory cache (evit=" << evit << "): " << "parent = " << parent << ", mtime = " << entries->GetMtime() - << ", size = " << entries->Size() + << ", delete size = " << ndelete << ", nentries = " << nentries_; } @@ -160,13 +174,19 @@ void DirCache::Evit(size_t size) { void DirCache::Put(Ino parent, std::shared_ptr entries) { WriteLockGuard lk(rwlock_); + if (entries->Size() == 0) { // TODO(Wine93): cache it! + return; + } + Evit(entries->Size()); // it guarantee put entries success lru_->Put(parent, entries); - nentries_ += entries->Size(); + int64_t ninsert = entries->Size(); + nentries_ += ninsert; + metric_->AddEntries(static_cast(ninsert)); VLOG(1) << "Insert directory cache: parent = " << parent << ", mtime = " << entries->GetMtime() - << ", size = " << entries->Size() + << ", insert size = " << ninsert << ", nentries = " << nentries_; } diff --git a/curvefs/src/client/filesystem/dir_cache.h b/curvefs/src/client/filesystem/dir_cache.h index 6aa57fe5d5..6c07ae1221 100644 --- a/curvefs/src/client/filesystem/dir_cache.h +++ b/curvefs/src/client/filesystem/dir_cache.h @@ -25,12 +25,15 @@ #include #include +#include #include +#include "absl/container/btree_map.h" #include "src/common/lru_cache.h" #include "src/common/concurrent/concurrent.h" #include "curvefs/src/client/common/config.h" #include "curvefs/src/client/filesystem/meta.h" +#include "curvefs/src/client/filesystem/metric.h" #include "curvefs/src/client/filesystem/message_queue.h" namespace curvefs { @@ -58,6 +61,8 @@ class DirEntryList { bool Get(Ino ino, DirEntry* dirEntry); + bool At(uint32_t index, DirEntry* dirEntry); + bool UpdateAttr(Ino ino, const InodeAttr& attr); bool UpdateLength(Ino ino, const InodeAttr& open); @@ -71,8 +76,8 @@ class DirEntryList { private: RWLock rwlock_; TimeSpec mtime_; - std::list entries_; - std::map attrs_; + std::vector entries_; + absl::btree_map index_; }; class DirCache { @@ -105,6 +110,7 @@ class DirCache { DirCacheOption option_; std::shared_ptr lru_; std::shared_ptr mq_; + std::shared_ptr metric_; }; } // namespace filesystem diff --git a/curvefs/src/client/filesystem/error.cpp b/curvefs/src/client/filesystem/error.cpp index f8a677497b..1a77f467bd 100644 --- a/curvefs/src/client/filesystem/error.cpp +++ b/curvefs/src/client/filesystem/error.cpp @@ -35,15 +35,15 @@ static const std::map> errors = { { CURVEFS_ERROR::INTERNAL, { EIO, "internal error" } }, { CURVEFS_ERROR::UNKNOWN, { -1, "unknown" } }, { CURVEFS_ERROR::EXISTS, { EEXIST, "inode or dentry already exist" } }, - { CURVEFS_ERROR::NOTEXIST, { ENOENT, "inode or dentry not exist" } }, + { CURVEFS_ERROR::NOT_EXIST, { ENOENT, "inode or dentry not exist" } }, { CURVEFS_ERROR::NO_SPACE, { ENOSPC, "no space to alloc" } }, { CURVEFS_ERROR::BAD_FD, { EBADF, "bad file number" } }, - { CURVEFS_ERROR::INVALIDPARAM , { EINVAL , "invalid argument" } }, - { CURVEFS_ERROR::NOPERMISSION, { EACCES, "permission denied" } }, - { CURVEFS_ERROR::NOTEMPTY, { ENOTEMPTY, "directory not empty" } }, - { CURVEFS_ERROR::NOFLUSH, { -1, "no flush" } }, - { CURVEFS_ERROR::NOTSUPPORT, { EOPNOTSUPP, "operation not supported" } }, - { CURVEFS_ERROR::NAMETOOLONG, { ENAMETOOLONG, "file name too long" } }, + { CURVEFS_ERROR::INVALID_PARAM , { EINVAL , "invalid argument" } }, + { CURVEFS_ERROR::NO_PERMISSION, { EACCES, "permission denied" } }, + { CURVEFS_ERROR::NOT_EMPTY, { ENOTEMPTY, "directory not empty" } }, + { CURVEFS_ERROR::NO_FLUSH, { -1, "no flush" } }, + { CURVEFS_ERROR::NOT_SUPPORT, { EOPNOTSUPP, "operation not supported" } }, + { CURVEFS_ERROR::NAME_TOO_LONG, { ENAMETOOLONG, "file name too long" } }, { CURVEFS_ERROR::MOUNT_POINT_EXIST, { -1, "mount point already exist" } }, { CURVEFS_ERROR::MOUNT_FAILED, { -1, "mount failed" } }, { CURVEFS_ERROR::OUT_OF_RANGE, { ERANGE, "out of range" } }, @@ -51,6 +51,8 @@ static const std::map> errors = { { CURVEFS_ERROR::IO_ERROR, { EIO, "I/O error" } }, { CURVEFS_ERROR::STALE, { ESTALE, "stale file handler" } }, { CURVEFS_ERROR::NOSYS, { ENOSYS, "invalid system call" } }, + { CURVEFS_ERROR::END_OF_FILE, { EOF, "end of file" } }, + { CURVEFS_ERROR::NOT_A_DIRECTORY, { ENOTDIR, "not a directory" } }, }; std::string StrErr(CURVEFS_ERROR code) { @@ -86,8 +88,8 @@ std::ostream &operator<<(std::ostream &os, CURVEFS_ERROR code) { CURVEFS_ERROR ToFSError(MetaStatusCode code) { static std::map errs = { { MetaStatusCode::OK, CURVEFS_ERROR::OK }, - { MetaStatusCode::NOT_FOUND, CURVEFS_ERROR::NOTEXIST }, - { MetaStatusCode::PARAM_ERROR, CURVEFS_ERROR::INVALIDPARAM }, + { MetaStatusCode::NOT_FOUND, CURVEFS_ERROR::NOT_EXIST }, + { MetaStatusCode::PARAM_ERROR, CURVEFS_ERROR::INVALID_PARAM }, { MetaStatusCode::INODE_EXIST, CURVEFS_ERROR::EXISTS }, { MetaStatusCode::DENTRY_EXIST, CURVEFS_ERROR::EXISTS }, { MetaStatusCode::SYM_LINK_EMPTY, CURVEFS_ERROR::INTERNAL }, diff --git a/curvefs/src/client/filesystem/error.h b/curvefs/src/client/filesystem/error.h index 1f837ca9d6..75efe38283 100644 --- a/curvefs/src/client/filesystem/error.h +++ b/curvefs/src/client/filesystem/error.h @@ -40,23 +40,25 @@ enum class CURVEFS_ERROR { INTERNAL = -1, UNKNOWN = -2, EXISTS = -3, - NOTEXIST = -4, + NOT_EXIST = -4, NO_SPACE = -5, BAD_FD = -6, - INVALIDPARAM = -7, - NOPERMISSION = -8, - NOTEMPTY = -9, - NOFLUSH = -10, - NOTSUPPORT = -11, - NAMETOOLONG = -12, + INVALID_PARAM = -7, + NO_PERMISSION = -8, + NOT_EMPTY = -9, + NO_FLUSH = -10, + NOT_SUPPORT = -10, + NAME_TOO_LONG = -12, MOUNT_POINT_EXIST = -13, MOUNT_FAILED = -14, OUT_OF_RANGE = -15, NODATA = -16, IO_ERROR = -17, - CACHETOOSMALL = -18, + CACHE_TOO_SMALL = -18, STALE = -19, NOSYS = -20, + END_OF_FILE = -21, + NOT_A_DIRECTORY = -22, }; std::string StrErr(CURVEFS_ERROR code); diff --git a/curvefs/src/client/filesystem/filesystem.cpp b/curvefs/src/client/filesystem/filesystem.cpp index 795c896a5b..2aad563051 100644 --- a/curvefs/src/client/filesystem/filesystem.cpp +++ b/curvefs/src/client/filesystem/filesystem.cpp @@ -234,30 +234,34 @@ FileSystemMember FileSystem::BorrowMember() { } // fuse request* -CURVEFS_ERROR FileSystem::Lookup(Request req, - Ino parent, +CURVEFS_ERROR FileSystem::Lookup(Ino parent, const std::string& name, EntryOut* entryOut) { if (name.size() > option_.maxNameLength) { - return CURVEFS_ERROR::NAMETOOLONG; + return CURVEFS_ERROR::NAME_TOO_LONG; } bool yes = negative_->Get(parent, name); if (yes) { - return CURVEFS_ERROR::NOTEXIST; + return CURVEFS_ERROR::NOT_EXIST; } auto rc = rpc_->Lookup(parent, name, entryOut); if (rc == CURVEFS_ERROR::OK) { negative_->Delete(parent, name); - } else if (rc == CURVEFS_ERROR::NOTEXIST) { + } else if (rc == CURVEFS_ERROR::NOT_EXIST) { negative_->Put(parent, name); } return rc; } -CURVEFS_ERROR FileSystem::GetAttr(Request req, Ino ino, AttrOut* attrOut) { +CURVEFS_ERROR FileSystem::GetAttr(Ino ino, AttrOut* attrOut) { InodeAttr attr; + if (!option_.cto && deferSync_->IsDefered(ino, &attr)) { + *attrOut = AttrOut(attr); + return CURVEFS_ERROR::OK; + } + auto rc = rpc_->GetAttr(ino, &attr); if (rc == CURVEFS_ERROR::OK) { *attrOut = AttrOut(attr); @@ -265,7 +269,7 @@ CURVEFS_ERROR FileSystem::GetAttr(Request req, Ino ino, AttrOut* attrOut) { return rc; } -CURVEFS_ERROR FileSystem::OpenDir(Request req, Ino ino, FileInfo* fi) { +CURVEFS_ERROR FileSystem::OpenDir(Ino ino, FileInfo* fi) { InodeAttr attr; CURVEFS_ERROR rc = rpc_->GetAttr(ino, &attr); if (rc != CURVEFS_ERROR::OK) { @@ -287,8 +291,7 @@ CURVEFS_ERROR FileSystem::OpenDir(Request req, Ino ino, FileInfo* fi) { return CURVEFS_ERROR::OK; } -CURVEFS_ERROR FileSystem::ReadDir(Request req, - Ino ino, +CURVEFS_ERROR FileSystem::ReadDir(Ino ino, FileInfo* fi, std::shared_ptr* entries) { bool yes = dirCache_->Get(ino, entries); @@ -306,12 +309,12 @@ CURVEFS_ERROR FileSystem::ReadDir(Request req, return CURVEFS_ERROR::OK; } -CURVEFS_ERROR FileSystem::ReleaseDir(Request req, Ino ino, FileInfo* fi) { +CURVEFS_ERROR FileSystem::ReleaseDir(Ino ino, FileInfo* fi) { ReleaseHandler(fi->fh); return CURVEFS_ERROR::OK; } -CURVEFS_ERROR FileSystem::Open(Request req, Ino ino, FileInfo* fi) { +CURVEFS_ERROR FileSystem::Open(Ino ino, FileInfo* fi) { std::shared_ptr inode; bool yes = openFiles_->IsOpened(ino, &inode); if (yes) { @@ -343,7 +346,7 @@ CURVEFS_ERROR FileSystem::Open(Request req, Ino ino, FileInfo* fi) { return CURVEFS_ERROR::OK; } -CURVEFS_ERROR FileSystem::Release(Request req, Ino ino) { +CURVEFS_ERROR FileSystem::Release(Ino ino) { openFiles_->Close(ino); return CURVEFS_ERROR::OK; } diff --git a/curvefs/src/client/filesystem/filesystem.h b/curvefs/src/client/filesystem/filesystem.h index c2d48db708..eaa6cacc2a 100644 --- a/curvefs/src/client/filesystem/filesystem.h +++ b/curvefs/src/client/filesystem/filesystem.h @@ -67,25 +67,23 @@ class FileSystem { void Destory(); // fuse request - CURVEFS_ERROR Lookup(Request req, - Ino parent, + CURVEFS_ERROR Lookup(Ino parent, const std::string& name, EntryOut* entryOut); - CURVEFS_ERROR GetAttr(Request req, Ino ino, AttrOut* attrOut); + CURVEFS_ERROR GetAttr(Ino ino, AttrOut* attrOut); - CURVEFS_ERROR OpenDir(Request req, Ino ino, FileInfo* fi); + CURVEFS_ERROR OpenDir(Ino ino, FileInfo* fi); - CURVEFS_ERROR ReadDir(Request req, - Ino ino, + CURVEFS_ERROR ReadDir(Ino ino, FileInfo* fi, std::shared_ptr* entries); - CURVEFS_ERROR ReleaseDir(Request req, Ino ino, FileInfo* fi); + CURVEFS_ERROR ReleaseDir(Ino ino, FileInfo* fi); - CURVEFS_ERROR Open(Request req, Ino ino, FileInfo* fi); + CURVEFS_ERROR Open(Ino ino, FileInfo* fi); - CURVEFS_ERROR Release(Request req, Ino ino); + CURVEFS_ERROR Release(Ino ino); // fuse reply: we control all replies to vfs layer in same entrance. void ReplyError(Request req, CURVEFS_ERROR code); @@ -129,15 +127,6 @@ class FileSystem { void ReleaseHandler(uint64_t fh); - // utility: others - FileSystemMember BorrowMember(); - - private: - FRIEND_TEST(FileSystemTest, Attr2Stat); - FRIEND_TEST(FileSystemTest, Entry2Param); - FRIEND_TEST(FileSystemTest, SetEntryTimeout); - FRIEND_TEST(FileSystemTest, SetAttrTimeout); - // utility: convert to system type. void Attr2Stat(InodeAttr* attr, struct stat* stat); @@ -148,6 +137,9 @@ class FileSystem { void SetAttrTimeout(AttrOut* attrOut); + // utility: others + FileSystemMember BorrowMember(); + private: FileSystemOption option_; ExternalMember member; diff --git a/curvefs/src/client/filesystem/lookup_cache.cpp b/curvefs/src/client/filesystem/lookup_cache.cpp index d5c473a114..7e49b0db1c 100644 --- a/curvefs/src/client/filesystem/lookup_cache.cpp +++ b/curvefs/src/client/filesystem/lookup_cache.cpp @@ -83,7 +83,7 @@ bool LookupCache::Put(Ino parent, const std::string& name) { if (yes) { entry.uses++; } else { - entry.uses = 0; + entry.uses = 1; } entry.expireTime = Now() + TimeSpec(option_.negativeTimeoutSec, 0); diff --git a/curvefs/src/client/filesystem/meta.cpp b/curvefs/src/client/filesystem/meta.cpp index 721c7c859b..4c835fd4d7 100644 --- a/curvefs/src/client/filesystem/meta.cpp +++ b/curvefs/src/client/filesystem/meta.cpp @@ -106,7 +106,6 @@ std::string Attr2Str(const InodeAttr& attr) { return ""; } - std::string smode; return absl::StrFormat(" (%d,[%s:0%06o,%d,%d,%d,%d,%d,%d,%d])", attr.inodeid(), StrMode(attr.mode()).c_str(), attr.mode(), attr.nlink(), attr.uid(), attr.gid(), @@ -124,6 +123,10 @@ std::string StrAttr(AttrOut attrOut) { return Attr2Str(attrOut.attr); } +std::string StrAttr(InodeAttr attr) { + return Attr2Str(attr); +} + } // namespace filesystem } // namespace client } // namespace curvefs diff --git a/curvefs/src/client/filesystem/meta.h b/curvefs/src/client/filesystem/meta.h index 1165a1fb4f..c10ec1b0d9 100644 --- a/curvefs/src/client/filesystem/meta.h +++ b/curvefs/src/client/filesystem/meta.h @@ -171,6 +171,8 @@ std::string StrEntry(EntryOut entryOut); std::string StrAttr(AttrOut attrOut); +std::string StrAttr(InodeAttr attr); + } // namespace filesystem } // namespace client } // namespace curvefs diff --git a/curvefs/src/client/filesystem/metric.h b/curvefs/src/client/filesystem/metric.h new file mode 100644 index 0000000000..3627349eda --- /dev/null +++ b/curvefs/src/client/filesystem/metric.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-07-13 + * Author: Jingli Chen (Wine93) + */ + +#ifndef CURVEFS_SRC_CLIENT_FILESYSTEM_METRIC_H_ +#define CURVEFS_SRC_CLIENT_FILESYSTEM_METRIC_H_ + +#include + +#include + +namespace curvefs { +namespace client { +namespace filesystem { + +class DirCacheMetric { + public: + DirCacheMetric() = default; + + void AddEntries(int64_t n) { + metric_.nentries << n; + } + + private: + struct Metric { + Metric() : nentries("filesystem_dircache", "nentries") {} + bvar::Adder nentries; + }; + + Metric metric_; +}; + +class OpenfilesMetric { + public: + OpenfilesMetric() = default; + + void AddOpenfiles(int64_t n) { + metric_.nfiles << n; + } + + private: + struct Metric { + Metric() : nfiles("filesystem_openfiles", "nfiles") {} + bvar::Adder nfiles; + }; + + Metric metric_; +}; + +} // namespace filesystem +} // namespace client +} // namespace curvefs + +#endif // CURVEFS_SRC_CLIENT_FILESYSTEM_METRIC_H_ diff --git a/curvefs/src/client/filesystem/openfile.cpp b/curvefs/src/client/filesystem/openfile.cpp index 49ba785834..944ac77785 100644 --- a/curvefs/src/client/filesystem/openfile.cpp +++ b/curvefs/src/client/filesystem/openfile.cpp @@ -31,8 +31,9 @@ OpenFiles::OpenFiles(OpenFilesOption option, std::shared_ptr deferSync) : rwlock_(), option_(option), - deferSync_(deferSync), - files_(std::make_shared(option.lruSize)) { + deferSync_(deferSync) { + files_ = std::make_shared(option.lruSize); + metric_ = std::make_shared(); LOG(INFO) << "Using openfile lru cache, capacity " << option.lruSize; } @@ -48,6 +49,7 @@ void OpenFiles::Delete(Ino ino, deferSync_->Push(file->inode); } files_->Remove(ino); + metric_->AddOpenfiles(-1); VLOG(1) << "Delete open file cache: ino = " << ino << ", refs = " << file->refs @@ -81,6 +83,7 @@ void OpenFiles::Open(Ino ino, std::shared_ptr inode) { file = std::make_shared(inode); file->refs++; files_->Put(ino, file); + metric_->AddOpenfiles(1); VLOG(1) << "Insert open file cache: ino = " << ino << ", refs = " << file->refs diff --git a/curvefs/src/client/filesystem/openfile.h b/curvefs/src/client/filesystem/openfile.h index 53ce0ae26e..7a88f8626f 100644 --- a/curvefs/src/client/filesystem/openfile.h +++ b/curvefs/src/client/filesystem/openfile.h @@ -30,6 +30,7 @@ #include "curvefs/src/client/filesystem/meta.h" #include "curvefs/src/client/filesystem/defer_sync.h" #include "curvefs/src/client/filesystem/dir_cache.h" +#include "curvefs/src/client/filesystem/metric.h" namespace curvefs { namespace client { @@ -77,6 +78,7 @@ class OpenFiles { OpenFilesOption option_; std::shared_ptr deferSync_; std::shared_ptr files_; + std::shared_ptr metric_; }; } // namespace filesystem diff --git a/curvefs/src/client/filesystem/rpc_client.cpp b/curvefs/src/client/filesystem/rpc_client.cpp index 4f5639d1f3..236c50687f 100644 --- a/curvefs/src/client/filesystem/rpc_client.cpp +++ b/curvefs/src/client/filesystem/rpc_client.cpp @@ -54,7 +54,7 @@ CURVEFS_ERROR RPCClient::Lookup(Ino parent, Dentry dentry; CURVEFS_ERROR rc = dentryManager_->GetDentry(parent, name, &dentry); if (rc != CURVEFS_ERROR::OK) { - if (rc != CURVEFS_ERROR::NOTEXIST) { + if (rc != CURVEFS_ERROR::NOT_EXIST) { LOG(ERROR) << "rpc(lookup::GetDentry) failed, retCode = " << rc << ", parent = " << parent << ", name = " << name; } @@ -80,6 +80,10 @@ CURVEFS_ERROR RPCClient::ReadDir(Ino ino, LOG(ERROR) << "rpc(readdir::ListDentry) failed, retCode = " << rc << ", ino = " << ino; return rc; + } else if (dentries.size() == 0) { + VLOG(3) << "rpc(readdir::ListDentry) success and directory is empty" + << ", ino = " << ino; + return rc; } std::set inos; diff --git a/curvefs/src/client/filesystem/utils.cpp b/curvefs/src/client/filesystem/utils.cpp index 0a6b6c38e0..dd4e2a5c6c 100644 --- a/curvefs/src/client/filesystem/utils.cpp +++ b/curvefs/src/client/filesystem/utils.cpp @@ -40,7 +40,7 @@ bool IsVolmeFile(const InodeAttr& attr) { return attr.type() == FsFileType::TYPE_FILE; } -bool IsSymLink(const InodeAttr& attr) { +bool IsSymlink(const InodeAttr& attr) { return attr.type() == FsFileType::TYPE_SYM_LINK; } diff --git a/curvefs/src/client/filesystem/utils.h b/curvefs/src/client/filesystem/utils.h index 8f37104e1d..706fa3d271 100644 --- a/curvefs/src/client/filesystem/utils.h +++ b/curvefs/src/client/filesystem/utils.h @@ -42,7 +42,7 @@ bool IsS3File(const InodeAttr& attr); bool IsVolmeFile(const InodeAttr& attr); // symbol link -bool IsSymLink(const InodeAttr& attr); +bool IsSymlink(const InodeAttr& attr); struct TimeSpec AttrMtime(const InodeAttr& attr); diff --git a/curvefs/src/client/filesystem/xattr.h b/curvefs/src/client/filesystem/xattr.h new file mode 100644 index 0000000000..26bc3a6c2e --- /dev/null +++ b/curvefs/src/client/filesystem/xattr.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-07-19 + * Author: Jingli Chen (Wine93) + */ + +#include +#include +#include + +#ifndef CURVEFS_SRC_CLIENT_FILESYSTEM_XATTR_H_ +#define CURVEFS_SRC_CLIENT_FILESYSTEM_XATTR_H_ + +namespace curvefs { +namespace client { +namespace filesystem { + +const uint32_t MAX_XATTR_NAME_LENGTH = 255; +const uint32_t MAX_XATTR_VALUE_LENGTH = 64 * 1024; + +const char XATTR_DIR_FILES[] = "curve.dir.files"; +const char XATTR_DIR_SUBDIRS[] = "curve.dir.subdirs"; +const char XATTR_DIR_ENTRIES[] = "curve.dir.entries"; +const char XATTR_DIR_FBYTES[] = "curve.dir.fbytes"; +const char XATTR_DIR_RFILES[] = "curve.dir.rfiles"; +const char XATTR_DIR_RSUBDIRS[] = "curve.dir.rsubdirs"; +const char XATTR_DIR_RENTRIES[] = "curve.dir.rentries"; +const char XATTR_DIR_RFBYTES[] = "curve.dir.rfbytes"; +const char XATTR_DIR_PREFIX[] = "curve.dir"; +const char XATTR_WARMUP_OP[] = "curvefs.warmup.op"; +const char XATTR_WARMUP_OP_LIST[] = "curvefs.warmup.op.list"; + +inline bool IsSpecialXAttr(const std::string& key) { + static std::map xattrs { + { XATTR_DIR_FILES, true }, + { XATTR_DIR_SUBDIRS, true }, + { XATTR_DIR_ENTRIES, true }, + { XATTR_DIR_FBYTES, true }, + { XATTR_DIR_RFILES, true }, + { XATTR_DIR_RSUBDIRS, true }, + { XATTR_DIR_RENTRIES, true }, + { XATTR_DIR_RFBYTES, true }, + { XATTR_DIR_PREFIX, true }, + }; + return xattrs.find(key) != xattrs.end(); +} + +inline bool IsWarmupXAttr(const std::string& key) { + return key == XATTR_WARMUP_OP; +} + +inline bool IsListWarmupXAttr(const std::string& key) { + return key == XATTR_WARMUP_OP_LIST; +} + +} // namespace filesystem +} // namespace client +} // namespace curvefs + +#endif // CURVEFS_SRC_CLIENT_FILESYSTEM_XATTR_H_ diff --git a/curvefs/src/client/fuse_client.cpp b/curvefs/src/client/fuse_client.cpp index 3dfea2b7c4..6f1c0b4771 100644 --- a/curvefs/src/client/fuse_client.cpp +++ b/curvefs/src/client/fuse_client.cpp @@ -23,42 +23,57 @@ #include "curvefs/src/client/fuse_client.h" -#include #include #include +#include #include -#include -#include #include +#include #include #include +#include +#include "absl/memory/memory.h" #include "curvefs/proto/mds.pb.h" +#include "curvefs/src/client/client_operator.h" #include "curvefs/src/client/common/common.h" #include "curvefs/src/client/filesystem/error.h" +#include "curvefs/src/client/filesystem/xattr.h" #include "curvefs/src/client/fuse_common.h" -#include "curvefs/src/client/client_operator.h" #include "curvefs/src/client/inode_wrapper.h" +#include "curvefs/src/client/rpcclient/fsdelta_updater.h" +#include "curvefs/src/client/rpcclient/fsquota_checker.h" #include "curvefs/src/client/warmup/warmup_manager.h" #include "curvefs/src/client/xattr_manager.h" #include "curvefs/src/common/define.h" -#include "src/common/net_common.h" -#include "src/common/dummyserver.h" #include "src/client/client_common.h" -#include "absl/memory/memory.h" +#include "src/common/dummyserver.h" +#include "src/common/net_common.h" #define PORT_LIMIT 65535 -using ::curvefs::common::S3Info; -using ::curvefs::common::Volume; -using ::curvefs::mds::topology::PartitionTxId; -using ::curvefs::mds::FSStatusCode_Name; -using ::curvefs::client::common::MAX_XATTR_NAME_LENGTH; -using ::curvefs::client::common::MAX_XATTR_VALUE_LENGTH; -using ::curvefs::client::filesystem::ExternalMember; +using ::curvefs::client::common::FuseClientOption; using ::curvefs::client::filesystem::DirEntry; using ::curvefs::client::filesystem::DirEntryList; +using ::curvefs::client::filesystem::ExternalMember; using ::curvefs::client::filesystem::FileOut; +using ::curvefs::client::filesystem::IsSpecialXAttr; +using ::curvefs::client::filesystem::MAX_XATTR_NAME_LENGTH; +using ::curvefs::client::filesystem::MAX_XATTR_VALUE_LENGTH; +using ::curvefs::client::filesystem::XATTR_DIR_ENTRIES; +using ::curvefs::client::filesystem::XATTR_DIR_FBYTES; +using ::curvefs::client::filesystem::XATTR_DIR_FILES; +using ::curvefs::client::filesystem::XATTR_DIR_PREFIX; +using ::curvefs::client::filesystem::XATTR_DIR_RENTRIES; +using ::curvefs::client::filesystem::XATTR_DIR_RFBYTES; +using ::curvefs::client::filesystem::XATTR_DIR_RFILES; +using ::curvefs::client::filesystem::XATTR_DIR_RSUBDIRS; +using ::curvefs::client::filesystem::XATTR_DIR_SUBDIRS; +using ::curvefs::common::FSType; +using ::curvefs::common::S3Info; +using ::curvefs::common::Volume; +using ::curvefs::mds::FSStatusCode_Name; +using ::curvefs::mds::topology::PartitionTxId; #define RETURN_IF_UNSUCCESS(action) \ do { \ @@ -88,6 +103,7 @@ DECLARE_uint64(fuseClientBurstReadIopsSecs); DECLARE_uint64(fuseClientAvgReadBytes); DECLARE_uint64(fuseClientBurstReadBytes); DECLARE_uint64(fuseClientBurstReadBytesSecs); +DECLARE_bool(fs_disableXattr); } // namespace common } // namespace client } // namespace curvefs @@ -186,6 +202,9 @@ CURVEFS_ERROR FuseClient::Init(const FuseClientOption &option) { warmupManager_->SetFsInfo(fsInfo_); } + FsDeltaUpdater::GetInstance().Init(); + FsQuotaChecker::GetInstance().Init(); + InitQosParam(); return CURVEFS_ERROR::OK; @@ -267,8 +286,8 @@ CURVEFS_ERROR FuseClient::FuseOpLookup(fuse_req_t req, fuse_ino_t parent, const char* name, EntryOut* entryOut) { - CURVEFS_ERROR rc = fs_->Lookup(req, parent, name, entryOut); - if (rc != CURVEFS_ERROR::OK && rc != CURVEFS_ERROR::NOTEXIST) { + CURVEFS_ERROR rc = fs_->Lookup(parent, name, entryOut); + if (rc != CURVEFS_ERROR::OK && rc != CURVEFS_ERROR::NOT_EXIST) { LOG(ERROR) << "Lookup() failed, retCode = " << rc << ", parent = " << parent << ", name = " << name; } @@ -317,8 +336,8 @@ CURVEFS_ERROR FuseClient::HandleOpenFlags(fuse_req_t req, // update parent summary info const Inode *inode = inodeWrapper->GetInodeLocked(); XAttr xattr; - xattr.mutable_xattrinfos()->insert({XATTRFBYTES, - std::to_string(length)}); + xattr.mutable_xattrinfos()->insert( + {XATTR_DIR_FBYTES, std::to_string(length)}); for (const auto &it : inode->parent()) { auto tret = xattrManager_->UpdateParentInodeXattr( it, xattr, false); @@ -331,7 +350,7 @@ CURVEFS_ERROR FuseClient::HandleOpenFlags(fuse_req_t req, } inodeWrapper->GetInodeAttrLocked(&fileOut->attr); } else { - return CURVEFS_ERROR::NOPERMISSION; + return CURVEFS_ERROR::NO_PERMISSION; } } return CURVEFS_ERROR::OK; @@ -341,7 +360,7 @@ CURVEFS_ERROR FuseClient::FuseOpOpen(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi, FileOut* fileOut) { - CURVEFS_ERROR rc = fs_->Open(req, ino, fi); + CURVEFS_ERROR rc = fs_->Open(ino, fi); if (rc != CURVEFS_ERROR::OK) { LOG(ERROR) << "open(" << ino << ") failed, retCode = " << rc; return rc; @@ -388,19 +407,19 @@ CURVEFS_ERROR FuseClient::MakeNode( bool internal, std::shared_ptr& inodeWrapper) { if (strlen(name) > option_.fileSystemOption.maxNameLength) { - return CURVEFS_ERROR::NAMETOOLONG; + return CURVEFS_ERROR::NAME_TOO_LONG; } // check if node is recycle or under recycle if (!internal && strcmp(name, RECYCLENAME) == 0 && parent == ROOTINODEID) { LOG(WARNING) << "Can not make node " << RECYCLENAME << " under root dir."; - return CURVEFS_ERROR::NOPERMISSION; + return CURVEFS_ERROR::NO_PERMISSION; } if (!internal && parent == RECYCLEINODEID) { LOG(WARNING) << "Can not make node under recycle."; - return CURVEFS_ERROR::NOPERMISSION; + return CURVEFS_ERROR::NO_PERMISSION; } const struct fuse_ctx *ctx = fuse_req_ctx(req); @@ -411,6 +430,7 @@ CURVEFS_ERROR FuseClient::MakeNode( } else { param.length = 0; } + param.uid = ctx->uid; param.gid = ctx->gid; param.mode = mode; @@ -462,14 +482,14 @@ CURVEFS_ERROR FuseClient::MakeNode( if (enableSumInDir_.load()) { // update parent summary info XAttr xattr; - xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"}); + xattr.mutable_xattrinfos()->insert({XATTR_DIR_ENTRIES, "1"}); if (type == FsFileType::TYPE_DIRECTORY) { - xattr.mutable_xattrinfos()->insert({XATTRSUBDIRS, "1"}); + xattr.mutable_xattrinfos()->insert({XATTR_DIR_SUBDIRS, "1"}); } else { - xattr.mutable_xattrinfos()->insert({XATTRFILES, "1"}); + xattr.mutable_xattrinfos()->insert({XATTR_DIR_FILES, "1"}); } - xattr.mutable_xattrinfos()->insert({XATTRFBYTES, - std::to_string(inodeWrapper->GetLength())}); + xattr.mutable_xattrinfos()->insert( + {XATTR_DIR_FBYTES, std::to_string(inodeWrapper->GetLength())}); auto tret = xattrManager_->UpdateParentInodeXattr(parent, xattr, true); if (tret != CURVEFS_ERROR::OK) { LOG(ERROR) << "UpdateParentInodeXattr failed," @@ -541,14 +561,14 @@ CURVEFS_ERROR FuseClient::DeleteNode(uint64_t ino, fuse_ino_t parent, if (enableSumInDir_.load()) { // update parent summary info XAttr xattr; - xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"}); + xattr.mutable_xattrinfos()->insert({XATTR_DIR_ENTRIES, "1"}); if (FsFileType::TYPE_DIRECTORY == type) { - xattr.mutable_xattrinfos()->insert({XATTRSUBDIRS, "1"}); + xattr.mutable_xattrinfos()->insert({XATTR_DIR_SUBDIRS, "1"}); } else { - xattr.mutable_xattrinfos()->insert({XATTRFILES, "1"}); + xattr.mutable_xattrinfos()->insert({XATTR_DIR_FILES, "1"}); } - xattr.mutable_xattrinfos()->insert({XATTRFBYTES, - std::to_string(inodeWrapper->GetLength())}); + xattr.mutable_xattrinfos()->insert( + {XATTR_DIR_FBYTES, std::to_string(inodeWrapper->GetLength())}); auto tret = xattrManager_->UpdateParentInodeXattr(parent, xattr, false); if (tret != CURVEFS_ERROR::OK) { LOG(WARNING) << "UpdateParentInodeXattr failed," @@ -575,7 +595,7 @@ CURVEFS_ERROR FuseClient::CreateManageNode(fuse_req_t req, ManageInodeType manageType, EntryOut* entryOut) { if (strlen(name) > option_.fileSystemOption.maxNameLength) { - return CURVEFS_ERROR::NAMETOOLONG; + return CURVEFS_ERROR::NAME_TOO_LONG; } InodeParam param; @@ -632,14 +652,14 @@ CURVEFS_ERROR FuseClient::CreateManageNode(fuse_req_t req, if (enableSumInDir_.load()) { // update parent summary info XAttr xattr; - xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"}); + xattr.mutable_xattrinfos()->insert({XATTR_DIR_ENTRIES, "1"}); if (type == FsFileType::TYPE_DIRECTORY) { - xattr.mutable_xattrinfos()->insert({XATTRSUBDIRS, "1"}); + xattr.mutable_xattrinfos()->insert({XATTR_DIR_SUBDIRS, "1"}); } else { - xattr.mutable_xattrinfos()->insert({XATTRFILES, "1"}); + xattr.mutable_xattrinfos()->insert({XATTR_DIR_FILES, "1"}); } - xattr.mutable_xattrinfos()->insert({XATTRFBYTES, - std::to_string(inodeWrapper->GetLength())}); + xattr.mutable_xattrinfos()->insert( + {XATTR_DIR_FBYTES, std::to_string(inodeWrapper->GetLength())}); auto tret = xattrManager_->UpdateParentInodeXattr(parent, xattr, true); if (tret != CURVEFS_ERROR::OK) { LOG(ERROR) << "UpdateParentInodeXattr failed," @@ -654,12 +674,12 @@ CURVEFS_ERROR FuseClient::CreateManageNode(fuse_req_t req, CURVEFS_ERROR FuseClient::GetOrCreateRecycleDir(fuse_req_t req, Dentry *out) { auto ret = dentryManager_->GetDentry(ROOTINODEID, RECYCLENAME, out); - if (ret != CURVEFS_ERROR::OK && ret != CURVEFS_ERROR::NOTEXIST) { + if (ret != CURVEFS_ERROR::OK && ret != CURVEFS_ERROR::NOT_EXIST) { LOG(ERROR) << "dentryManager_ GetDentry fail, ret = " << ret << ", inode = " << ROOTINODEID << ", name = " << RECYCLENAME; return ret; - } else if (ret == CURVEFS_ERROR::NOTEXIST) { + } else if (ret == CURVEFS_ERROR::NOT_EXIST) { LOG(INFO) << "recycle dir is not exist, create " << RECYCLENAME << ", parentid = " << ROOTINODEID; EntryOut entryOut; @@ -696,12 +716,12 @@ CURVEFS_ERROR FuseClient::MoveToRecycle(fuse_req_t req, fuse_ino_t ino, uint64_t recycleTimeDirIno; ret = dentryManager_->GetDentry(RECYCLEINODEID, recycleTimeDirName.c_str(), &dentry); - if (ret != CURVEFS_ERROR::OK && ret != CURVEFS_ERROR::NOTEXIST) { + if (ret != CURVEFS_ERROR::OK && ret != CURVEFS_ERROR::NOT_EXIST) { LOG(ERROR) << "dentryManager_ GetDentry fail, ret = " << ret << ", inode = " << RECYCLEINODEID << ", name = " << recycleTimeDirName; return ret; - } else if (ret == CURVEFS_ERROR::NOTEXIST) { + } else if (ret == CURVEFS_ERROR::NOT_EXIST) { std::shared_ptr inode; bool internal = true; ret = MakeNode(req, RECYCLEINODEID, recycleTimeDirName.c_str(), @@ -760,13 +780,13 @@ bool FuseClient::ShouldMoveToRecycle(fuse_ino_t parent) { CURVEFS_ERROR FuseClient::RemoveNode(fuse_req_t req, fuse_ino_t parent, const char *name, FsFileType type) { if (strlen(name) > option_.fileSystemOption.maxNameLength) { - return CURVEFS_ERROR::NAMETOOLONG; + return CURVEFS_ERROR::NAME_TOO_LONG; } // check if node is recycle or recycle time dir if ((strcmp(name, RECYCLENAME) == 0 && parent == ROOTINODEID) || parent == RECYCLEINODEID) { - return CURVEFS_ERROR::NOPERMISSION; + return CURVEFS_ERROR::NO_PERMISSION; } Dentry dentry; @@ -791,8 +811,20 @@ CURVEFS_ERROR FuseClient::RemoveNode(fuse_req_t req, fuse_ino_t parent, } if (!dentryList.empty()) { LOG(ERROR) << "rmdir not empty"; - return CURVEFS_ERROR::NOTEMPTY; + return CURVEFS_ERROR::NOT_EMPTY; + } + } + + int64_t deltaBytes = 0; + { + std::shared_ptr inodeWrapper; + ret = inodeManager_->GetInode(ino, inodeWrapper); + if (ret != CURVEFS_ERROR::OK) { + LOG(ERROR) << "inodeManager get inode fail, ret = " << ret + << ", inodeid = " << ino; + return ret; } + deltaBytes = -1 * inodeWrapper->GetLength(); } // check if inode should move to recycle @@ -812,13 +844,15 @@ CURVEFS_ERROR FuseClient::RemoveNode(fuse_req_t req, fuse_ino_t parent, } } + FsDeltaUpdater::GetInstance().UpdateDeltaBytes(deltaBytes); + return CURVEFS_ERROR::OK; } CURVEFS_ERROR FuseClient::FuseOpOpenDir(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) { - CURVEFS_ERROR rc = fs_->OpenDir(req, ino, fi); + CURVEFS_ERROR rc = fs_->OpenDir(ino, fi); if (rc != CURVEFS_ERROR::OK) { LOG(ERROR) << "opendir() failed, retCode = " << rc << ", ino = " << ino; @@ -838,7 +872,7 @@ CURVEFS_ERROR FuseClient::FuseOpReadDir(fuse_req_t req, DirBufferHead* buffer = handler->buffer; if (!handler->padding) { auto entries = std::make_shared(); - CURVEFS_ERROR rc = fs_->ReadDir(req, ino, fi, &entries); + CURVEFS_ERROR rc = fs_->ReadDir(ino, fi, &entries); if (rc != CURVEFS_ERROR::OK) { LOG(ERROR) << "readdir() failed, retCode = " << rc << ", ino = " << ino << ", fh = " << fi->fh; @@ -868,7 +902,7 @@ CURVEFS_ERROR FuseClient::FuseOpReadDir(fuse_req_t req, CURVEFS_ERROR FuseClient::FuseOpReleaseDir(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) { - CURVEFS_ERROR rc = fs_->ReleaseDir(req, ino, fi); + CURVEFS_ERROR rc = fs_->ReleaseDir(ino, fi); if (rc != CURVEFS_ERROR::OK) { LOG(ERROR) << "releasedir() failed, retCode = " << rc << ", ino = " << ino; @@ -887,7 +921,7 @@ CURVEFS_ERROR FuseClient::FuseOpRename(fuse_req_t req, fuse_ino_t parent, // is only used in linux interface renameat(), not required by posix, // we can ignore it now if (flags != 0) { - return CURVEFS_ERROR::INVALIDPARAM; + return CURVEFS_ERROR::INVALID_PARAM; } uint64_t maxNameLength = option_.fileSystemOption.maxNameLength; @@ -896,7 +930,7 @@ CURVEFS_ERROR FuseClient::FuseOpRename(fuse_req_t req, fuse_ino_t parent, << ", name len = " << strlen(name) << ", new name = " << newname << ", new name len = " << strlen(newname) << ", maxNameLength = " << maxNameLength; - return CURVEFS_ERROR::NAMETOOLONG; + return CURVEFS_ERROR::NAME_TOO_LONG; } auto renameOp = @@ -938,7 +972,7 @@ CURVEFS_ERROR FuseClient::FuseOpGetAttr(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi, AttrOut* attrOut) { - CURVEFS_ERROR rc = fs_->GetAttr(req, ino, attrOut); + CURVEFS_ERROR rc = fs_->GetAttr(ino, attrOut); if (rc != CURVEFS_ERROR::OK) { LOG(ERROR) << "getattr() fail, retCode = " << rc << ", ino = " << ino; @@ -1014,8 +1048,8 @@ CURVEFS_ERROR FuseClient::FuseOpSetAttr(fuse_req_t req, // update parent summary info const Inode* inode = inodeWrapper->GetInodeLocked(); XAttr xattr; - xattr.mutable_xattrinfos()->insert({XATTRFBYTES, - std::to_string(std::abs(changeSize))}); + xattr.mutable_xattrinfos()->insert( + {XATTR_DIR_FBYTES, std::to_string(std::abs(changeSize))}); bool direction = changeSize > 0; for (const auto &it : inode->parent()) { auto tret = xattrManager_->UpdateParentInodeXattr( @@ -1043,8 +1077,9 @@ CURVEFS_ERROR FuseClient::FuseOpGetXattr(fuse_req_t req, fuse_ino_t ino, (void)req; VLOG(9) << "FuseOpGetXattr, ino: " << ino << ", name: " << name << ", size = " << size; - if (option_.fileSystemOption.disableXattr) { - return CURVEFS_ERROR::NOSYS; + + if (option_.fileSystemOption.disableXAttr && !IsSpecialXAttr(name)) { + return CURVEFS_ERROR::NODATA; } InodeAttr inodeAttr; @@ -1086,6 +1121,11 @@ CURVEFS_ERROR FuseClient::FuseOpSetXattr(fuse_req_t req, fuse_ino_t ino, VLOG(1) << "FuseOpSetXattr ino: " << ino << ", name: " << name << ", size = " << size << ", strvalue: " << strvalue; + + if (option_.fileSystemOption.disableXAttr && !IsSpecialXAttr(name)) { + return CURVEFS_ERROR::NODATA; + } + if (strname.length() > MAX_XATTR_NAME_LENGTH || size > MAX_XATTR_VALUE_LENGTH) { LOG(ERROR) << "xattr length is too long, name = " << name @@ -1128,36 +1168,26 @@ CURVEFS_ERROR FuseClient::FuseOpListXattr(fuse_req_t req, fuse_ino_t ino, // get xattr key for (const auto &it : inodeAttr.xattr()) { + if (option_.fileSystemOption.disableXAttr && + !IsSpecialXAttr(it.first)) { + continue; + } // +1 because, the format is key\0key\0 *realSize += it.first.length() + 1; } - // add summary xattr key - if (inodeAttr.type() == FsFileType::TYPE_DIRECTORY) { - *realSize += strlen(XATTRRFILES) + 1; - *realSize += strlen(XATTRRSUBDIRS) + 1; - *realSize += strlen(XATTRRENTRIES) + 1; - *realSize += strlen(XATTRRFBYTES) + 1; - } - if (size == 0) { return CURVEFS_ERROR::OK; } else if (size >= *realSize) { for (const auto &it : inodeAttr.xattr()) { + if (option_.fileSystemOption.disableXAttr && + !IsSpecialXAttr(it.first)) { + continue; + } auto tsize = it.first.length() + 1; memcpy(value, it.first.c_str(), tsize); value += tsize; } - if (inodeAttr.type() == FsFileType::TYPE_DIRECTORY) { - memcpy(value, XATTRRFILES, strlen(XATTRRFILES) + 1); - value += strlen(XATTRRFILES) + 1; - memcpy(value, XATTRRSUBDIRS, strlen(XATTRRSUBDIRS) + 1); - value += strlen(XATTRRSUBDIRS) + 1; - memcpy(value, XATTRRENTRIES, strlen(XATTRRENTRIES) + 1); - value += strlen(XATTRRENTRIES) + 1; - memcpy(value, XATTRRFBYTES, strlen(XATTRRFBYTES) + 1); - value += strlen(XATTRRFBYTES) + 1; - } return CURVEFS_ERROR::OK; } return CURVEFS_ERROR::OUT_OF_RANGE; @@ -1169,7 +1199,7 @@ CURVEFS_ERROR FuseClient::FuseOpSymlink(fuse_req_t req, const char* name, EntryOut* entryOut) { if (strlen(name) > option_.fileSystemOption.maxNameLength) { - return CURVEFS_ERROR::NAMETOOLONG; + return CURVEFS_ERROR::NAME_TOO_LONG; } const struct fuse_ctx *ctx = fuse_req_ctx(req); InodeParam param; @@ -1214,10 +1244,10 @@ CURVEFS_ERROR FuseClient::FuseOpSymlink(fuse_req_t req, if (enableSumInDir_.load()) { // update parent summary info XAttr xattr; - xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"}); - xattr.mutable_xattrinfos()->insert({XATTRFILES, "1"}); - xattr.mutable_xattrinfos()->insert({XATTRFBYTES, - std::to_string(inodeWrapper->GetLength())}); + xattr.mutable_xattrinfos()->insert({XATTR_DIR_ENTRIES, "1"}); + xattr.mutable_xattrinfos()->insert({XATTR_DIR_FILES, "1"}); + xattr.mutable_xattrinfos()->insert( + {XATTR_DIR_FBYTES, std::to_string(inodeWrapper->GetLength())}); auto tret = xattrManager_->UpdateParentInodeXattr(parent, xattr, true); if (tret != CURVEFS_ERROR::OK) { LOG(ERROR) << "UpdateParentInodeXattr failed," @@ -1237,7 +1267,7 @@ CURVEFS_ERROR FuseClient::FuseOpLink(fuse_req_t req, FsFileType type, EntryOut* entryOut) { if (strlen(newname) > option_.fileSystemOption.maxNameLength) { - return CURVEFS_ERROR::NAMETOOLONG; + return CURVEFS_ERROR::NAME_TOO_LONG; } std::shared_ptr inodeWrapper; CURVEFS_ERROR ret = inodeManager_->GetInode(ino, inodeWrapper); @@ -1275,10 +1305,10 @@ CURVEFS_ERROR FuseClient::FuseOpLink(fuse_req_t req, if (enableSumInDir_.load()) { // update parent summary info XAttr xattr; - xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"}); - xattr.mutable_xattrinfos()->insert({XATTRFILES, "1"}); - xattr.mutable_xattrinfos()->insert({XATTRFBYTES, - std::to_string(inodeWrapper->GetLength())}); + xattr.mutable_xattrinfos()->insert({XATTR_DIR_ENTRIES, "1"}); + xattr.mutable_xattrinfos()->insert({XATTR_DIR_FILES, "1"}); + xattr.mutable_xattrinfos()->insert( + {XATTR_DIR_FBYTES, std::to_string(inodeWrapper->GetLength())}); auto tret = xattrManager_->UpdateParentInodeXattr( newparent, xattr, true); if (tret != CURVEFS_ERROR::OK) { @@ -1310,7 +1340,7 @@ CURVEFS_ERROR FuseClient::FuseOpReadLink(fuse_req_t req, fuse_ino_t ino, CURVEFS_ERROR FuseClient::FuseOpRelease(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi) { - CURVEFS_ERROR rc = fs_->Release(req, ino); + CURVEFS_ERROR rc = fs_->Release(ino); if (rc != CURVEFS_ERROR::OK) { LOG(ERROR) << "release() failed, ino = " << ino; } diff --git a/curvefs/src/client/fuse_client.h b/curvefs/src/client/fuse_client.h index ea8971f9ba..13adc3c591 100644 --- a/curvefs/src/client/fuse_client.h +++ b/curvefs/src/client/fuse_client.h @@ -43,6 +43,7 @@ #include "curvefs/src/client/common/config.h" #include "curvefs/src/client/dentry_cache_manager.h" #include "curvefs/src/client/dir_buffer.h" +#include "curvefs/src/client/filesystem/error.h" #include "curvefs/src/client/filesystem/filesystem.h" #include "curvefs/src/client/filesystem/meta.h" #include "curvefs/src/client/fuse_common.h" @@ -58,6 +59,7 @@ #include "curvefs/src/common/fast_align.h" #include "curvefs/src/common/s3util.h" #include "src/common/concurrent/concurrent.h" +#include "src/common/configuration.h" #include "src/common/throttle.h" #define DirectIOAlignment 512 @@ -65,10 +67,11 @@ using ::curve::common::Atomic; using ::curve::common::InterruptibleSleeper; using ::curve::common::Thread; +using ::curvefs::client::filesystem::CURVEFS_ERROR; +using ::curvefs::client::metric::FSMetric; using ::curvefs::common::FSType; using ::curvefs::metaserver::DentryFlag; using ::curvefs::metaserver::ManageInodeType; -using ::curvefs::client::metric::FSMetric; namespace curvefs { namespace client { @@ -79,15 +82,16 @@ class WarmupManager; } using common::FuseClientOption; +using ::curve::common::Configuration; +using ::curvefs::client::filesystem::AttrOut; +using ::curvefs::client::filesystem::EntryOut; +using ::curvefs::client::filesystem::FileOut; +using ::curvefs::client::filesystem::FileSystem; using rpcclient::MDSBaseClient; using rpcclient::MdsClient; using rpcclient::MdsClientImpl; using rpcclient::MetaServerClient; using rpcclient::MetaServerClientImpl; -using ::curvefs::client::filesystem::FileSystem; -using ::curvefs::client::filesystem::EntryOut; -using ::curvefs::client::filesystem::AttrOut; -using ::curvefs::client::filesystem::FileOut; using curvefs::common::is_aligned; @@ -294,13 +298,9 @@ class FuseClient { } } - std::shared_ptr GetFsInfo() { - return fsInfo_; - } + std::shared_ptr GetFsInfo() { return fsInfo_; } - std::shared_ptr GetFileSystem() { - return fs_; - } + virtual std::shared_ptr GetFileSystem() { return fs_; } virtual void FlushAll(); diff --git a/curvefs/src/client/fuse_common.h b/curvefs/src/client/fuse_common.h index 280d96aa16..d033afc6bc 100644 --- a/curvefs/src/client/fuse_common.h +++ b/curvefs/src/client/fuse_common.h @@ -26,8 +26,9 @@ #define FUSE_USE_VERSION 34 -#include +#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/curvefs/src/client/fuse_s3_client.cpp b/curvefs/src/client/fuse_s3_client.cpp index e94fe31e2c..ab2524f76a 100644 --- a/curvefs/src/client/fuse_s3_client.cpp +++ b/curvefs/src/client/fuse_s3_client.cpp @@ -20,12 +20,16 @@ * Author: xuchaojie */ +#include "curvefs/src/client/fuse_s3_client.h" +#include #include #include -#include "curvefs/src/client/fuse_s3_client.h" +#include "curvefs/src/client/filesystem/xattr.h" #include "curvefs/src/client/kvclient/memcache_client.h" +#include "curvefs/src/client/rpcclient/fsdelta_updater.h" +#include "curvefs/src/client/rpcclient/fsquota_checker.h" namespace curvefs { namespace client { @@ -41,8 +45,9 @@ DECLARE_bool(supportKVcache); namespace curvefs { namespace client { -using curvefs::client::common::FLAGS_supportKVcache; using curvefs::client::common::FLAGS_enableCto; +using curvefs::client::common::FLAGS_supportKVcache; +using ::curvefs::client::filesystem::XATTR_DIR_FBYTES; using curvefs::mds::topology::MemcacheClusterInfo; using curvefs::mds::topology::MemcacheServerInfo; @@ -74,7 +79,7 @@ CURVEFS_ERROR FuseS3Client::Init(const FuseClientOption &option) { LOG(ERROR) << "writeCacheMaxByte is too small" << ", at least " << MIN_WRITE_CACHE_SIZE << " (8MB)" ", writeCacheMaxByte = " << writeCacheMaxByte; - return CURVEFS_ERROR::CACHETOOSMALL; + return CURVEFS_ERROR::CACHE_TOO_SMALL; } auto fsCacheManager = std::make_shared( @@ -100,6 +105,8 @@ CURVEFS_ERROR FuseS3Client::Init(const FuseClientOption &option) { inodeManager_, mdsClient_, fsCacheManager, nullptr, kvClientManager_, true); } + ioLatencyMetric_ = absl::make_unique( + fsInfo_->fsname()); return ret; } @@ -116,14 +123,14 @@ bool FuseS3Client::InitKVCache(const KVClientManagerOpt &opt) { // init kvcache client auto memcacheClient = std::make_shared(); - if (!memcacheClient->Init(kvcachecluster)) { + if (!memcacheClient->Init(kvcachecluster, fsInfo_->fsname())) { LOG(ERROR) << "FLAGS_supportKVcache = " << FLAGS_supportKVcache << ", but init memcache client fail"; return false; } kvClientManager_ = std::make_shared(); - if (!kvClientManager_->Init(opt, memcacheClient)) { + if (!kvClientManager_->Init(opt, memcacheClient, fsInfo_->fsname())) { LOG(ERROR) << "FLAGS_supportKVcache = " << FLAGS_supportKVcache << ", but init kvClientManager fail"; return false; @@ -161,7 +168,7 @@ CURVEFS_ERROR FuseS3Client::FuseOpWrite(fuse_req_t req, fuse_ino_t ino, if (fi->flags & O_DIRECT) { if (!(is_aligned(off, DirectIOAlignment) && is_aligned(size, DirectIOAlignment))) - return CURVEFS_ERROR::INVALIDPARAM; + return CURVEFS_ERROR::INVALID_PARAM; } uint64_t start = butil::cpuwide_time_us(); int wRet = s3Adaptor_->Write(ino, off, size, buf); @@ -169,14 +176,8 @@ CURVEFS_ERROR FuseS3Client::FuseOpWrite(fuse_req_t req, fuse_ino_t ino, LOG(ERROR) << "s3Adaptor_ write failed, ret = " << wRet; return CURVEFS_ERROR::INTERNAL; } - - if (fsMetric_.get() != nullptr) { - fsMetric_->userWrite.bps.count << wRet; - fsMetric_->userWrite.qps.count << 1; - uint64_t duration = butil::cpuwide_time_us() - start; - fsMetric_->userWrite.latency << duration; - fsMetric_->userWriteIoSize.set_value(wRet); - } + uint64_t mid = butil::cpuwide_time_us(); + ioLatencyMetric_->writeDataLatency << mid - start; std::shared_ptr inodeWrapper; CURVEFS_ERROR ret = inodeManager_->GetInode(ino, inodeWrapper); @@ -194,6 +195,9 @@ CURVEFS_ERROR FuseS3Client::FuseOpWrite(fuse_req_t req, fuse_ino_t ino, if (inodeWrapper->GetLengthLocked() < off + *wSize) { changeSize = off + *wSize - inodeWrapper->GetLengthLocked(); inodeWrapper->SetLengthLocked(off + *wSize); + if (!FsQuotaChecker::GetInstance().QuotaBytesCheck(changeSize)) { + return CURVEFS_ERROR::NO_SPACE; + } } inodeWrapper->UpdateTimestampLocked(kModifyTime | kChangeTime); @@ -207,8 +211,8 @@ CURVEFS_ERROR FuseS3Client::FuseOpWrite(fuse_req_t req, fuse_ino_t ino, if (enableSumInDir_ && changeSize != 0) { const Inode* inode = inodeWrapper->GetInodeLocked(); XAttr xattr; - xattr.mutable_xattrinfos()->insert({XATTRFBYTES, - std::to_string(changeSize)}); + xattr.mutable_xattrinfos()->insert( + {XATTR_DIR_FBYTES, std::to_string(changeSize)}); for (const auto &it : inode->parent()) { auto tret = xattrManager_->UpdateParentInodeXattr(it, xattr, true); if (tret != CURVEFS_ERROR::OK) { @@ -219,7 +223,18 @@ CURVEFS_ERROR FuseS3Client::FuseOpWrite(fuse_req_t req, fuse_ino_t ino, } } + FsDeltaUpdater::GetInstance().UpdateDeltaBytes(changeSize); + inodeWrapper->GetInodeAttrLocked(&fileOut->attr); + + if (fsMetric_.get() != nullptr) { + fsMetric_->userWrite.bps.count << wRet; + fsMetric_->userWrite.qps.count << 1; + uint64_t duration = butil::cpuwide_time_us() - start; + fsMetric_->userWrite.latency << duration; + fsMetric_->userWriteIoSize.set_value(wRet); + } + ioLatencyMetric_->writeAttrLatency << butil::cpuwide_time_us() - mid; return ret; } @@ -232,7 +247,7 @@ CURVEFS_ERROR FuseS3Client::FuseOpRead(fuse_req_t req, fuse_ino_t ino, if (fi->flags & O_DIRECT) { if (!(is_aligned(off, DirectIOAlignment) && is_aligned(size, DirectIOAlignment))) - return CURVEFS_ERROR::INVALIDPARAM; + return CURVEFS_ERROR::INVALID_PARAM; } uint64_t start = butil::cpuwide_time_us(); @@ -243,6 +258,8 @@ CURVEFS_ERROR FuseS3Client::FuseOpRead(fuse_req_t req, fuse_ino_t ino, << ", inodeid = " << ino; return ret; } + uint64_t mid = butil::cpuwide_time_us(); + ioLatencyMetric_->readAttrLatency << mid - start; uint64_t fileSize = inodeWrapper->GetLength(); size_t len = 0; @@ -262,6 +279,11 @@ CURVEFS_ERROR FuseS3Client::FuseOpRead(fuse_req_t req, fuse_ino_t ino, return CURVEFS_ERROR::INTERNAL; } *rSize = rRet; + ioLatencyMetric_->readDataLatency << butil::cpuwide_time_us() - mid; + + ::curve::common::UniqueLock lgGuard = inodeWrapper->GetUniqueLock(); + inodeWrapper->UpdateTimestampLocked(kAccessTime); + inodeManager_->ShipToFlush(inodeWrapper); if (fsMetric_.get() != nullptr) { fsMetric_->userRead.bps.count << rRet; @@ -271,10 +293,6 @@ CURVEFS_ERROR FuseS3Client::FuseOpRead(fuse_req_t req, fuse_ino_t ino, fsMetric_->userReadIoSize.set_value(rRet); } - ::curve::common::UniqueLock lgGuard = inodeWrapper->GetUniqueLock(); - inodeWrapper->UpdateTimestampLocked(kAccessTime); - inodeManager_->ShipToFlush(inodeWrapper); - VLOG(9) << "read end, read size = " << *rSize; return ret; } diff --git a/curvefs/src/client/fuse_s3_client.h b/curvefs/src/client/fuse_s3_client.h index cd1154beb8..1b4b4a70b4 100644 --- a/curvefs/src/client/fuse_s3_client.h +++ b/curvefs/src/client/fuse_s3_client.h @@ -24,13 +24,14 @@ #ifndef CURVEFS_SRC_CLIENT_FUSE_S3_CLIENT_H_ #define CURVEFS_SRC_CLIENT_FUSE_S3_CLIENT_H_ +#include #include #include -#include -#include #include +#include #include "curvefs/src/client/fuse_client.h" +#include "curvefs/src/client/metric/client_metric.h" #include "curvefs/src/client/s3/client_s3_cache_manager.h" #include "curvefs/src/client/warmup/warmup_manager.h" #include "curvefs/src/volume/common.h" @@ -133,6 +134,7 @@ class FuseS3Client : public FuseClient { // s3 adaptor std::shared_ptr s3Adaptor_; std::shared_ptr kvClientManager_; + std::unique_ptr ioLatencyMetric_; static constexpr auto MIN_WRITE_CACHE_SIZE = 8 * kMiB; }; diff --git a/curvefs/src/client/fuse_volume_client.cpp b/curvefs/src/client/fuse_volume_client.cpp index fc270a0282..26bcecdaa7 100644 --- a/curvefs/src/client/fuse_volume_client.cpp +++ b/curvefs/src/client/fuse_volume_client.cpp @@ -150,7 +150,7 @@ CURVEFS_ERROR FuseVolumeClient::FuseOpWrite(fuse_req_t req, if (!(is_aligned(off, DirectIOAlignment) && is_aligned(size, DirectIOAlignment))) { fsMetric_->userWrite.eps.count << 1; - return CURVEFS_ERROR::INVALIDPARAM; + return CURVEFS_ERROR::INVALID_PARAM; } } @@ -208,7 +208,7 @@ CURVEFS_ERROR FuseVolumeClient::FuseOpRead(fuse_req_t req, is_aligned(size, DirectIOAlignment))) { fsMetric_->userRead.eps.count << 1; - return CURVEFS_ERROR::INVALIDPARAM; + return CURVEFS_ERROR::INVALID_PARAM; } } diff --git a/curvefs/src/client/inode_cache_manager.cpp b/curvefs/src/client/inode_cache_manager.cpp index b71ac2ffa7..e8601c1526 100644 --- a/curvefs/src/client/inode_cache_manager.cpp +++ b/curvefs/src/client/inode_cache_manager.cpp @@ -147,7 +147,7 @@ CURVEFS_ERROR InodeCacheManagerImpl::BatchGetInodeAttrAsync( // split inodeIds by partitionId and batch limit std::vector> inodeGroups; if (!metaClient_->SplitRequestInodes(fsId_, *inodeIds, &inodeGroups)) { - return CURVEFS_ERROR::NOTEXIST; + return CURVEFS_ERROR::NOT_EXIST; } ::curve::common::Mutex mutex; diff --git a/curvefs/src/client/kvclient/kvclient.h b/curvefs/src/client/kvclient/kvclient.h index 9d7b96d857..a96c733762 100644 --- a/curvefs/src/client/kvclient/kvclient.h +++ b/curvefs/src/client/kvclient/kvclient.h @@ -22,6 +22,8 @@ #ifndef CURVEFS_SRC_CLIENT_KVCLIENT_KVCLIENT_H_ #define CURVEFS_SRC_CLIENT_KVCLIENT_KVCLIENT_H_ +#include + #include namespace curvefs { @@ -49,8 +51,9 @@ class KVClient { virtual bool Set(const std::string &key, const char *value, const uint64_t value_len, std::string *errorlog) = 0; - virtual bool Get(const std::string &key, char *value, uint64_t offset, - uint64_t length, std::string *errorlog) = 0; + virtual bool Get(const std::string& key, char* value, uint64_t offset, + uint64_t length, std::string* errorlog, + uint64_t* actLength, memcached_return_t* retCod) = 0; }; } // namespace client diff --git a/curvefs/src/client/kvclient/kvclient_manager.cpp b/curvefs/src/client/kvclient/kvclient_manager.cpp index a4a349080b..c87630758b 100644 --- a/curvefs/src/client/kvclient/kvclient_manager.cpp +++ b/curvefs/src/client/kvclient/kvclient_manager.cpp @@ -21,27 +21,38 @@ */ #include "curvefs/src/client/kvclient/kvclient_manager.h" + #include + +#include "absl/memory/memory.h" +#include "curvefs/src/client/metric/client_metric.h" #include "src/client/client_metric.h" #include "src/common/concurrent/count_down_event.h" using curve::client::LatencyGuard; using curve::common::CountDownEvent; -using curvefs::client::metric::KVClientMetric; +using curvefs::client::metric::KVClientManagerMetric; namespace curvefs { namespace client { -#define ONRETURN(TYPE, RES) \ - if (RES) { \ - kvClientMetric_.kvClient##TYPE.qps.count << 1; \ - } else { \ - kvClientMetric_.kvClient##TYPE.eps.count << 1; \ - } \ +template +void OnReturn(Metric* metric, const TaskSharePtr task) { + task->timer.stop(); + if (task->res) { + curve::client::CollectMetrics(metric, task->length, + task->timer.u_elapsed()); + } else { + metric->eps.count << 1; + } + task->done(task); +} -bool KVClientManager::Init(const KVClientManagerOpt &config, - const std::shared_ptr &kvclient) { +bool KVClientManager::Init(const KVClientManagerOpt& config, + const std::shared_ptr& kvclient, + const std::string& fsName) { client_ = kvclient; + kvClientManagerMetric_ = absl::make_unique(fsName); return threadPool_.Start(config.setThreadPooln) == 0; } @@ -52,31 +63,70 @@ void KVClientManager::Uninit() { void KVClientManager::Set(std::shared_ptr task) { threadPool_.Enqueue([task, this]() { - LatencyGuard guard(&kvClientMetric_.kvClientSet.latency); - std::string error_log; task->res = client_->Set(task->key, task->value, task->length, &error_log); - task->timer.stop(); - ONRETURN(Set, task->res); - - task->done(task); + if (task->res) { + kvClientManagerMetric_->count << 1; + } + OnReturn(&kvClientManagerMetric_->set, task); }); } +void UpdateHitMissMetric(memcached_return_t retCode, + KVClientManagerMetric* metric) { + // https://awesomized.github.io/libmemcached/libmemcached/memcached_return_t.html + switch (retCode) { + case MEMCACHED_SUCCESS: + metric->hit << 1; + break; + case MEMCACHED_DATA_DOES_NOT_EXIST: + // The data requested with the key given was not found. + case MEMCACHED_DATA_EXISTS: + // The data requested with the key given was not found. + case MEMCACHED_DELETED: + // The object requested by the key has been deleted. + case MEMCACHED_NOTFOUND: + // The object requested was not found. + metric->miss << 1; + break; + default: + break; + } +} + void KVClientManager::Get(std::shared_ptr task) { threadPool_.Enqueue([task, this]() { - LatencyGuard guard(&kvClientMetric_.kvClientGet.latency); - std::string error_log; + memcached_return_t retCode; task->res = client_->Get(task->key, task->value, task->offset, - task->length, &error_log); - task->timer.stop(); - ONRETURN(Get, task->res); - - task->done(task); + task->valueLength, &error_log, &task->length, + &retCode); + UpdateHitMissMetric(retCode, kvClientManagerMetric_.get()); + OnReturn(&kvClientManagerMetric_->get, task); }); } +void KVClientManager::Enqueue(std::shared_ptr context) { + auto task = [this, context]() { this->GetKvCache(context); }; + threadPool_.Enqueue(task); +} + +int KVClientManager::GetKvCache( + std::shared_ptr context) { + VLOG(9) << "GetKvCache start: " << context->key; + std::string error_log; + memcached_return_t retCode; + uint64_t actLength = 0; + context->retCode = + !client_->Get(context->key, context->buf, context->offset, context->len, + &error_log, &actLength, &retCode); + context->actualLen = actLength; + context->cb(nullptr, context); + VLOG(9) << "GetKvCache end: " << context->key << ", " << context->retCode + << ", " << context->actualLen; + return 0; +} + } // namespace client } // namespace curvefs diff --git a/curvefs/src/client/kvclient/kvclient_manager.h b/curvefs/src/client/kvclient/kvclient_manager.h index c0ed0e051e..bad99193a8 100644 --- a/curvefs/src/client/kvclient/kvclient_manager.h +++ b/curvefs/src/client/kvclient/kvclient_manager.h @@ -25,19 +25,20 @@ #include -#include +#include #include -#include #include +#include +#include #include "absl/strings/string_view.h" -#include "curvefs/src/client/kvclient/kvclient.h" #include "curvefs/src/client/common/config.h" +#include "curvefs/src/client/kvclient/kvclient.h" #include "curvefs/src/client/metric/client_metric.h" #include "src/common/concurrent/task_thread_pool.h" #include "src/common/s3_adapter.h" -using curvefs::client::metric::KVClientMetric; +using curvefs::client::metric::KVClientManagerMetric; namespace curvefs { namespace client { @@ -45,6 +46,11 @@ namespace client { class KVClientManager; struct SetKVCacheTask; struct GetKVCacheTask; + +class GetKvCacheContext; +class SetKvCacheContext; + +using curve::common::GetObjectAsyncContext; using curve::common::TaskThreadPool; using curvefs::client::common::KVClientManagerOpt; @@ -64,14 +70,20 @@ struct SetKVCacheTask { explicit SetKVCacheTask( const std::string& k, const char* val, const uint64_t len, SetKVCacheDone done = [](const std::shared_ptr&) {}) - : key(k), value(val), length(len), res(false), done(std::move(done)) {} + : key(k), + value(val), + length(len), + res(false), + done(std::move(done)), + timer(butil::Timer::STARTED) {} }; struct GetKVCacheTask { const std::string& key; char* value; uint64_t offset; - uint64_t length; + uint64_t valueLength; + uint64_t length; // actual length of value bool res; GetKVCacheDone done; butil::Timer timer; @@ -82,9 +94,38 @@ struct GetKVCacheTask { : key(k), value(v), offset(off), - length(len), + valueLength(len), + length(0), res(false), - done(std::move(done)) {} + done(std::move(done)), + timer(butil::Timer::STARTED) {} +}; + +using GetKvCacheCallBack = + std::function&)>; + +using SetKvCacheCallBack = + std::function&)>; + +struct KvCacheContext { + std::string key; + uint64_t inodeId; + uint64_t offset; + uint64_t length; + uint64_t chunkIndex; + uint64_t chunkPos; + uint64_t startTime; +}; + +struct GetKvCacheContext : KvCacheContext { + char* value; + bool res; + GetKvCacheCallBack cb; +}; + +struct SetKvCacheContext : KvCacheContext { + const char* value; + SetKvCacheCallBack cb; }; class KVClientManager { @@ -92,8 +133,9 @@ class KVClientManager { KVClientManager() = default; ~KVClientManager() { Uninit(); } - bool Init(const KVClientManagerOpt &config, - const std::shared_ptr &kvclient); + bool Init(const KVClientManagerOpt& config, + const std::shared_ptr& kvclient, + const std::string& fsName); /** * It will get a db client and set the key value asynchronusly. @@ -104,17 +146,22 @@ class KVClientManager { void Get(std::shared_ptr task); - KVClientMetric *GetClientMetricForTesting() { return &kvClientMetric_; } + KVClientManagerMetric* GetMetricForTesting() { + return kvClientManagerMetric_.get(); + } + + void Enqueue(std::shared_ptr context); private: void Uninit(); + int GetKvCache(std::shared_ptr context); private: TaskThreadPool threadPool_; std::shared_ptr client_; - KVClientMetric kvClientMetric_; + std::unique_ptr kvClientManagerMetric_; }; } // namespace client } // namespace curvefs -#endif // CURVEFS_SRC_CLIENT_KVCLIENT_KVCLIENT_MANAGER_H_ +#endif // CURVEFS_SRC_CLIENT_KVCLIENT_KVCLIENT_MANAGER_H_ diff --git a/curvefs/src/client/kvclient/memcache_client.h b/curvefs/src/client/kvclient/memcache_client.h index 82c11347ae..57e82a7f44 100644 --- a/curvefs/src/client/kvclient/memcache_client.h +++ b/curvefs/src/client/kvclient/memcache_client.h @@ -27,10 +27,14 @@ #include #include +#include +#include #include -#include "curvefs/src/client/kvclient/kvclient.h" +#include "absl/memory/memory.h" #include "curvefs/proto/topology.pb.h" +#include "curvefs/src/client/kvclient/kvclient.h" +#include "curvefs/src/client/metric/client_metric.h" namespace curvefs { @@ -83,7 +87,9 @@ class MemCachedClient : public KVClient { explicit MemCachedClient(memcached_st *cli) : client_(cli) {} ~MemCachedClient() { UnInit(); } - bool Init(const MemcacheClusterInfo &kvcachecluster) { + bool Init(const MemcacheClusterInfo& kvcachecluster, + const std::string& fsName) { + metric_ = absl::make_unique(fsName); client_ = memcached(nullptr, 0); for (int i = 0; i < kvcachecluster.servers_size(); i++) { @@ -106,8 +112,9 @@ class MemCachedClient : public KVClient { } } - bool Set(const std::string &key, const char *value, - const uint64_t value_len, std::string *errorlog) override { + bool Set(const std::string& key, const char* value, + const uint64_t value_len, std::string* errorlog) override { + uint64_t start = butil::cpuwide_time_us(); if (nullptr == tcli) { tcli = memcached_clone(nullptr, client_); } @@ -115,17 +122,22 @@ class MemCachedClient : public KVClient { value_len, 0, 0); if (MEMCACHED_SUCCESS == res) { VLOG(9) << "Set key = " << key << " OK"; + curve::client::CollectMetrics(&metric_->set, value_len, + butil::cpuwide_time_us() - start); return true; } *errorlog = ResError(res); memcached_free(tcli); tcli = nullptr; LOG(ERROR) << "Set key = " << key << " error = " << *errorlog; + metric_->set.eps.count << 1; return false; } - bool Get(const std::string &key, char *value, uint64_t offset, - uint64_t length, std::string *errorlog) override { + bool Get(const std::string& key, char* value, uint64_t offset, + uint64_t length, std::string* errorlog, uint64_t* actLength, + memcached_return_t* retCode) override { + uint64_t start = butil::cpuwide_time_us(); if (nullptr == tcli) { // multi thread use a memcached_st* client is unsafe. // should clone it or use memcached_st_pool. @@ -136,11 +148,19 @@ class MemCachedClient : public KVClient { memcached_return_t ue; char *res = memcached_get(tcli, key.c_str(), key.length(), &value_length, &flags, &ue); + if (actLength != nullptr) { + (*actLength) = value_length; + } + if (retCode != nullptr) { + (*retCode) = ue; + } if (MEMCACHED_SUCCESS == ue && res != nullptr && value && value_length >= length) { VLOG(9) << "Get key = " << key << " OK"; memcpy(value, res + offset, length); free(res); + curve::client::CollectMetrics(&metric_->get, value_length, + butil::cpuwide_time_us() - start); return true; } @@ -153,6 +173,7 @@ class MemCachedClient : public KVClient { tcli = nullptr; } + metric_->get.eps.count << 1; return false; } @@ -198,7 +219,8 @@ class MemCachedClient : public KVClient { private: memcached_server_st *server_; - memcached_st *client_; + memcached_st* client_; + std::unique_ptr metric_; }; } // namespace client diff --git a/curvefs/src/client/logger/BUILD b/curvefs/src/client/logger/BUILD new file mode 100644 index 0000000000..e5a115c166 --- /dev/null +++ b/curvefs/src/client/logger/BUILD @@ -0,0 +1,32 @@ +# +# Copyright (c) 2023 NetEase Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +load("//:copts.bzl", "CURVE_DEFAULT_COPTS") + +cc_library( + name = "logger", + srcs = glob(["*.cpp"]), + hdrs = glob(["*.h"]), + copts = CURVE_DEFAULT_COPTS, + visibility = ["//visibility:public"], + deps = [ + "//external:glog", + "@spdlog//:spdlog", + "@com_google_absl//absl/strings:str_format", + "//curvefs/src/common:dynamic_vlog", + "//curvefs/src/client/common:common", + ], +) diff --git a/curvefs/src/client/logger/access_log.cpp b/curvefs/src/client/logger/access_log.cpp new file mode 100644 index 0000000000..28c9255b9f --- /dev/null +++ b/curvefs/src/client/logger/access_log.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-14 + * Author: Jingli Chen (Wine93) + */ + +#include "curvefs/src/client/logger/access_log.h" + +namespace curvefs { +namespace client { +namespace logger { + +std::shared_ptr Logger; +bool inited = false; + +bool InitAccessLog(const std::string& prefix) { + if (inited) { + return true; + } + + std::string filename = StrFormat("%s/access.%d.log", prefix, getpid()); + Logger = spdlog::daily_logger_mt("fuse_access", filename, 0, 0); + spdlog::flush_every(std::chrono::seconds(1)); + inited = true; + return true; +} + +} // namespace logger +} // namespace client +} // namespace curvefs diff --git a/curvefs/src/client/filesystem/access_log.h b/curvefs/src/client/logger/access_log.h similarity index 75% rename from curvefs/src/client/filesystem/access_log.h rename to curvefs/src/client/logger/access_log.h index 1e2067c9b1..5c9e075087 100644 --- a/curvefs/src/client/filesystem/access_log.h +++ b/curvefs/src/client/logger/access_log.h @@ -20,6 +20,8 @@ * Author: Jingli Chen (Wine93) */ +// clang-format off + #include #include #include @@ -32,8 +34,8 @@ #include "absl/strings/str_format.h" #include "curvefs/src/client/common/config.h" -#ifndef CURVEFS_SRC_CLIENT_FILESYSTEM_ACCESS_LOG_H_ -#define CURVEFS_SRC_CLIENT_FILESYSTEM_ACCESS_LOG_H_ +#ifndef CURVEFS_SRC_CLIENT_LOGGER_ACCESS_LOG_H_ +#define CURVEFS_SRC_CLIENT_LOGGER_ACCESS_LOG_H_ namespace curvefs { namespace client { @@ -42,24 +44,20 @@ namespace common { DECLARE_bool(access_logging); } -namespace filesystem { +namespace logger { using ::absl::StrFormat; using ::curvefs::client::common::FLAGS_access_logging; using MessageHandler = std::function; -static std::shared_ptr Logger; +extern std::shared_ptr Logger; +extern bool inited; -bool InitAccessLog(const std::string& prefix) { - std::string filename = StrFormat("%s/access.%d.log", prefix, getpid()); - Logger = spdlog::daily_logger_mt("fuse_access", filename, 0, 0); - spdlog::flush_every(std::chrono::seconds(1)); - return true; -} +bool InitAccessLog(const std::string& prefix); struct AccessLogGuard { explicit AccessLogGuard(MessageHandler handler) - : enable(FLAGS_access_logging), + : enable(FLAGS_access_logging && inited), handler(handler) { if (!enable) { return; @@ -82,8 +80,8 @@ struct AccessLogGuard { butil::Timer timer; }; -} // namespace filesystem +} // namespace logger } // namespace client } // namespace curvefs -#endif // CURVEFS_SRC_CLIENT_FILESYSTEM_ACCESS_LOG_H_ +#endif // CURVEFS_SRC_CLIENT_LOGGER_ACCESS_LOG_H_ diff --git a/curvefs/src/client/logger/error_log.h b/curvefs/src/client/logger/error_log.h new file mode 100644 index 0000000000..a259ce755a --- /dev/null +++ b/curvefs/src/client/logger/error_log.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-07-03 + * Author: Jingli Chen (Wine93) + */ + +// clang-format off + +#include + +#include +#include +#include + +#include "curvefs/src/common/dynamic_vlog.h" + +#ifndef CURVEFS_SRC_CLIENT_LOGGER_ERROR_LOG_H_ +#define CURVEFS_SRC_CLIENT_LOGGER_ERROR_LOG_H_ + +namespace curvefs { +namespace client { +namespace logger { + +using ::curvefs::common::FLAGS_vlog_level; + +inline bool InitErrorLog(const std::string& prefix, + const std::string& name, + int32_t loglevel) { + FLAGS_log_dir = prefix; + FLAGS_v = loglevel; + FLAGS_vlog_level = loglevel; + FLAGS_minloglevel = 0; + FLAGS_logtostderr = 0; + FLAGS_alsologtostderr = 0; + google::InitGoogleLogging(name.c_str()); + return true; +} + +inline void ShutdownErrorLog() { google::ShutdownGoogleLogging(); } + +} // namespace logger +} // namespace client +} // namespace curvefs + +#endif // CURVEFS_SRC_CLIENT_LOGGER_ERROR_LOG_H_ diff --git a/curvefs/src/client/metric/client_metric.cpp b/curvefs/src/client/metric/client_metric.cpp index 6ae27d357f..d6c2592ebb 100644 --- a/curvefs/src/client/metric/client_metric.cpp +++ b/curvefs/src/client/metric/client_metric.cpp @@ -23,11 +23,16 @@ #include "curvefs/src/client/metric/client_metric.h" #include +#include + +#include "src/client/client_metric.h" namespace curvefs { namespace client { namespace metric { +using curve::client::CollectMetrics; + const std::string MDSClientMetric::prefix = "curvefs_mds_client"; // NOLINT const std::string MetaServerClientMetric::prefix = "curvefs_metaserver_client"; // NOLINT const std::string ClientOpMetric::prefix = "curvefs_client"; // NOLINT @@ -35,15 +40,14 @@ const std::string S3MultiManagerMetric::prefix = "curvefs_client_manager"; // N const std::string FSMetric::prefix = "curvefs_client"; // NOLINT const std::string S3Metric::prefix = "curvefs_s3"; // NOLINT const std::string DiskCacheMetric::prefix = "curvefs_disk_cache"; // NOLINT -const std::string KVClientMetric::prefix = "curvefs_kvclient"; // NOLINT +const std::string KVClientManagerMetric::prefix = // NOLINT + "curvefs_kvclient_manager"; // NOLINT +const std::string MemcacheClientMetric::prefix = // NOLINT + "curvefs_memcache_client"; // NOLINT const std::string S3ChunkInfoMetric::prefix = "inode_s3_chunk_info"; // NOLINT const std::string WarmupManagerS3Metric::prefix = "curvefs_warmup"; // NOLINT - -void CollectMetrics(InterfaceMetric* interface, int count, uint64_t u_elapsed) { - interface->bps.count << count; - interface->qps.count << 1; - interface->latency << u_elapsed; -} +const std::string FuseS3ClientIOLatencyMetric::prefix = // NOLINT + "curvefs_fuse_s3_client"; // NOLINT void AsyncContextCollectMetrics( std::shared_ptr s3Metric, diff --git a/curvefs/src/client/metric/client_metric.h b/curvefs/src/client/metric/client_metric.h index 98d0ae11e6..bfbf0f3373 100644 --- a/curvefs/src/client/metric/client_metric.h +++ b/curvefs/src/client/metric/client_metric.h @@ -26,7 +26,9 @@ #include +#include #include +#include #include #include "src/client/client_metric.h" @@ -275,27 +277,69 @@ struct S3Metric { writeSize(prefix, fsName + "_adaptor_write_size", 0) {} }; +template +uint64_t LoadAtomicValue(void* atomValue) { + std::atomic* bytes = reinterpret_cast*>(atomValue); + return static_cast(bytes->load()); +} + struct DiskCacheMetric { static const std::string prefix; std::string fsName; InterfaceMetric writeS3; - bvar::Status diskUsedBytes; + bvar::PassiveStatus usedBytes_; + bvar::PassiveStatus totalBytes_; + InterfaceMetric trim_; - explicit DiskCacheMetric(const std::string &name = "") + explicit DiskCacheMetric(const std::string& name = "", + std::atomic* usedBytes = nullptr, + std::atomic* totalBytes = nullptr) : fsName(!name.empty() ? name : prefix + curve::common::ToHexString(this)), writeS3(prefix, fsName + "_write_s3"), - diskUsedBytes(prefix, fsName + "_diskcache_usedbytes", 0) {} + usedBytes_(prefix, fsName + "_diskcache_usedbytes", + LoadAtomicValue, usedBytes), + totalBytes_(prefix, fsName + "_diskcache_totalbytes", + LoadAtomicValue, totalBytes), + trim_(prefix, fsName + "_diskcache_trim") {} }; -struct KVClientMetric { +struct KVClientManagerMetric { static const std::string prefix; - InterfaceMetric kvClientGet; - InterfaceMetric kvClientSet; - KVClientMetric() - : kvClientGet(prefix, "get"), kvClientSet(prefix, "set") {} + std::string fsName; + InterfaceMetric get; + InterfaceMetric set; + // kvcache count + bvar::Adder count; + // kvcache hit + bvar::Adder hit; + // kvcache miss + bvar::Adder miss; + + explicit KVClientManagerMetric(const std::string& name = "") + : fsName(!name.empty() ? name + : prefix + curve::common::ToHexString(this)), + get(prefix, fsName + "_get"), + set(prefix, fsName + "_set"), + count(prefix, fsName + "_count"), + hit(prefix, fsName + "_hit"), + miss(prefix, fsName + "_miss") {} +}; + +struct MemcacheClientMetric { + static const std::string prefix; + + std::string fsName; + InterfaceMetric get; + InterfaceMetric set; + + explicit MemcacheClientMetric(const std::string& name = "") + : fsName(!name.empty() ? name + : prefix + curve::common::ToHexString(this)), + get(prefix, fsName + "_get"), + set(prefix, fsName + "_set") {} }; struct S3ChunkInfoMetric { @@ -317,8 +361,6 @@ struct WarmupManagerS3Metric { warmupS3CacheSize(prefix, "s3_cache_size") {} }; -void CollectMetrics(InterfaceMetric* interface, int count, uint64_t start); - void AsyncContextCollectMetrics( std::shared_ptr s3Metric, const std::shared_ptr& context); @@ -327,6 +369,25 @@ void AsyncContextCollectMetrics( std::shared_ptr s3Metric, const std::shared_ptr& context); +struct FuseS3ClientIOLatencyMetric { + static const std::string prefix; + + std::string fsName; + + bvar::LatencyRecorder readAttrLatency; + bvar::LatencyRecorder readDataLatency; + bvar::LatencyRecorder writeAttrLatency; + bvar::LatencyRecorder writeDataLatency; + + explicit FuseS3ClientIOLatencyMetric(const std::string& name = "") + : fsName(!name.empty() ? name + : prefix + curve::common::ToHexString(this)), + readAttrLatency(prefix, fsName + "_read_attr_latency"), + readDataLatency(prefix, fsName + "_read_data_latency"), + writeAttrLatency(prefix, fsName + "_write_attr_latency"), + writeDataLatency(prefix, fsName + "_write_data_latency") {} +}; + } // namespace metric } // namespace client } // namespace curvefs diff --git a/curvefs/src/client/rpcclient/BUILD b/curvefs/src/client/rpcclient/BUILD index c0e6927f96..13cdfccf1c 100644 --- a/curvefs/src/client/rpcclient/BUILD +++ b/curvefs/src/client/rpcclient/BUILD @@ -30,6 +30,7 @@ cc_library( "//curvefs/proto:space_cc_proto", "//curvefs/src/client/common", "//curvefs/src/client/metric:client_metric", + "//curvefs/src/client:filesystem_xattr", "//curvefs/src/common:curvefs_common", "//curvefs/src/common:metric_utils", "//external:brpc", diff --git a/curvefs/src/client/rpcclient/fsdelta_updater.cpp b/curvefs/src/client/rpcclient/fsdelta_updater.cpp new file mode 100644 index 0000000000..26cde8e071 --- /dev/null +++ b/curvefs/src/client/rpcclient/fsdelta_updater.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "curvefs/src/client/rpcclient/fsdelta_updater.h" + +namespace curvefs { +namespace client { + +void FsDeltaUpdater::UpdateDeltaBytes(int64_t deltaBytes) { + deltaBytes_.fetch_add(deltaBytes); +} + +int64_t FsDeltaUpdater::GetDeltaBytesAndReset() { + return deltaBytes_.exchange(0); +} + +int64_t FsDeltaUpdater::GetDeltaBytes() { return deltaBytes_.load(); } + +} // namespace client +} // namespace curvefs diff --git a/curvefs/src/client/rpcclient/fsdelta_updater.h b/curvefs/src/client/rpcclient/fsdelta_updater.h new file mode 100644 index 0000000000..e449623702 --- /dev/null +++ b/curvefs/src/client/rpcclient/fsdelta_updater.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CURVEFS_SRC_CLIENT_RPCCLIENT_FSDELTA_UPDATER_H_ +#define CURVEFS_SRC_CLIENT_RPCCLIENT_FSDELTA_UPDATER_H_ + +#include + +namespace curvefs { +namespace client { + +class FsDeltaUpdater { + public: + static FsDeltaUpdater& GetInstance() { + static FsDeltaUpdater instance_; + return instance_; + } + + void Init() { deltaBytes_.store(0); } + + void UpdateDeltaBytes(int64_t deltaBytes); + + int64_t GetDeltaBytesAndReset(); + + int64_t GetDeltaBytes(); + + private: + uint32_t fsId_; + std::atomic deltaBytes_; +}; + +} // namespace client +} // namespace curvefs + +#endif // CURVEFS_SRC_CLIENT_RPCCLIENT_FSDELTA_UPDATER_H_ diff --git a/curvefs/src/client/rpcclient/fsquota_checker.cpp b/curvefs/src/client/rpcclient/fsquota_checker.cpp new file mode 100644 index 0000000000..7a619bc1c4 --- /dev/null +++ b/curvefs/src/client/rpcclient/fsquota_checker.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "curvefs/src/client/rpcclient/fsquota_checker.h" + +#include "curvefs/src/client/rpcclient/fsdelta_updater.h" + +namespace curvefs { + +namespace client { + +void FsQuotaChecker::Init() { + fsCapacityCache_.store(0); + fsUsedBytesCache_.store(0); +} + +bool FsQuotaChecker::QuotaBytesCheck(uint64_t incBytes) { + uint64_t capacity = fsCapacityCache_.load(); + uint64_t usedBytes = fsUsedBytesCache_.load(); + // quota disabled + if (capacity == 0) { + return true; + } + // need consider local delta + auto localDelta = FsDeltaUpdater::GetInstance().GetDeltaBytes(); + return capacity - usedBytes >= localDelta + incBytes; +} + +void FsQuotaChecker::UpdateQuotaCache(uint64_t capacity, uint64_t usedBytes) { + fsCapacityCache_.store(capacity); + fsUsedBytesCache_.store(usedBytes); +} + +} // namespace client + +} // namespace curvefs diff --git a/curvefs/src/client/rpcclient/fsquota_checker.h b/curvefs/src/client/rpcclient/fsquota_checker.h new file mode 100644 index 0000000000..40d2f1f70c --- /dev/null +++ b/curvefs/src/client/rpcclient/fsquota_checker.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CURVEFS_SRC_CLIENT_RPCCLIENT_FSQUOTA_CHECKER_H_ +#define CURVEFS_SRC_CLIENT_RPCCLIENT_FSQUOTA_CHECKER_H_ + +#include + +namespace curvefs { +namespace client { + +class FsQuotaChecker { + public: + static FsQuotaChecker& GetInstance() { + static FsQuotaChecker instance_; + return instance_; + } + + void Init(); + + bool QuotaBytesCheck(uint64_t incBytes); + + void UpdateQuotaCache(uint64_t capacity, uint64_t usedBytes); + + private: + std::atomic fsCapacityCache_; + std::atomic fsUsedBytesCache_; +}; + +} // namespace client + +} // namespace curvefs + +#endif // CURVEFS_SRC_CLIENT_RPCCLIENT_FSQUOTA_CHECKER_H_ diff --git a/curvefs/src/client/rpcclient/mds_client.cpp b/curvefs/src/client/rpcclient/mds_client.cpp index 91a6d5fb86..3c52bf3a5a 100644 --- a/curvefs/src/client/rpcclient/mds_client.cpp +++ b/curvefs/src/client/rpcclient/mds_client.cpp @@ -20,12 +20,15 @@ * Author: lixiaocui */ +#include "curvefs/src/client/rpcclient/mds_client.h" + #include #include #include #include "curvefs/proto/space.pb.h" -#include "curvefs/src/client/rpcclient/mds_client.h" +#include "curvefs/src/client/rpcclient/fsdelta_updater.h" +#include "curvefs/src/client/rpcclient/fsquota_checker.h" #include "curvefs/src/common/metric_utils.h" namespace curvefs { @@ -513,6 +516,11 @@ MdsClientImpl::RefreshSession(const std::vector &txIds, *request.mutable_txids() = {txIds.begin(), txIds.end()}; request.set_fsname(fsName); *request.mutable_mountpoint() = mountpoint; + curvefs::mds::FsDelta fsDelta; + fsDelta.set_bytes( + FsDeltaUpdater::GetInstance().GetDeltaBytesAndReset()); + *request.mutable_fsdelta() = std::move(fsDelta); + mdsbasecli_->RefreshSession(request, &response, cntl, channel); if (cntl->Failed()) { mdsClientMetric_.refreshSession.eps.count << 1; @@ -538,6 +546,10 @@ MdsClientImpl::RefreshSession(const std::vector &txIds, LOG(INFO) << "update enableSumInDir to " << response.enablesumindir(); } + if (response.has_fscapacity() && response.has_fsusedbytes()) { + FsQuotaChecker::GetInstance().UpdateQuotaCache( + response.fscapacity(), response.fsusedbytes()); + } return ret; }; diff --git a/curvefs/src/client/s3/client_s3_adaptor.cpp b/curvefs/src/client/s3/client_s3_adaptor.cpp index d6ce3a8bc9..cf3fa56796 100644 --- a/curvefs/src/client/s3/client_s3_adaptor.cpp +++ b/curvefs/src/client/s3/client_s3_adaptor.cpp @@ -20,19 +20,44 @@ * Author: huyao */ +#include "curvefs/src/client/s3/client_s3_adaptor.h" + #include #include + #include #include #include #include "absl/memory/memory.h" -#include "curvefs/src/client/s3/client_s3_adaptor.h" +#include "curvefs/src/client/rpcclient/fsdelta_updater.h" +#include "curvefs/src/client/rpcclient/fsquota_checker.h" #include "curvefs/src/common/s3util.h" namespace curvefs { - namespace client { + +/** + * use curl -L mdsIp:port/flags/memClusterToLocal?setvalue=true + * for dynamic parameter configuration + */ +static bool pass_uint32(const char*, uint32_t) { return true; } +static bool pass_bool(const char*, bool) { return true; } +DEFINE_bool(memClusterToLocal, true, + "The data in the cache cluster download to local"); +DEFINE_validator(memClusterToLocal, &pass_bool); +DEFINE_bool(s3ToLocal, true, "The data in the s3 storage download to local"); +DEFINE_validator(s3ToLocal, &pass_bool); +DEFINE_uint32( + bigIoSize, 131072, + "read size bigger than this value will read until prefetch is finished"); +DEFINE_validator(bigIoSize, &pass_uint32); +DEFINE_uint32(bigIoRetryTimes, 100, "retry times when read big io failed"); +DEFINE_validator(bigIoRetryTimes, &pass_uint32); +DEFINE_uint32(bigIoRetryIntervalUs, 100, + "retry interval when read big io failed"); +DEFINE_validator(bigIoRetryIntervalUs, &pass_uint32); + CURVEFS_ERROR S3ClientAdaptorImpl::Init( const S3ClientAdaptorOption &option, std::shared_ptr client, @@ -49,12 +74,17 @@ S3ClientAdaptorImpl::Init( LOG(ERROR) << "chunkSize:" << chunkSize_ << " is not integral multiple for the blockSize:" << blockSize_; - return CURVEFS_ERROR::INVALIDPARAM; + return CURVEFS_ERROR::INVALID_PARAM; } prefetchBlocks_ = option.prefetchBlocks; prefetchExecQueueNum_ = option.prefetchExecQueueNum; diskCacheType_ = option.diskCacheOpt.diskCacheType; memCacheNearfullRatio_ = option.nearfullRatio; + FLAGS_memClusterToLocal = option.memClusterToLocal; + FLAGS_s3ToLocal = option.s3ToLocal; + FLAGS_bigIoSize = option.bigIoSize; + FLAGS_bigIoRetryTimes = option.bigIoRetryTimes; + FLAGS_bigIoRetryIntervalUs = option.bigIoRetryIntervalUs; throttleBaseSleepUs_ = option.baseSleepUs; flushIntervalSec_ = option.flushIntervalSec; chunkFlushThreads_ = option.chunkFlushThreads; @@ -100,7 +130,13 @@ S3ClientAdaptorImpl::Init( << ", readCacheMaxByte: " << option.readCacheMaxByte << ", readCacheThreads: " << option.readCacheThreads << ", nearfullRatio: " << option.nearfullRatio - << ", baseSleepUs: " << option.baseSleepUs; + << ", baseSleepUs: " << option.baseSleepUs + << ", memClusterToLocal: " << FLAGS_memClusterToLocal + << ", s3ToLocal: " << FLAGS_s3ToLocal + << ", bigIoSize: " << FLAGS_bigIoSize + << ", bigIoRetryTimes: " << FLAGS_bigIoRetryTimes + << ", bigIoRetryIntervalUs: " << FLAGS_bigIoRetryIntervalUs; + // start chunk flush threads taskPool_.Start(chunkFlushThreads_); return CURVEFS_ERROR::OK; @@ -145,8 +181,8 @@ int S3ClientAdaptorImpl::Write(uint64_t inodeId, uint64_t offset, int ret = fileCacheManager->Write(offset, length, buf); fsCacheManager_->DataCacheByteDec(length); if (s3Metric_ != nullptr) { - metric::CollectMetrics(&s3Metric_->adaptorWrite, ret, - butil::cpuwide_time_us() - start); + curve::client::CollectMetrics(&s3Metric_->adaptorWrite, ret, + butil::cpuwide_time_us() - start); s3Metric_->writeSize.set_value(length); } VLOG(6) << "write end inodeId: " << inodeId << ", ret: " << ret; @@ -167,8 +203,8 @@ int S3ClientAdaptorImpl::Read(uint64_t inodeId, uint64_t offset, return ret; } if (s3Metric_.get() != nullptr) { - metric::CollectMetrics(&s3Metric_->adaptorRead, ret, - butil::cpuwide_time_us() - start); + curve::client::CollectMetrics(&s3Metric_->adaptorRead, ret, + butil::cpuwide_time_us() - start); s3Metric_->readSize.set_value(length); } VLOG(6) << "read end offset:" << offset << ", len:" << length @@ -181,6 +217,7 @@ CURVEFS_ERROR S3ClientAdaptorImpl::Truncate(InodeWrapper *inodeWrapper, const auto *inode = inodeWrapper->GetInodeLocked(); uint64_t fileSize = inode->length(); + int64_t deltaBytes = 0; if (size < fileSize) { VLOG(6) << "Truncate size:" << size << " less than fileSize:" << fileSize; @@ -188,12 +225,15 @@ CURVEFS_ERROR S3ClientAdaptorImpl::Truncate(InodeWrapper *inodeWrapper, fsCacheManager_->FindOrCreateFileCacheManager(fsId_, inode->inodeid()); fileCacheManager->TruncateCache(size, fileSize); - return CURVEFS_ERROR::OK; + deltaBytes = -1 * (fileSize - size); } else if (size == fileSize) { - return CURVEFS_ERROR::OK; } else { VLOG(6) << "Truncate size:" << size << " more than fileSize" << fileSize; + deltaBytes = size - fileSize; + if (!FsQuotaChecker::GetInstance().QuotaBytesCheck(deltaBytes)) { + return CURVEFS_ERROR::NO_SPACE; + } uint64_t offset = fileSize; uint64_t len = size - fileSize; uint64_t index = offset / chunkSize_; @@ -243,8 +283,9 @@ CURVEFS_ERROR S3ClientAdaptorImpl::Truncate(InodeWrapper *inodeWrapper, offset += n; chunkId++; } - return CURVEFS_ERROR::OK; } + FsDeltaUpdater::GetInstance().UpdateDeltaBytes(deltaBytes); + return CURVEFS_ERROR::OK; } void S3ClientAdaptorImpl::ReleaseCache(uint64_t inodeId) { diff --git a/curvefs/src/client/s3/client_s3_adaptor.h b/curvefs/src/client/s3/client_s3_adaptor.h index 5f9e52a528..dcc25c3795 100644 --- a/curvefs/src/client/s3/client_s3_adaptor.h +++ b/curvefs/src/client/s3/client_s3_adaptor.h @@ -143,12 +143,15 @@ class S3ClientAdaptorImpl : public S3ClientAdaptor { CURVEFS_ERROR FlushAllCache(uint64_t inodeId); CURVEFS_ERROR FsSync(); int Stop(); + uint64_t GetBlockSize() { return blockSize_; } + uint64_t GetChunkSize() { return chunkSize_; } + uint32_t GetObjectPrefix() { return objectPrefix_; } @@ -156,32 +159,43 @@ class S3ClientAdaptorImpl : public S3ClientAdaptor { std::shared_ptr GetFsCacheManager() { return fsCacheManager_; } + uint32_t GetFlushInterval() { return flushIntervalSec_; } + std::shared_ptr GetS3Client() { return client_; } + uint32_t GetPrefetchBlocks() { return prefetchBlocks_; } + uint32_t GetDiskCacheType() { return diskCacheType_; } + bool DisableDiskCache() { return diskCacheType_ == DiskCacheType::Disable; } + bool HasDiskCache() { return diskCacheType_ != DiskCacheType::Disable; } + bool IsReadCache() { return diskCacheType_ == DiskCacheType::OnlyRead; } + bool IsReadWriteCache() { return diskCacheType_ == DiskCacheType::ReadWrite; } + std::shared_ptr GetInodeCacheManager() { return inodeManager_; } + std::shared_ptr GetDiskCacheManager() { return diskCacheManagerImpl_; } + FSStatusCode AllocS3ChunkId(uint32_t fsId, uint32_t idNum, uint64_t *chunkId); void FsSyncSignal() { @@ -189,21 +203,26 @@ class S3ClientAdaptorImpl : public S3ClientAdaptor { VLOG(3) << "fs sync signal"; cond_.notify_one(); } + void FsSyncSignalAndDataCacheInc() { std::lock_guard lk(mtx_); fsCacheManager_->DataCacheNumInc(); VLOG(3) << "fs sync signal"; cond_.notify_one(); } + void SetFsId(uint32_t fsId) { fsId_ = fsId; } + uint32_t GetFsId() { return fsId_; } + uint32_t GetPageSize() { return pageSize_; } + void InitMetrics(const std::string &fsName); void SetDiskCache(DiskCacheType type) { @@ -253,6 +272,11 @@ class S3ClientAdaptorImpl : public S3ClientAdaptor { uint32_t flushIntervalSec_; uint32_t chunkFlushThreads_; uint32_t memCacheNearfullRatio_; + bool memClusterToLocal_; + bool s3ToLocal_; + uint32_t bigIoSize_; + uint32_t bigIoRetryTimes_; + uint32_t bigIoRetryIntervalUs_; uint32_t throttleBaseSleepUs_; uint32_t maxReadRetryIntervalMs_; uint32_t readRetryIntervalMs_; diff --git a/curvefs/src/client/s3/client_s3_cache_manager.cpp b/curvefs/src/client/s3/client_s3_cache_manager.cpp index 56c5ed5ca5..1bd098eb71 100644 --- a/curvefs/src/client/s3/client_s3_cache_manager.cpp +++ b/curvefs/src/client/s3/client_s3_cache_manager.cpp @@ -28,6 +28,8 @@ #include #include "absl/cleanup/cleanup.h" +#include "absl/strings/str_split.h" +#include "absl/strings/string_view.h" #include "absl/synchronization/blocking_counter.h" #include "curvefs/src/client/kvclient/kvclient_manager.h" #include "curvefs/src/client/metric/client_metric.h" @@ -37,6 +39,13 @@ namespace curvefs { namespace client { + +DECLARE_bool(memClusterToLocal); +DECLARE_bool(s3ToLocal); +DECLARE_uint32(bigIoSize); +DECLARE_uint32(bigIoRetryTimes); +DECLARE_uint32(bigIoRetryIntervalUs); + namespace common { DECLARE_bool(enableCto); } // namespace common @@ -128,9 +137,9 @@ void FsCacheManager::ReleaseFileCacheManager(uint64_t inodeId) { bool FsCacheManager::Set(DataCachePtr dataCache, std::list::iterator *outIter) { std::lock_guard lk(lruMtx_); - VLOG(3) << "lru current byte:" << lruByte_ - << ",lru max byte:" << readCacheMaxByte_ - << ", dataCache len:" << dataCache->GetLen(); + VLOG(3) << "lru current byte: " << lruByte_ + << ", lru max byte: " << readCacheMaxByte_ + << ", dataCache len: " << dataCache->GetLen(); if (readCacheMaxByte_ == 0) { return false; } @@ -223,7 +232,7 @@ CURVEFS_ERROR FsCacheManager::FsSync(bool force) { g_s3MultiManagerMetric->fileManagerNum << -1; } } - } else if (ret == CURVEFS_ERROR::NOTEXIST) { + } else if (ret == CURVEFS_ERROR::NOT_EXIST) { iter->second->ReleaseCache(); WriteLockGuard writeLockGuard(rwLock_); auto iter1 = fileCacheManagerMap_.find(iter->first); @@ -437,7 +446,7 @@ int FileCacheManager::Read(uint64_t inodeId, uint64_t offset, uint64_t length, if (memCacheMissRequest.empty()) { return actualReadLen; } - + VLOG(6) << "memcache miss request size: " << memCacheMissRequest.size(); // 2. read from localcache and remote cluster std::shared_ptr inodeWrapper; @@ -477,15 +486,29 @@ int FileCacheManager::Read(uint64_t inodeId, uint64_t offset, uint64_t length, return actualReadLen; } -bool FileCacheManager::ReadKVRequestFromLocalCache(const std::string &name, - char *databuf, +bool FileCacheManager::ReadKVRequestFromLocalCache(const std::string& name, + char* databuf, uint64_t offset, uint64_t len) { uint64_t start = butil::cpuwide_time_us(); + if (!s3ClientAdaptor_->HasDiskCache()) { + return false; + } + if (!IsCachedInLocal(name) && len >= FLAGS_bigIoSize && + s3ClientAdaptor_->GetPrefetchBlocks()) { + int retry = 0; + do { + VLOG(6) << "wait for download object: " << name; + bthread_usleep(FLAGS_bigIoRetryIntervalUs); + if (++retry >= FLAGS_bigIoRetryTimes) { + LOG(WARNING) << "download object: " << name << " timeout"; + return false; + } + } while (!IsCachedInLocal(name)); + } - bool mayCached = s3ClientAdaptor_->HasDiskCache() && - s3ClientAdaptor_->GetDiskCacheManager()->IsCached(name); - if (!mayCached) { + if (!IsCachedInLocal(name)) { + VLOG(9) << "not cachd in disk, " << name; return false; } @@ -496,10 +519,12 @@ bool FileCacheManager::ReadKVRequestFromLocalCache(const std::string &name, } if (s3ClientAdaptor_->s3Metric_) { - metric::CollectMetrics(&s3ClientAdaptor_->s3Metric_->adaptorReadS3, len, - butil::cpuwide_time_us() - start); - metric::CollectMetrics(&s3ClientAdaptor_->s3Metric_->readFromDiskCache, - len, butil::cpuwide_time_us() - start); + curve::client::CollectMetrics( + &s3ClientAdaptor_->s3Metric_->adaptorReadS3, len, + butil::cpuwide_time_us() - start); + curve::client::CollectMetrics( + &s3ClientAdaptor_->s3Metric_->readFromDiskCache, len, + butil::cpuwide_time_us() - start); } return true; } @@ -515,7 +540,7 @@ bool FileCacheManager::ReadKVRequestFromRemoteCache(const std::string &name, CountDownEvent event(1); GetKVCacheDone cb = [&](const std::shared_ptr& task) { if (task->res && s3ClientAdaptor_->s3Metric_ != nullptr) { - metric::CollectMetrics( + curve::client::CollectMetrics( &s3ClientAdaptor_->s3Metric_->readFromKVCache, task->length, task->timer.u_elapsed()); } @@ -543,10 +568,11 @@ bool FileCacheManager::ReadKVRequestFromS3(const std::string &name, } if (s3ClientAdaptor_->s3Metric_) { - metric::CollectMetrics(&s3ClientAdaptor_->s3Metric_->adaptorReadS3, - length, butil::cpuwide_time_us() - start); - metric::CollectMetrics(&s3ClientAdaptor_->s3Metric_->readFromS3, length, - butil::cpuwide_time_us() - start); + curve::client::CollectMetrics( + &s3ClientAdaptor_->s3Metric_->adaptorReadS3, length, + butil::cpuwide_time_us() - start); + curve::client::CollectMetrics(&s3ClientAdaptor_->s3Metric_->readFromS3, + length, butil::cpuwide_time_us() - start); } return true; @@ -591,8 +617,34 @@ void FileCacheManager::ProcessKVRequest(const S3ReadRequest &req, char *dataBuf, const uint32_t objectPrefix = s3ClientAdaptor_->GetObjectPrefix(); GetBlockLoc(req.offset, &chunkIndex, &chunkPos, &blockIndex, &blockPos); + std::string prefetchName = curvefs::common::s3util::GenObjName( + req.chunkId, blockIndex, req.compaction, req.fsId, req.inodeId, + objectPrefix); + bool waitDownloading = false; + // if obj is in downloading, wait for it. + while (true) { + { + curve::common::LockGuard lg(downloadMtx_); + if (downloadingObj_.find(prefetchName) != downloadingObj_.end()) { + VLOG(9) << "wait for obj is in downloading: " << prefetchName + << ", size: " << downloadingObj_.size() << ", " + << downloadingObj_.size(); + waitDownloading = true; + } else { + VLOG(9) << "obj is not in downloading: " << prefetchName + << ", size: " << downloadingObj_.size() << ", " + << downloadingObj_.size(); + break; + } + } + if (waitDownloading) { + bthread_usleep(FLAGS_bigIoRetryIntervalUs); + } + } + // prefetch - if (s3ClientAdaptor_->HasDiskCache()) { + if (s3ClientAdaptor_->HasDiskCache() && !waitDownloading && + !IsCachedInLocal(prefetchName)) { PrefetchForBlock(req, fileLen, blockSize, chunkSize, blockIndex); } @@ -670,19 +722,21 @@ void FileCacheManager::ProcessKVRequest(const S3ReadRequest &req, char *dataBuf, } } -void FileCacheManager::PrefetchForBlock(const S3ReadRequest &req, +void FileCacheManager::PrefetchForBlock(const S3ReadRequest& req, uint64_t fileLen, uint64_t blockSize, uint64_t chunkSize, uint64_t startBlockIndex) { uint32_t prefetchBlocks = s3ClientAdaptor_->GetPrefetchBlocks(); + if (prefetchBlocks == 0) { + return; + } uint32_t objectPrefix = s3ClientAdaptor_->GetObjectPrefix(); std::vector> prefetchObjs; - uint64_t blockIndex = startBlockIndex; for (uint32_t i = 0; i < prefetchBlocks; i++) { std::string name = curvefs::common::s3util::GenObjName( - req.chunkId, blockIndex, req.compaction, - req.fsId, req.inodeId, objectPrefix); + req.chunkId, blockIndex, req.compaction, req.fsId, req.inodeId, + objectPrefix); uint64_t maxReadLen = (blockIndex + 1) * blockSize; uint64_t needReadLen = maxReadLen > fileLen ? fileLen - blockIndex * blockSize : blockSize; @@ -695,18 +749,26 @@ void FileCacheManager::PrefetchForBlock(const S3ReadRequest &req, } } - PrefetchS3Objs(prefetchObjs); + // It is configurable whether to write to local cache or not + if (!kvClientManager_ && FLAGS_s3ToLocal) { + // get from s3 directly + PrefetchS3Objs(prefetchObjs, true); + } else if (FLAGS_memClusterToLocal) { + // get from memcached first, if failed, get from s3 + PrefetchS3Objs(prefetchObjs, false); + } } class AsyncPrefetchCallback { public: - AsyncPrefetchCallback(uint64_t inode, S3ClientAdaptorImpl *s3Client) - : inode_(inode), s3Client_(s3Client) {} + AsyncPrefetchCallback(uint64_t inode, S3ClientAdaptorImpl* s3Client, + bool fromS3) + : inode_(inode), s3Client_(s3Client), fromS3_(fromS3) {} - void operator()(const S3Adapter *, - const std::shared_ptr &context) { + void operator()(const S3Adapter*, + const std::shared_ptr& context) { VLOG(9) << "prefetch end: " << context->key << ", len " << context->len - << "actual len: " << context->actualLen; + << "actual len: " << context->actualLen << ", " << fromS3_; std::unique_ptr guard(context->buf); auto fileCache = s3Client_->GetFsCacheManager()->FindFileCacheManager(inode_); @@ -718,8 +780,18 @@ class AsyncPrefetchCallback { return; } - if (context->retCode < 0) { - LOG(WARNING) << "prefetch failed, key: " << context->key; + if (context->retCode != 0 && !fromS3_) { + VLOG(6) << "failed and then get from s3, key: " << context->key; + std::vector> prefetchObjs; + prefetchObjs.push_back(std::make_pair(context->key, context->len)); + fileCache->PrefetchS3Objs(prefetchObjs); + curve::common::LockGuard lg(fileCache->downloadMtx_); + fileCache->downloadingObj_.erase(context->key); + return; + } else if (context->retCode != 0 && fromS3_) { + curve::common::LockGuard lg(fileCache->downloadMtx_); + fileCache->downloadingObj_.erase(context->key); + LOG_EVERY_SECOND(INFO) << "prefetch failed, key: " << context->key; return; } if (s3Client_->s3Metric_ != nullptr) { @@ -736,24 +808,27 @@ class AsyncPrefetchCallback { } if (s3Client_->s3Metric_ != nullptr) { // prefetch to disk - metric::CollectMetrics(&s3Client_->s3Metric_->writeToDiskCache, - context->actualLen, - butil::cpuwide_time_us() - start); + curve::client::CollectMetrics( + &s3Client_->s3Metric_->writeToDiskCache, context->actualLen, + butil::cpuwide_time_us() - start); } { curve::common::LockGuard lg(fileCache->downloadMtx_); fileCache->downloadingObj_.erase(context->key); } + VLOG(9) << "prefetch success: " << context->key; } private: const uint64_t inode_; S3ClientAdaptorImpl *s3Client_; + bool fromS3_; }; void FileCacheManager::PrefetchS3Objs( - const std::vector> &prefetchObjs) { - for (auto &obj : prefetchObjs) { + const std::vector>& prefetchObjs, + bool fromS3) { + for (auto& obj : prefetchObjs) { std::string name = obj.first; uint64_t readLen = obj.second; curve::common::LockGuard lg(downloadMtx_); @@ -762,28 +837,32 @@ void FileCacheManager::PrefetchS3Objs( << ", size: " << downloadingObj_.size(); continue; } - if (s3ClientAdaptor_->GetDiskCacheManager()->IsCached(name)) { + if (IsCachedInLocal(name)) { VLOG(9) << "downloading is exist in cache: " << name << ", size: " << downloadingObj_.size(); continue; } VLOG(9) << "download start: " << name - << ", size: " << downloadingObj_.size(); + << ", size: " << downloadingObj_.size() + << ", from s3: " << fromS3; downloadingObj_.emplace(name); - auto inode = inode_; - auto s3ClientAdaptor = s3ClientAdaptor_; - auto task = [name, inode, s3ClientAdaptor, readLen]() { - char *dataCacheS3 = new char[readLen]; + char* dataCacheS3 = new char[readLen]; + VLOG(9) << "prefetch start: " << name << ", len: " << readLen; + if (fromS3) { auto context = std::make_shared( name, dataCacheS3, 0, readLen, - AsyncPrefetchCallback{inode, s3ClientAdaptor}, - curve::common::ContextType::S3); - VLOG(9) << "prefetch start: " << context->key - << ", len: " << context->len; - s3ClientAdaptor->GetS3Client()->DownloadAsync(context); - }; - s3ClientAdaptor_->PushAsyncTask(task); + AsyncPrefetchCallback{inode_, s3ClientAdaptor_, true}); + auto task = [this, context]() { + s3ClientAdaptor_->GetS3Client()->DownloadAsync(context); + }; + s3ClientAdaptor_->PushAsyncTask(task); + } else { + auto context = std::make_shared( + name, dataCacheS3, 0, readLen, + AsyncPrefetchCallback{inode_, s3ClientAdaptor_, false}); + kvClientManager_->Enqueue(context); + } } return; } @@ -1039,7 +1118,8 @@ void FileCacheManager::ReleaseCache() { } chunkCacheMap_.clear(); - g_s3MultiManagerMetric->chunkManagerNum << -1 * chunNum; + g_s3MultiManagerMetric->chunkManagerNum + << -1 * static_cast(chunNum); return; } @@ -1140,6 +1220,10 @@ CURVEFS_ERROR FileCacheManager::Flush(bool force, bool toS3) { return ret; } +bool FileCacheManager::IsCachedInLocal(const std::string name) { + return s3ClientAdaptor_->GetDiskCacheManager()->IsCached(name); +} + void ChunkCacheManager::ReadChunk(uint64_t index, uint64_t chunkPos, uint64_t readLen, char *dataBuf, uint64_t dataBufOffset, @@ -1297,7 +1381,7 @@ void ChunkCacheManager::ReadByReadCache(uint64_t chunkPos, uint64_t readLen, ReadLockGuard readLockGuard(rwLockRead_); VLOG(9) << "ReadByReadCache chunkPos:" << chunkPos << ",readLen:" << readLen - << ",dataBufOffset:" << dataBufOffset; + << ",dataBufOffset:" << dataBufOffset << "chunkIndex: " << index_; if (dataRCacheMap_.empty()) { VLOG(9) << "dataRCacheMap_ is empty"; ReadRequest request; @@ -1509,7 +1593,7 @@ DataCachePtr ChunkCacheManager::FindWriteableDataCache( } std::vector::iterator iterDel = waitDelVec.begin(); - for (; iterDel != waitDelVec.end(); iterDel++) { + for (; iterDel != waitDelVec.end(); ++iterDel) { auto iter = dataWCacheMap_.find(*iterDel); VLOG(9) << "delete data cache chunkPos:" << iter->second->GetChunkPos() @@ -1576,7 +1660,8 @@ void ChunkCacheManager::AddReadDataCache(DataCachePtr dataCache) { uint64_t actualLen = (*dcpIter)->GetActualLen(); if (s3ClientAdaptor_->GetFsCacheManager()->Delete(dcpIter)) { g_s3MultiManagerMetric->readDataCacheNum << -1; - g_s3MultiManagerMetric->readDataCacheByte << -1 * actualLen; + g_s3MultiManagerMetric->readDataCacheByte + << -1 * static_cast(actualLen); dataRCacheMap_.erase(iter); } } @@ -1669,7 +1754,8 @@ void ChunkCacheManager::TruncateReadCache(uint64_t chunkPos) { if ((dcChunkPos + dcLen) > chunkPos) { if (s3ClientAdaptor_->GetFsCacheManager()->Delete(rIter->second)) { g_s3MultiManagerMetric->readDataCacheNum << -1; - g_s3MultiManagerMetric->readDataCacheByte << -1 * dcActualLen; + g_s3MultiManagerMetric->readDataCacheByte + << -1 * static_cast(dcActualLen); dataRCacheMap_.erase(next(rIter).base()); } } else { @@ -1691,7 +1777,6 @@ void ChunkCacheManager::ReleaseWriteDataCache(const DataCachePtr &dataCache) { CURVEFS_ERROR ChunkCacheManager::Flush(uint64_t inodeId, bool force, bool toS3) { - std::map tmp; curve::common::LockGuard lg(flushMtx_); CURVEFS_ERROR ret = CURVEFS_ERROR::OK; // DataCachePtr dataCache; @@ -1723,7 +1808,7 @@ CURVEFS_ERROR ChunkCacheManager::Flush(uint64_t inodeId, bool force, assert(flushingDataCache_->IsDirty()); do { ret = flushingDataCache_->Flush(inodeId, toS3); - if (ret == CURVEFS_ERROR::NOTEXIST) { + if (ret == CURVEFS_ERROR::NOT_EXIST) { LOG(WARNING) << "dataCache flush failed. ret:" << ret << ",index:" << index_ << ",data chunkpos:" << flushingDataCache_->GetChunkPos(); @@ -2076,7 +2161,7 @@ void DataCache::Write(uint64_t chunkPos, uint64_t len, const char *data, } else { std::vector::const_iterator iter = mergeDataCacheVer.begin(); - for (; iter != mergeDataCacheVer.end(); iter++) { + for (; iter != mergeDataCacheVer.end(); ++iter) { /* ------ ------ DataCache --------------------- WriteData @@ -2126,7 +2211,7 @@ void DataCache::Write(uint64_t chunkPos, uint64_t len, const char *data, } else { std::vector::const_iterator iter = mergeDataCacheVer.begin(); - for (; iter != mergeDataCacheVer.end(); iter++) { + for (; iter != mergeDataCacheVer.end(); ++iter) { /* ------ ------ DataCache ---------------- WriteData @@ -2367,7 +2452,7 @@ CURVEFS_ERROR DataCache::PrepareFlushTasks( [this](const std::shared_ptr& setTask) { if (setTask->res && s3ClientAdaptor_->s3Metric_ != nullptr) { - metric::CollectMetrics( + curve::client::CollectMetrics( &s3ClientAdaptor_->s3Metric_->writeToKVCache, setTask->length, setTask->timer.u_elapsed()); } @@ -2446,8 +2531,9 @@ void DataCache::FlushTaskExecute( SetKVCacheDone kvdone = [&](const std::shared_ptr &task) { kvTaskEvent.Signal(); if (task->res && s3ClientAdaptor_->s3Metric_ != nullptr) { - metric::CollectMetrics(&s3ClientAdaptor_->s3Metric_->writeToKVCache, - task->length, task->timer.u_elapsed()); + curve::client::CollectMetrics( + &s3ClientAdaptor_->s3Metric_->writeToKVCache, task->length, + task->timer.u_elapsed()); } return; }; diff --git a/curvefs/src/client/s3/client_s3_cache_manager.h b/curvefs/src/client/s3/client_s3_cache_manager.h index d27aa308c5..df3d665ac4 100644 --- a/curvefs/src/client/s3/client_s3_cache_manager.h +++ b/curvefs/src/client/s3/client_s3_cache_manager.h @@ -27,19 +27,19 @@ #include #include #include +#include #include #include #include #include -#include #include "curvefs/proto/metaserver.pb.h" #include "curvefs/src/client/filesystem/error.h" +#include "curvefs/src/client/inode_wrapper.h" +#include "curvefs/src/client/kvclient/kvclient_manager.h" #include "curvefs/src/client/s3/client_s3.h" #include "src/common/concurrent/concurrent.h" #include "src/common/concurrent/task_thread_pool.h" -#include "curvefs/src/client/kvclient/kvclient_manager.h" -#include "curvefs/src/client/inode_wrapper.h" using curve::common::ReadLockGuard; using curve::common::RWLock; @@ -370,12 +370,13 @@ class FileCacheManager { void WriteChunk(uint64_t index, uint64_t chunkPos, uint64_t writeLen, const char *dataBuf); void GenerateS3Request(ReadRequest request, - const S3ChunkInfoList &s3ChunkInfoList, - char *dataBuf, std::vector *requests, + const S3ChunkInfoList& s3ChunkInfoList, + char* dataBuf, std::vector* requests, uint64_t fsId, uint64_t inodeId); void PrefetchS3Objs( - const std::vector> &prefetchObjs); + const std::vector>& prefetchObjs, + bool fromS3 = true); void HandleReadRequest(const ReadRequest &request, const S3ChunkInfo &s3ChunkInfo, @@ -403,9 +404,11 @@ class FileCacheManager { // miss read from memory read/write cache, need read from // kv(localdisk/remote cache/s3) - int GenerateKVRequest(const std::shared_ptr &inodeWrapper, - const std::vector &readRequest, - char *dataBuf, std::vector *kvRequest); + int GenerateKVRequest(const std::shared_ptr& inodeWrapper, + const std::vector& readRequest, + char* dataBuf, std::vector* kvRequest); + + bool IsCachedInLocal(const std::string name); enum class ReadStatus { OK = 0, diff --git a/curvefs/src/client/s3/disk_cache_manager.cpp b/curvefs/src/client/s3/disk_cache_manager.cpp index 3f229587c8..1bc2ac2473 100644 --- a/curvefs/src/client/s3/disk_cache_manager.cpp +++ b/curvefs/src/client/s3/disk_cache_manager.cpp @@ -20,17 +20,20 @@ * Author: hzwuhongsong */ +#include "curvefs/src/client/s3/disk_cache_manager.h" + +#include #include #include -#include -#include + +#include #include -#include #include -#include +#include +#include +#include "curvefs/src/client/metric/client_metric.h" #include "curvefs/src/client/s3/client_s3_adaptor.h" -#include "curvefs/src/client/s3/disk_cache_manager.h" #include "curvefs/src/common/s3util.h" namespace curvefs { @@ -244,8 +247,9 @@ int DiskCacheManager::WriteDiskFile(const std::string fileName, const char *buf, // write throttle diskCacheThrottle_.Add(false, length); int ret = cacheWrite_->WriteDiskFile(fileName, buf, length, force); - if (ret > 0) - AddDiskUsedBytes(ret); + if (ret > 0) { + UpdateDiskUsedBytes(ret); + } return ret; } @@ -265,8 +269,9 @@ int DiskCacheManager::WriteReadDirect(const std::string fileName, // write hrottle diskCacheThrottle_.Add(false, length); int ret = cacheRead_->WriteDiskFile(fileName, buf, length); - if (ret > 0) - AddDiskUsedBytes(ret); + if (ret > 0) { + UpdateDiskUsedBytes(ret); + } return ret; } @@ -296,6 +301,7 @@ int64_t DiskCacheManager::UpdateDiskFsUsedRatio() { } int64_t usedPercent = 100 * usedBytes / (usedBytes + availableBytes) + 1; diskFsUsedRatio_.store(usedPercent); + totalBytes_.store(totalBytes); return usedPercent; } @@ -316,8 +322,6 @@ void DiskCacheManager::SetDiskInitUsedBytes() { return; } usedBytes_.fetch_add(usedBytes); - if (metric_.get() != nullptr) - metric_->diskUsedBytes.set_value(usedBytes_); diskUsedInit_.store(true); VLOG(9) << "cache disk used size is: " << result; return; @@ -429,6 +433,7 @@ void DiskCacheManager::TrimCache() { break; } + uint64_t start = butil::cpuwide_time_us(); VLOG(6) << "obj will be removed01: " << cacheKey; cacheReadFile = cacheReadFullDir + "/" + curvefs::common::s3util::GenPathByObjName( @@ -470,7 +475,10 @@ void DiskCacheManager::TrimCache() { << "error is: " << errno; continue; } - DecDiskUsedBytes(statReadFile.st_size); + curve::client::CollectMetrics(&metric_->trim_, + statReadFile.st_size, + butil::cpuwide_time_us() - start); + UpdateDiskUsedBytes(-statReadFile.st_size); VLOG(6) << "remove disk file success, file is: " << cacheKey; } } @@ -507,7 +515,8 @@ int DiskCacheManager::TrimStop() { void DiskCacheManager::InitMetrics(const std::string& fsName, std::shared_ptr s3Metric) { - metric_ = std::make_shared(fsName); + metric_ = + std::make_shared(fsName, &usedBytes_, &totalBytes_); cacheWrite_->InitMetrics(metric_, s3Metric); cacheRead_->InitMetrics(metric_); // this function move to here from init, diff --git a/curvefs/src/client/s3/disk_cache_manager.h b/curvefs/src/client/s3/disk_cache_manager.h index 68b104f4f2..b31c4e793f 100644 --- a/curvefs/src/client/s3/disk_cache_manager.h +++ b/curvefs/src/client/s3/disk_cache_manager.h @@ -138,31 +138,14 @@ class DiskCacheManager { */ bool IsDiskCacheSafe(uint32_t baseRatio); - /** - * @brief add the used bytes of disk cache. - */ - void AddDiskUsedBytes(uint64_t length) { + // update disk used bytes by length + void UpdateDiskUsedBytes(int64_t length) { usedBytes_.fetch_add(length); - if (metric_.get() != nullptr) - metric_->diskUsedBytes.set_value(usedBytes_/1024/1024); - VLOG(9) << "add disk used size is: " << length - << ", now is: " << usedBytes_.load(); - return; - } - /** - * @brief dec the used bytes of disk cache. - * can not dec disk used bytes after file have been loaded, - * because there are link in read cache - */ - void DecDiskUsedBytes(uint64_t length) { - usedBytes_.fetch_sub(length); assert(usedBytes_ >= 0); - if (metric_.get() != nullptr) - metric_->diskUsedBytes.set_value(usedBytes_); - VLOG(9) << "dec disk used size is: " << length + VLOG(9) << "update disk used size is: " << length << ", now is: " << usedBytes_.load(); - return; } + void SetDiskInitUsedBytes(); uint64_t GetDiskUsedbytes() { return usedBytes_.load(); @@ -194,8 +177,11 @@ class DiskCacheManager { curve::common::InterruptibleSleeper sleeper_; curve::common::WaitInterval waitIntervalSec_; uint32_t objectPrefix_; - // used bytes of disk cache + // The size of the object cached to the local disk, + // rather than the size of the used capacity of the cache disk std::atomic usedBytes_; + // Cache disk size + std::atomic totalBytes_; // used ratio of the file system in disk cache std::atomic diskFsUsedRatio_; uint32_t cmdTimeoutSec_; diff --git a/curvefs/src/client/s3/disk_cache_manager_impl.cpp b/curvefs/src/client/s3/disk_cache_manager_impl.cpp index 2d6c1e545a..df080f3c5c 100644 --- a/curvefs/src/client/s3/disk_cache_manager_impl.cpp +++ b/curvefs/src/client/s3/disk_cache_manager_impl.cpp @@ -98,6 +98,7 @@ int DiskCacheManagerImpl::WriteClosure( // set the returned value // it is need in CallBack context->retCode = ret; + context->timer.stop(); context->cb(context); VLOG(9) << "WriteClosure end, name: " << context->key; return 0; @@ -182,8 +183,9 @@ int DiskCacheManagerImpl::Read(const std::string name, char *buf, LOG(ERROR) << "download object fail. object name = " << name; return ret; } - metric::CollectMetrics(&diskCacheManager_->GetS3Metric()->readFromS3, - length, butil::cpuwide_time_us() - start); + curve::client::CollectMetrics( + &diskCacheManager_->GetS3Metric()->readFromS3, length, + butil::cpuwide_time_us() - start); } VLOG(9) << "read success, read name = " << name; return ret; diff --git a/curvefs/src/client/s3/disk_cache_manager_impl.h b/curvefs/src/client/s3/disk_cache_manager_impl.h index 372844baef..f6e02deeb1 100644 --- a/curvefs/src/client/s3/disk_cache_manager_impl.h +++ b/curvefs/src/client/s3/disk_cache_manager_impl.h @@ -79,7 +79,7 @@ class DiskCacheManagerImpl { * @param[in] option config option * @return success: 0, fail : < 0 */ - int Init(const S3ClientAdaptorOption option); + virtual int Init(const S3ClientAdaptorOption option); /** * @brief Write obj * @param[in] name obj name @@ -87,13 +87,13 @@ class DiskCacheManagerImpl { * @param[in] length write length * @return success: write length, fail : < 0 */ - int Write(const std::string name, const char *buf, uint64_t length); + virtual int Write(const std::string name, const char* buf, uint64_t length); /** * @brief whether obj is cached in cached disk * @param[in] name obj name * @return cached: true, not cached : < 0 */ - bool IsCached(const std::string name); + virtual bool IsCached(const std::string name); /** * @brief read obj * @param[in] name obj name @@ -102,17 +102,17 @@ class DiskCacheManagerImpl { * @param[in] length read length * @return success: length, fail : < length */ - int Read(const std::string name, char *buf, uint64_t offset, - uint64_t length); + virtual int Read(const std::string name, char* buf, uint64_t offset, + uint64_t length); /** * @brief umount disk cache * @return success: 0, fail : < 0 */ - int UmountDiskCache(); + virtual int UmountDiskCache(); bool IsDiskCacheFull(); - int WriteReadDirect(const std::string fileName, const char *buf, - uint64_t length); + virtual int WriteReadDirect(const std::string fileName, const char* buf, + uint64_t length); void InitMetrics(std::string fsName, std::shared_ptr s3Metric); virtual int UploadWriteCacheByInode(const std::string &inode); diff --git a/curvefs/src/client/s3/disk_cache_read.cpp b/curvefs/src/client/s3/disk_cache_read.cpp index 4f452a3181..27bee46776 100644 --- a/curvefs/src/client/s3/disk_cache_read.cpp +++ b/curvefs/src/client/s3/disk_cache_read.cpp @@ -85,7 +85,7 @@ int DiskCacheRead::LinkWriteToRead(const std::string fileName, const std::string fullWriteDir, const std::string fullReadDir) { VLOG(6) << "LinkWriteToRead start. name = " << fileName; - std::string fullReadPath, fullWritePath, dirPath; + std::string fullReadPath, fullWritePath; fullWritePath = fullWriteDir + "/" + fileName; fullReadPath = fullReadDir + "/" + fileName; int ret; diff --git a/curvefs/src/client/s3/disk_cache_write.cpp b/curvefs/src/client/s3/disk_cache_write.cpp index cbcb6179c1..640c6bca0a 100644 --- a/curvefs/src/client/s3/disk_cache_write.cpp +++ b/curvefs/src/client/s3/disk_cache_write.cpp @@ -143,9 +143,9 @@ int DiskCacheWrite::UploadFile(const std::string &name, name](const std::shared_ptr& context) { if (context->retCode >= 0) { if (metric_ != nullptr) { - metric::CollectMetrics(&metric_->writeS3, - context->bufferSize, - context->timer.u_elapsed()); + curve::client::CollectMetrics(&metric_->writeS3, + context->bufferSize, + context->timer.u_elapsed()); } if (s3Metric_ != nullptr) { metric::AsyncContextCollectMetrics(s3Metric_, context); @@ -176,7 +176,7 @@ int DiskCacheWrite::UploadFile(const std::string &name, void DiskCacheWrite::UploadFile(const std::list &toUpload, std::shared_ptr syncTask) { std::list::const_iterator iter; - for (iter = toUpload.begin(); iter != toUpload.end(); iter++) { + for (iter = toUpload.begin(); iter != toUpload.end(); ++iter) { UploadFile(*iter, syncTask); } } @@ -403,9 +403,9 @@ int DiskCacheWrite::UploadAllCacheWriteFile() { [&, buffer](const std::shared_ptr& context) { if (context->retCode >= 0) { if (s3Metric_ != nullptr) { - metric::CollectMetrics(&metric_->writeS3, - context->bufferSize, - context->timer.u_elapsed()); + curve::client::CollectMetrics( + &metric_->writeS3, context->bufferSize, + context->timer.u_elapsed()); metric::AsyncContextCollectMetrics(s3Metric_, context); } if (pendingReq.fetch_sub(1, std::memory_order_seq_cst) == @@ -448,7 +448,6 @@ int DiskCacheWrite::RemoveFile(const std::string fileName) { << ", errno = " << errno; return -1; } - cachedObjName_->MoveBack(fileName); VLOG(9) << "remove file success, file = " << fileName; return 0; } diff --git a/curvefs/src/client/sdk_helper.cpp b/curvefs/src/client/sdk_helper.cpp new file mode 100644 index 0000000000..e75ae21978 --- /dev/null +++ b/curvefs/src/client/sdk_helper.cpp @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-08 + * Author: Jingli Chen (Wine93) + */ + +// clang-format off + +#include "curvefs/src/client/logger/access_log.h" +#include "curvefs/src/client/logger/error_log.h" +#include "src/common/gflags_helper.h" +#include "curvefs/src/client/sdk_helper.h" + +namespace curvefs { +namespace client { + +using ::curve::common::GflagsLoadValueFromConfIfCmdNotSet; +using ::curvefs::client::logger::InitAccessLog; +using ::curvefs::client::logger::InitErrorLog; +using ::curvefs::client::logger::ShutdownErrorLog; + +void SDKHelper::InitLog(Configuration* cfg) { + // prefix + std::string prefix; + cfg->GetStringValue("client.common.logDir", &prefix); + + // name + static std::string name = "/curvefs-sdk"; + + // log level + int32_t loglevel = 0; + curve::common::GflagsLoadValueFromConfIfCmdNotSet dummy; + dummy.Load(cfg, "v", "client.loglevel", &loglevel); + + InitErrorLog(prefix, name, loglevel); + InitAccessLog(prefix); +} + +void SDKHelper::InitOption(Configuration* cfg, FuseClientOption* option) { + cfg->PrintConfig(); + InitFuseClientOption(cfg, option); +} + +FSType SDKHelper::Str2Type(const std::string& s) { + if (s == "s3") { + return FSType::TYPE_S3; + } else if (s == "volume") { + return FSType::TYPE_VOLUME; + } + return FSType(); +} + +std::string SDKHelper::Type2Str(FSType t) { + if (t == FSType::TYPE_S3) { + return "s3"; + } else if (t == FSType::TYPE_VOLUME) { + return "volume"; + } + return "unknown"; +} + +bool SDKHelper::GetFsInfoFromMDS(const MdsOption& option, + const std::string& fsname, + FsInfo* info) { + MdsClientImpl client; + MDSBaseClient base; + client.Init(option, &base); + auto rc = client.GetFsInfo(fsname, info); + if (rc != FSStatusCode::OK) { + LOG(ERROR) << "Get fsinfo from mds failed, fsname = " << fsname + << ", retCode = " << FSStatusCode_Name(rc); + return false; + } + return true; +} + +bool SDKHelper::CheckFsType(FSType real, FSType arg) { + if (real != arg) { + LOG(ERROR) << "The fstype obtained from the mds is " + << FSType_Name(real) << ", but user specified is " + << FSType_Name(arg); + return false; + } else if (real != FSType::TYPE_VOLUME && real != FSType::TYPE_S3) { + LOG(ERROR) << "The fstype obtained from the mds is " + << FSType_Name(real) << ", which is not supported"; + return false; + } + return true; +} + +MountOption SDKHelper::GetMountOption(const std::string& fsname, + const std::string& mountpoint) { + auto mountOption = MountOption(); + mountOption.mountPoint = mountpoint.c_str(); + mountOption.fsName = fsname.c_str(); + mountOption.fsType = Type2Str(FSType::TYPE_S3).c_str(); + return mountOption; +} + +CURVEFS_ERROR SDKHelper::CheckMountOption(std::shared_ptr client, + const MdsOption& mdsOption, + MountOption* mountOption) { + FsInfo info; + bool yes = GetFsInfoFromMDS(mdsOption, mountOption->fsName, &info) && + CheckFsType(info.fstype(), Str2Type(mountOption->fsType)); + if (!yes) { + return CURVEFS_ERROR::INTERNAL; + } + client->SetFsInfo(std::make_shared(info)); + return CURVEFS_ERROR::OK; +} + +CURVEFS_ERROR SDKHelper::Mount(std::shared_ptr client, + const std::string& fsname, + const std::string& mountpoint, + FuseClientOption option) { + auto mountOption = GetMountOption(fsname, mountpoint); + auto rc = CheckMountOption(client, option.mdsOpt, &mountOption); + if (rc != CURVEFS_ERROR::OK) { + return rc; + } + + rc = client->Init(option); + if (rc != CURVEFS_ERROR::OK) { + return rc; + } + + rc = client->Run(); + if (rc != CURVEFS_ERROR::OK) { + return rc; + } + + rc = client->SetMountStatus(&mountOption); + if (rc != CURVEFS_ERROR::OK) { + return rc; + } + + return client->FuseOpInit(nullptr, nullptr); +} + +CURVEFS_ERROR SDKHelper::Umount(std::shared_ptr client, + const std::string& fsname, + const std::string& mountpoint) { + auto mountOption = GetMountOption(fsname, mountpoint); + client->FuseOpDestroy(&mountOption); + client->Fini(); + client->UnInit(); + ShutdownErrorLog(); + return CURVEFS_ERROR::OK; +} + +} // namespace client +} // namespace curvefs diff --git a/curvefs/src/client/sdk_helper.h b/curvefs/src/client/sdk_helper.h new file mode 100644 index 0000000000..0a5b3c4fce --- /dev/null +++ b/curvefs/src/client/sdk_helper.h @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-08-08 + * Author: Jingli Chen (Wine93) + */ + +// clang-format off + +#ifndef CURVEFS_SRC_CLIENT_SDK_HELPER_H_ +#define CURVEFS_SRC_CLIENT_SDK_HELPER_H_ + +#include +#include + +#include "curvefs/proto/mds.pb.h" +#include "curvefs/proto/metaserver.pb.h" +#include "curvefs/src/client/common/config.h" +#include "curvefs/src/client/fuse_client.h" +#include "curvefs/src/client/fuse_common.h" +#include "curvefs/src/client/fuse_s3_client.h" +#include "curvefs/src/client/fuse_volume_client.h" +#include "src/common/configuration.h" + +namespace curvefs { +namespace client { + +using ::curve::common::Configuration; +using ::curvefs::client::common::MdsOption; +using ::curvefs::common::FSType; +using ::curvefs::mds::FsInfo; + +class SDKHelper { + public: + SDKHelper() = default; + + void InitLog(Configuration* cfg); + + void InitOption(Configuration* cfg, FuseClientOption* option); + + CURVEFS_ERROR Mount(std::shared_ptr client, + const std::string& fsname, + const std::string& mountpoint, + FuseClientOption option); + + CURVEFS_ERROR Umount(std::shared_ptr client, + const std::string& fsname, + const std::string& mountpoint); + + private: + FSType Str2Type(const std::string& s); + + std::string Type2Str(FSType t); + + bool GetFsInfoFromMDS(const MdsOption& option, + const std::string& fsname, + FsInfo* info); + + bool CheckFsType(FSType real, FSType arg); + + MountOption GetMountOption(const std::string& fsname, + const std::string& mountpoint); + + CURVEFS_ERROR CheckMountOption(std::shared_ptr client, + const MdsOption& mdsOption, + MountOption* mountOption); +}; + +} // namespace client +} // namespace curvefs + +#endif // CURVEFS_SRC_CLIENT_SDK_HELPER_H_ diff --git a/curvefs/src/client/vfs/.clang-format b/curvefs/src/client/vfs/.clang-format new file mode 100644 index 0000000000..a5660a57d8 --- /dev/null +++ b/curvefs/src/client/vfs/.clang-format @@ -0,0 +1,26 @@ +# I don't like current clang-formtter's specified style and +# and i think my style is more intuitive than it :), so I use +# this file to disable format, let us give some code snippet to prove it: +# +# my: +# std::vector tests { +# { " abc", "abc" }, +# { "abc ", "abc" }, +# { " abc ", "abc" }, +# { " a bc ", "a bc" }, +# { "a b c", "a b c" }, +# { " ", "" }, +# +# +# clang-formatter: +# std::vector tests{ +# {" abc", "abc"}, {"abc ", "abc"}, {" abc ", "abc"}, +# {" a bc ", "a bc"}, {"a b c", "a b c"}, {" ", ""}, +# }; +# +# Maybe you have different opinions, but please have a little mercy for me. +# +# by Wine93, 2023-10-16 + +DisableFormat: true +SortIncludes: Never diff --git a/curvefs/src/client/vfs/BUILD b/curvefs/src/client/vfs/BUILD new file mode 100644 index 0000000000..ba2926ff6f --- /dev/null +++ b/curvefs/src/client/vfs/BUILD @@ -0,0 +1,32 @@ +# +# Copyright (c) 2023 NetEase Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +load("//:copts.bzl", "CURVE_DEFAULT_COPTS") + +cc_library( + name = "vfs", + srcs = glob(["*.cpp"]), + hdrs = glob(["*.h"]), + copts = CURVE_DEFAULT_COPTS, + visibility = ["//visibility:public"], + deps = [ + "@incbin//:incbin", + "//src/common:curve_common", + "//curvefs/proto:metaserver_cc_proto", + "//curvefs/src/client:filesystem", + "//curvefs/src/client/logger:logger", + ], +) diff --git a/curvefs/src/client/vfs/README.md b/curvefs/src/client/vfs/README.md new file mode 100644 index 0000000000..b074365365 --- /dev/null +++ b/curvefs/src/client/vfs/README.md @@ -0,0 +1,21 @@ + +CurveFS VFS Design +=== + +Permission +--- + +`uid/gid` AND `euid/egid` AND `suid/sgid` + +```C++ +euid = uid +egid = gid + +if (suid != NULL) { + euid = suid; +} + +if (sgid != NULL) { + egid = sgid; +} +``` diff --git a/curvefs/src/client/vfs/cache.cpp b/curvefs/src/client/vfs/cache.cpp new file mode 100644 index 0000000000..c10fe93aff --- /dev/null +++ b/curvefs/src/client/vfs/cache.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-07-04 + * Author: Jingli Chen (Wine93) + */ + +#include + +#include "absl/strings/str_format.h" +#include "curvefs/src/client/filesystem/utils.h" +#include "curvefs/src/client/vfs/cache.h" + +namespace curvefs { +namespace client { +namespace vfs { + +#define RETURN_FALSE_IF_DISABLED() \ + do { \ + if (!enable_) { \ + return false; \ + } \ + } while (0) + +using ::curvefs::client::filesystem::Now; + +EntryCache::EntryCache(size_t lruSize) + : enable_(lruSize > 0), + lru_(std::make_shared(lruSize)) {} + +std::string EntryCache::EntryKey(Ino parent, const std::string& name) { + return absl::StrFormat("%lu:%s", parent, name); +} + +bool EntryCache::Get(Ino parent, const std::string& name, Ino* ino) { + RETURN_FALSE_IF_DISABLED(); + Entry value; + auto key = EntryKey(parent, name); + bool yes = lru_->Get(key, &value); + if (!yes) { + return false; + } else if (value.expire < Now()) { + return false; + } + *ino = value.ino; + return true; +} + +bool EntryCache::Put(Ino parent, + const std::string& name, + Ino ino, + uint64_t timeoutSec) { + RETURN_FALSE_IF_DISABLED(); + auto key = EntryKey(parent, name); + Entry value; + value.ino = ino; + value.expire = Now() + TimeSpec(timeoutSec, 0); + lru_->Put(key, value); + return true; +} + +bool EntryCache::Delete(Ino parent, const std::string& name) { + RETURN_FALSE_IF_DISABLED(); + auto key = EntryKey(parent, name); + lru_->Remove(key); + return true; +} + +size_t EntryCache::Size() { + return lru_->Size(); +} + +AttrCache::AttrCache(size_t lruSize) + : enable_(lruSize > 0), + lru_(std::make_shared(lruSize)) {} + +bool AttrCache::Get(Ino ino, InodeAttr* attr) { + RETURN_FALSE_IF_DISABLED(); + Attr value; + bool yes = lru_->Get(ino, &value); + if (!yes) { + return false; + } else if (value.expire < Now()) { + return false; + } + *attr = value.attr; + return true; +} + +bool AttrCache::Put(Ino ino, const InodeAttr& attr, uint64_t timeoutSec) { + RETURN_FALSE_IF_DISABLED(); + Attr value; + value.attr = std::move(attr); + value.expire = Now() + TimeSpec(timeoutSec, 0); + lru_->Put(ino, value); + return true; +} + +bool AttrCache::Delete(Ino ino) { + RETURN_FALSE_IF_DISABLED(); + lru_->Remove(ino); + return true; +} + +size_t AttrCache::Size() { + return lru_->Size(); +} + +} // namespace vfs +} // namespace client +} // namespace curvefs diff --git a/curvefs/src/client/vfs/cache.h b/curvefs/src/client/vfs/cache.h new file mode 100644 index 0000000000..f1653444a8 --- /dev/null +++ b/curvefs/src/client/vfs/cache.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-07-04 + * Author: Jingli Chen (Wine93) + */ + +#ifndef CURVEFS_SRC_CLIENT_VFS_CACHE_H_ +#define CURVEFS_SRC_CLIENT_VFS_CACHE_H_ + +#include +#include + +#include "src/common/lru_cache.h" +#include "curvefs/src/client/vfs/meta.h" + +namespace curvefs { +namespace client { +namespace vfs { + +using ::curve::common::LRUCache; + +class EntryCache { + public: + struct Entry { + Ino ino; + TimeSpec expire; + }; + + // TODO(Wine93): is there a more effective type for entry cache? maybe + // absl::btree> is a choise, + // but it is a bit complex to implement lru evit strategy. + using LRUType = LRUCache; + + public: + EntryCache() = delete; + + explicit EntryCache(size_t lruSize); + + bool Get(Ino parent, const std::string& name, Ino* ino); + + bool Put(Ino parent, const std::string& name, Ino ino, uint64_t timeoutSec); + + bool Delete(Ino parent, const std::string& name); + + size_t Size(); + + private: + std::string EntryKey(Ino parent, const std::string& name); + + private: + bool enable_; + std::shared_ptr lru_; +}; + +class AttrCache { + public: + struct Attr { + InodeAttr attr; + TimeSpec expire; + }; + + using LRUType = LRUCache; + + public: + AttrCache() = delete; + + explicit AttrCache(size_t lruSize); + + bool Get(Ino ino, InodeAttr* attr); + + bool Put(Ino ino, const InodeAttr& attr, uint64_t timeoutSec); + + bool Delete(Ino ino); + + size_t Size(); + + private: + bool enable_; + std::shared_ptr lru_; +}; + +} // namespace vfs +} // namespace client +} // namespace curvefs + +#endif // CURVEFS_SRC_CLIENT_VFS_CACHE_H_ diff --git a/curvefs/src/client/vfs/config.cpp b/curvefs/src/client/vfs/config.cpp new file mode 100644 index 0000000000..a75f01eb80 --- /dev/null +++ b/curvefs/src/client/vfs/config.cpp @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2023 NetEase Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Project: Curve + * Created Date: 2023-07-11 + * Author: Jingli Chen (Wine93) + */ + +#define INCBIN_STYLE INCBIN_STYLE_SNAKE +#define INCBIN_PREFIX g_ + +#include + +#include +#include + +#include "absl/strings/string_view.h" +#include "absl/strings/str_split.h" +#include "curvefs/src/client/vfs/utils.h" +#include "curvefs/src/client/vfs/config.h" + +/* Usage: INCBIN(<>, <>) + * + * Symbols defined by INCBIN + * ------------------------------------------ + * const unsigned char g_client_conf_data[] // g_<>_data + * const unsigned char* const g_client_conf_end; // g_<