From b38e227af302cf00c4b87135c12d88022e5d9713 Mon Sep 17 00:00:00 2001 From: Hoon Jo Date: Mon, 28 Mar 2022 13:51:30 +0900 Subject: [PATCH 01/11] fixed blank --- docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 65cc5c1..73455f0 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -95,9 +95,9 @@ if [ "$1" = 'fio' ]; then echo ================== echo "Random Read/Write IOPS: $READ_IOPS_VAL/$WRITE_IOPS_VAL. BW: $READ_BW_VAL / $WRITE_BW_VAL" if [ -z $DBENCH_QUICK ] || [ "$DBENCH_QUICK" == "no" ]; then - echo "Average Latency (usec) Read/Write: $READ_LATENCY_VAL/$WRITE_LATENCY_VAL" + echo "Average Latency (usec) Read/Write: $READ_LATENCY_VAL / $WRITE_LATENCY_VAL" echo "Sequential Read/Write: $READ_SEQ_VAL / $WRITE_SEQ_VAL" - echo "Mixed Random Read/Write IOPS: $RW_MIX_R_IOPS/$RW_MIX_W_IOPS" + echo "Mixed Random Read/Write IOPS: $RW_MIX_R_IOPS / $RW_MIX_W_IOPS" fi rm $DBENCH_MOUNTPOINT/fiotest From 03f96f41f90f8ff94e54900eb0380ada8560ca70 Mon Sep 17 00:00:00 2001 From: Hoon Jo Date: Mon, 28 Mar 2022 14:51:09 +0900 Subject: [PATCH 02/11] fixed grep \b --- docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 73455f0..794f1e3 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -54,14 +54,14 @@ if [ "$1" = 'fio' ]; then echo Testing Read Latency... READ_LATENCY=$(fio --randrepeat=0 --verify=0 --ioengine=libaio --direct=$FIO_DIRECT --name=read_latency --filename=$DBENCH_MOUNTPOINT/fiotest --bs=4K --iodepth=4 --size=$FIO_SIZE --readwrite=randread --time_based --ramp_time=2s --runtime=15s) echo "$READ_LATENCY" - READ_LATENCY_VAL=$(echo "$READ_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[0-9.]+'|cut -d'=' -f2) + READ_LATENCY_VAL=$(echo "$READ_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[\b 0-9.]+'|cut -d'=' -f2) echo echo echo Testing Write Latency... WRITE_LATENCY=$(fio --randrepeat=0 --verify=0 --ioengine=libaio --direct=$FIO_DIRECT --name=write_latency --filename=$DBENCH_MOUNTPOINT/fiotest --bs=4K --iodepth=4 --size=$FIO_SIZE --readwrite=randwrite --time_based --ramp_time=2s --runtime=15s) echo "$WRITE_LATENCY" - WRITE_LATENCY_VAL=$(echo "$WRITE_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[0-9.]+'|cut -d'=' -f2) + WRITE_LATENCY_VAL=$(echo "$WRITE_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[\b 0-9.]+'|cut -d'=' -f2) echo echo From b266e8c09543ca330334c5dfc9c14f8754c969c6 Mon Sep 17 00:00:00 2001 From: Hoon Jo Date: Mon, 28 Mar 2022 14:56:14 +0900 Subject: [PATCH 03/11] upt Readme --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 38b856d..542014f 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,11 @@ Mixed Random Read/Write IOPS: 43.1k/14.4k * It's useful to test multiple disk sizes as most cloud providers price IOPS per GB provisioned. So a `4000Gi` volume will perform better than a `1000Gi` volume. Just edit the yaml, `kubectl delete -f dbench.yaml` and run `kubectl apply -f dbench.yaml` again after deprovision/delete completes. * A list of all `fio` tests are in [docker-entrypoint.sh](https://github.com/logdna/dbench/blob/master/docker-entrypoint.sh). + +## Fixed history (Mar 28 2022) +Dbench Summary could not show up properly when parameter have blank(s) - add to \b on docker-entrypoint + + ## Contributors * Lee Liu (LogDNA) From de9cdd75ca758a893c49dfebb57fe0204ddf146d Mon Sep 17 00:00:00 2001 From: Hoon Jo Date: Mon, 28 Mar 2022 15:46:38 +0900 Subject: [PATCH 04/11] add dynamic latency --- docker-entrypoint.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 794f1e3..92d4a49 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -55,6 +55,7 @@ if [ "$1" = 'fio' ]; then READ_LATENCY=$(fio --randrepeat=0 --verify=0 --ioengine=libaio --direct=$FIO_DIRECT --name=read_latency --filename=$DBENCH_MOUNTPOINT/fiotest --bs=4K --iodepth=4 --size=$FIO_SIZE --readwrite=randread --time_based --ramp_time=2s --runtime=15s) echo "$READ_LATENCY" READ_LATENCY_VAL=$(echo "$READ_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[\b 0-9.]+'|cut -d'=' -f2) + READ_LATENCY_KEY=$(echo "$READ_LATENCY"|grep ' lat.*avg'|grep -oP '(?<=lat )[^ ]*' |grep -Eoi '[a-z]+' echo echo @@ -62,6 +63,7 @@ if [ "$1" = 'fio' ]; then WRITE_LATENCY=$(fio --randrepeat=0 --verify=0 --ioengine=libaio --direct=$FIO_DIRECT --name=write_latency --filename=$DBENCH_MOUNTPOINT/fiotest --bs=4K --iodepth=4 --size=$FIO_SIZE --readwrite=randwrite --time_based --ramp_time=2s --runtime=15s) echo "$WRITE_LATENCY" WRITE_LATENCY_VAL=$(echo "$WRITE_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[\b 0-9.]+'|cut -d'=' -f2) + WRITE_LATENCY_KEY=$(echo "$WRITE_LATENCY"|grep ' lat.*avg'|grep -oP '(?<=lat )[^ ]*' |grep -Eoi '[a-z]+' echo echo @@ -95,9 +97,9 @@ if [ "$1" = 'fio' ]; then echo ================== echo "Random Read/Write IOPS: $READ_IOPS_VAL/$WRITE_IOPS_VAL. BW: $READ_BW_VAL / $WRITE_BW_VAL" if [ -z $DBENCH_QUICK ] || [ "$DBENCH_QUICK" == "no" ]; then - echo "Average Latency (usec) Read/Write: $READ_LATENCY_VAL / $WRITE_LATENCY_VAL" - echo "Sequential Read/Write: $READ_SEQ_VAL / $WRITE_SEQ_VAL" - echo "Mixed Random Read/Write IOPS: $RW_MIX_R_IOPS / $RW_MIX_W_IOPS" + echo "Average Latency Read/Write: ($READ_LATENCY_KEY)$READ_LATENCY_VAL / ($WRITE_LATENCY_KEY)$WRITE_LATENCY_VAL" + echo "Sequential Read/Write: $READ_SEQ_VAL / $WRITE_SEQ_VAL" + echo "Mixed Random Read/Write IOPS: $RW_MIX_R_IOPS / $RW_MIX_W_IOPS" fi rm $DBENCH_MOUNTPOINT/fiotest From 68bee32c1c271d9acc738b89a8d6d700acffb92c Mon Sep 17 00:00:00 2001 From: Hoon Jo Date: Mon, 28 Mar 2022 15:50:46 +0900 Subject: [PATCH 05/11] add dynamic latency --- docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 92d4a49..8ed00b6 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -55,7 +55,7 @@ if [ "$1" = 'fio' ]; then READ_LATENCY=$(fio --randrepeat=0 --verify=0 --ioengine=libaio --direct=$FIO_DIRECT --name=read_latency --filename=$DBENCH_MOUNTPOINT/fiotest --bs=4K --iodepth=4 --size=$FIO_SIZE --readwrite=randread --time_based --ramp_time=2s --runtime=15s) echo "$READ_LATENCY" READ_LATENCY_VAL=$(echo "$READ_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[\b 0-9.]+'|cut -d'=' -f2) - READ_LATENCY_KEY=$(echo "$READ_LATENCY"|grep ' lat.*avg'|grep -oP '(?<=lat )[^ ]*' |grep -Eoi '[a-z]+' + READ_LATENCY_KEY=$(echo "$READ_LATENCY"|grep ' lat.*avg'|grep -oP '(?<=lat )[^ ]*' |grep -Eoi '[a-z]+') echo echo @@ -63,7 +63,7 @@ if [ "$1" = 'fio' ]; then WRITE_LATENCY=$(fio --randrepeat=0 --verify=0 --ioengine=libaio --direct=$FIO_DIRECT --name=write_latency --filename=$DBENCH_MOUNTPOINT/fiotest --bs=4K --iodepth=4 --size=$FIO_SIZE --readwrite=randwrite --time_based --ramp_time=2s --runtime=15s) echo "$WRITE_LATENCY" WRITE_LATENCY_VAL=$(echo "$WRITE_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[\b 0-9.]+'|cut -d'=' -f2) - WRITE_LATENCY_KEY=$(echo "$WRITE_LATENCY"|grep ' lat.*avg'|grep -oP '(?<=lat )[^ ]*' |grep -Eoi '[a-z]+' + WRITE_LATENCY_KEY=$(echo "$WRITE_LATENCY"|grep ' lat.*avg'|grep -oP '(?<=lat )[^ ]*' |grep -Eoi '[a-z]+') echo echo From 6e6d218b2a463b9fa67cccd2c065b84846ee76db Mon Sep 17 00:00:00 2001 From: Hoon Jo Date: Mon, 28 Mar 2022 16:02:21 +0900 Subject: [PATCH 06/11] add grep update on dockerfile --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index faf0cfd..a999fab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ FROM dmonakhov/alpine-fio -MAINTAINER Lee Liu +MAINTAINER Lee Liu , Hoon Jo + +# add due to grep -P doesn't support on alpine +apk add --no-cache --upgrade grep VOLUME /tmp WORKDIR /tmp From b3e66d6e54c3361864340f788bb208dd9264fccd Mon Sep 17 00:00:00 2001 From: Hoon Jo Date: Mon, 28 Mar 2022 16:12:22 +0900 Subject: [PATCH 07/11] add grep update on dockerfile --- Dockerfile | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index a999fab..facbd4b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,31 @@ -FROM dmonakhov/alpine-fio +FROM alpine -MAINTAINER Lee Liu , Hoon Jo +MAINTAINER Dmitry Monakhov dmonakhov@openvz.org -# add due to grep -P doesn't support on alpine -apk add --no-cache --upgrade grep +# Install build deps + permanent dep: libaio +RUN apk --no-cache add \ + make \ + alpine-sdk \ + zlib-dev \ + libaio-dev \ + linux-headers \ + coreutils \ + grep \ + libaio && \ + git clone https://github.com/axboe/fio && \ + cd fio && \ + ./configure && \ + make -j`nproc` && \ + make install && \ + cd .. && \ + rm -rf fio && \ + apk --no-cache del \ + make \ + alpine-sdk \ + zlib-dev \ + libaio-dev \ + linux-headers \ + coreutils VOLUME /tmp WORKDIR /tmp From f0160e2d8047f6fbdcbbca238e2bca683f7e4bdb Mon Sep 17 00:00:00 2001 From: Hoon Jo Date: Mon, 28 Mar 2022 16:30:49 +0900 Subject: [PATCH 08/11] mod name from key to unit --- docker-entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 8ed00b6..550db36 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -55,7 +55,7 @@ if [ "$1" = 'fio' ]; then READ_LATENCY=$(fio --randrepeat=0 --verify=0 --ioengine=libaio --direct=$FIO_DIRECT --name=read_latency --filename=$DBENCH_MOUNTPOINT/fiotest --bs=4K --iodepth=4 --size=$FIO_SIZE --readwrite=randread --time_based --ramp_time=2s --runtime=15s) echo "$READ_LATENCY" READ_LATENCY_VAL=$(echo "$READ_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[\b 0-9.]+'|cut -d'=' -f2) - READ_LATENCY_KEY=$(echo "$READ_LATENCY"|grep ' lat.*avg'|grep -oP '(?<=lat )[^ ]*' |grep -Eoi '[a-z]+') + READ_LATENCY_UNIT=$(echo "$READ_LATENCY"|grep ' lat.*avg'|grep -oP '(?<=lat )[^ ]*'|grep -Eoi '[a-z]+') echo echo @@ -63,7 +63,7 @@ if [ "$1" = 'fio' ]; then WRITE_LATENCY=$(fio --randrepeat=0 --verify=0 --ioengine=libaio --direct=$FIO_DIRECT --name=write_latency --filename=$DBENCH_MOUNTPOINT/fiotest --bs=4K --iodepth=4 --size=$FIO_SIZE --readwrite=randwrite --time_based --ramp_time=2s --runtime=15s) echo "$WRITE_LATENCY" WRITE_LATENCY_VAL=$(echo "$WRITE_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[\b 0-9.]+'|cut -d'=' -f2) - WRITE_LATENCY_KEY=$(echo "$WRITE_LATENCY"|grep ' lat.*avg'|grep -oP '(?<=lat )[^ ]*' |grep -Eoi '[a-z]+') + WRITE_LATENCY_UNIT=$(echo "$WRITE_LATENCY"|grep ' lat.*avg'|grep -oP '(?<=lat )[^ ]*'|grep -Eoi '[a-z]+') echo echo @@ -97,7 +97,7 @@ if [ "$1" = 'fio' ]; then echo ================== echo "Random Read/Write IOPS: $READ_IOPS_VAL/$WRITE_IOPS_VAL. BW: $READ_BW_VAL / $WRITE_BW_VAL" if [ -z $DBENCH_QUICK ] || [ "$DBENCH_QUICK" == "no" ]; then - echo "Average Latency Read/Write: ($READ_LATENCY_KEY)$READ_LATENCY_VAL / ($WRITE_LATENCY_KEY)$WRITE_LATENCY_VAL" + echo "Average Latency Read/Write: $READ_LATENCY_VAL($READ_LATENCY_UNIT) / $WRITE_LATENCY_VAL($WRITE_LATENCY_UNIT") echo "Sequential Read/Write: $READ_SEQ_VAL / $WRITE_SEQ_VAL" echo "Mixed Random Read/Write IOPS: $RW_MIX_R_IOPS / $RW_MIX_W_IOPS" fi From 02ab8ca52b2b4eb2c9782992d22b4f17a7f3d81c Mon Sep 17 00:00:00 2001 From: Hoon Jo Date: Mon, 28 Mar 2022 16:33:51 +0900 Subject: [PATCH 09/11] mod name from key to unit --- docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 550db36..ba56401 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -97,7 +97,7 @@ if [ "$1" = 'fio' ]; then echo ================== echo "Random Read/Write IOPS: $READ_IOPS_VAL/$WRITE_IOPS_VAL. BW: $READ_BW_VAL / $WRITE_BW_VAL" if [ -z $DBENCH_QUICK ] || [ "$DBENCH_QUICK" == "no" ]; then - echo "Average Latency Read/Write: $READ_LATENCY_VAL($READ_LATENCY_UNIT) / $WRITE_LATENCY_VAL($WRITE_LATENCY_UNIT") + echo "Average Latency Read/Write: $READ_LATENCY_VAL($READ_LATENCY_UNIT) / $WRITE_LATENCY_VAL($WRITE_LATENCY_UNIT)" echo "Sequential Read/Write: $READ_SEQ_VAL / $WRITE_SEQ_VAL" echo "Mixed Random Read/Write IOPS: $RW_MIX_R_IOPS / $RW_MIX_W_IOPS" fi From 556e023a94716dab2b9684c92249bc225fcb299f Mon Sep 17 00:00:00 2001 From: Hoon Jo Date: Wed, 30 Mar 2022 14:55:46 +0900 Subject: [PATCH 10/11] upt entry --- docker-entrypoint.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index ba56401..1dfddd4 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -92,14 +92,17 @@ if [ "$1" = 'fio' ]; then echo All tests complete. echo - echo ================== - echo = Dbench Summary = - echo ================== - echo "Random Read/Write IOPS: $READ_IOPS_VAL/$WRITE_IOPS_VAL. BW: $READ_BW_VAL / $WRITE_BW_VAL" + echo ============================= + echo = Kubernetes Dbench Summary = + echo ============================= + echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + echo -e "|| Random Read/Write IOPS\t | $READ_IOPS_VAL / $WRITE_IOPS_VAL\t ||" + echo -e "|| Bandwidth Read/Write\t | $READ_BW_VAL / $WRITE_BW_VAL\t ||" if [ -z $DBENCH_QUICK ] || [ "$DBENCH_QUICK" == "no" ]; then - echo "Average Latency Read/Write: $READ_LATENCY_VAL($READ_LATENCY_UNIT) / $WRITE_LATENCY_VAL($WRITE_LATENCY_UNIT)" - echo "Sequential Read/Write: $READ_SEQ_VAL / $WRITE_SEQ_VAL" - echo "Mixed Random Read/Write IOPS: $RW_MIX_R_IOPS / $RW_MIX_W_IOPS" + echo -e "|| Average Latency Read/Write\t | $READ_LATENCY_VAL($READ_LATENCY_UNIT) / $WRITE_LATENCY_VAL($WRITE_LATENCY_UNIT)\t ||" + echo -e "|| Sequential Read/Write\t | $READ_SEQ_VAL / $WRITE_SEQ_VAL\t ||" + echo -e "|| Mixed Random Read/Write IOPS\t | $RW_MIX_R_IOPS / $RW_MIX_W_IOPS\t ||" + echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= fi rm $DBENCH_MOUNTPOINT/fiotest From 312d7861529b8333fae4e10b7ee1f2c6f071a0aa Mon Sep 17 00:00:00 2001 From: Hoon Jo Date: Tue, 12 Apr 2022 10:30:36 +0900 Subject: [PATCH 11/11] upt dbench.yaml --- dbench.yaml | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/dbench.yaml b/dbench.yaml index 08594ee..808e2b8 100644 --- a/dbench.yaml +++ b/dbench.yaml @@ -1,48 +1,55 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: dbench-pv-claim + name: kdbench-pv-claim + labels: + fio: kdbench spec: - storageClassName: ssd - # storageClassName: gp2 - # storageClassName: local-storage - # storageClassName: ibmc-block-bronze - # storageClassName: ibmc-block-silver - # storageClassName: ibmc-block-gold + storageClassName: your-storageclass + # storageClassName: managed-nfs-storage + # storageClassName: gp2 + # storageClassName: default + # storageClassName: standard + # storageClassName: nks-block-storage accessModes: - ReadWriteOnce resources: requests: - storage: 1000Gi + storage: 100Gi --- apiVersion: batch/v1 kind: Job metadata: - name: dbench + name: kdbench + labels: + fio: kdbench spec: + ttlSecondsAfterFinished: 0 template: spec: containers: - - name: dbench - image: logdna/dbench:latest + - name: kdbench + image: sysnet4admin/kdbench:latest imagePullPolicy: Always env: - - name: DBENCH_MOUNTPOINT - value: /data - # - name: DBENCH_QUICK + - name: KDBENCH_MOUNTPOINT + value: /ON-your-storageclass + - name: STORAGECLASS + value: your-storageclass + # - name: KDBENCH_QUICK # value: "yes" # - name: FIO_SIZE # value: 1G # - name: FIO_OFFSET_INCREMENT # value: 256M # - name: FIO_DIRECT - # value: "0" + # value: "1" volumeMounts: - - name: dbench-pv - mountPath: /data + - name: kdbench-pv + mountPath: /ON-your-storageclass restartPolicy: Never volumes: - - name: dbench-pv + - name: kdbench-pv persistentVolumeClaim: - claimName: dbench-pv-claim + claimName: kdbench-pv-claim backoffLimit: 4