From 21cd357c7dd81ac174bd2a555fd773fe9948d925 Mon Sep 17 00:00:00 2001 From: Derek Su Date: Thu, 27 Jan 2022 05:13:14 +0000 Subject: [PATCH 1/3] Make CPU idleness profiling as an option The CPU idleness introduces extra overhead and storage performance drop. By default, the profiling is disabled. Signed-off-by: Derek Su --- README.md | 1 + deploy/fio-cmp.yaml | 2 + deploy/fio.yaml | 2 + fio/cmp_parse.sh | 178 ++++++++++++++++++++++++++++---------------- fio/parse.sh | 88 ++++++++++++++-------- fio/run.sh | 10 ++- 6 files changed, 181 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index a81cce0..9796f4e 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ For official benchmarking: 1. `SIZE` environmental variable: the size should be **at least 25 times the read/write bandwidth** to avoid the caching impacting the result. 1. If you're testing a distributed storage solution like Longhorn, always **test against the local storage first** to know what's the baseline. * You can install a storage provider for local storage like [Local Path Provisioner](https://github.com/rancher/local-path-provisioner) for this test if you're testing with Kubernetes. +1. `CPU_IDLE_PROF` environmental variable: the CPU idleness profiling measures the CPU idleness, but it introduces extra overhead and reduces the storage performance. By default, the flag is disabled. ### Understanding the result * **IOPS**: IO operations per second. *Higher is better.* diff --git a/deploy/fio-cmp.yaml b/deploy/fio-cmp.yaml index 05e7cb7..51237bc 100644 --- a/deploy/fio-cmp.yaml +++ b/deploy/fio-cmp.yaml @@ -55,6 +55,8 @@ spec: value: "/volume2/test" - name: SIZE value: "30G" # must be smaller or match the PVC size + - name: CPU_IDLE_PROF + value: "disabled" # must be "enabled" or "disabled" volumeMounts: - name: vol1 mountPath: /volume1/ diff --git a/deploy/fio.yaml b/deploy/fio.yaml index 719cbf1..ec9f777 100644 --- a/deploy/fio.yaml +++ b/deploy/fio.yaml @@ -34,6 +34,8 @@ spec: value: "/volume/test" - name: SIZE value: "30G" # must be 10% smaller than the PVC size due to filesystem also took space + - name: CPU_IDLE_PROF + value: "disabled" # must be "enabled" or "disabled" volumeMounts: - name: vol mountPath: /volume/ diff --git a/fio/cmp_parse.sh b/fio/cmp_parse.sh index 35b1623..3c280d6 100755 --- a/fio/cmp_parse.sh +++ b/fio/cmp_parse.sh @@ -73,20 +73,21 @@ calc_cmp_lat RESULT=${FIRST_VOL_NAME}_vs_${SECOND_VOL_NAME}.summary -QUICK_MODE_TEXT="QUICK MODE: DISABLED" +QUICK_MODE_TEXT="Quick Mode: disabled" if [ -n "$QUICK_MODE" ]; then - QUICK_MODE_TEXT="QUICK MODE ENABLED" + QUICK_MODE_TEXT="Quick Mode: enabled" fi SIZE_TEXT="SIZE: 10g" if [ -n "$SIZE" ]; then - SIZE_TEXT="SIZE: $SIZE" + SIZE_TEXT="Size: $SIZE" fi SUMMARY=" ================================ FIO Benchmark Comparsion Summary For: $FIRST_VOL_NAME vs $SECOND_VOL_NAME +CPU Idleness Profiling: $CPU_IDLE_PROF $SIZE_TEXT $QUICK_MODE_TEXT ================================ @@ -96,68 +97,115 @@ printf -v header "$CMP_FMT" \ "" $FIRST_VOL_NAME "vs" $SECOND_VOL_NAME ":" "Change" SUMMARY+=$header -printf -v cxt "IOPS (Read/Write)\n$CMP_FMT$CMP_FMT$CMP_FMT\n" \ - "Random:" \ - "$(commaize $FIRST_RAND_READ_IOPS) / $(commaize $FIRST_RAND_WRITE_IOPS)" \ - "vs" \ - "$(commaize $SECOND_RAND_READ_IOPS) / $(commaize $SECOND_RAND_WRITE_IOPS)"\ - ":" \ - "$CMP_RAND_READ_IOPS / $CMP_RAND_WRITE_IOPS"\ - "Sequential:" \ - "$(commaize $FIRST_SEQ_READ_IOPS) / $(commaize $FIRST_SEQ_WRITE_IOPS)" \ - "vs" \ - "$(commaize $SECOND_SEQ_READ_IOPS) / $(commaize $SECOND_SEQ_WRITE_IOPS)" \ - ":" \ - "$CMP_SEQ_READ_IOPS / $CMP_SEQ_WRITE_IOPS"\ - "CPU Idleness:" \ - "$FIRST_CPU_IDLE_PCT_IOPS%"\ - "vs" \ - "$SECOND_CPU_IDLE_PCT_IOPS%"\ - ":" \ - "$CMP_CPU_IDLE_PCT_IOPS%" -SUMMARY+=$cxt - -printf -v cxt "Bandwidth in KiB/sec (Read/Write)\n$CMP_FMT$CMP_FMT$CMP_FMT\n" \ - "Random:" \ - "$(commaize $FIRST_RAND_READ_BW) / $(commaize $FIRST_RAND_WRITE_BW)" \ - "vs" \ - "$(commaize $SECOND_RAND_READ_BW) / $(commaize $SECOND_RAND_WRITE_BW)" \ - ":" \ - "$CMP_RAND_READ_BW / $CMP_RAND_WRITE_BW"\ - "Sequential:" \ - "$(commaize $FIRST_SEQ_READ_BW) / $(commaize $FIRST_SEQ_WRITE_BW)" \ - "vs" \ - "$(commaize $SECOND_SEQ_READ_BW) / $(commaize $SECOND_SEQ_WRITE_BW)" \ - ":" \ - "$CMP_SEQ_READ_BW / $CMP_SEQ_WRITE_BW"\ - "CPU Idleness:" \ - "$FIRST_CPU_IDLE_PCT_BW%"\ - "vs" \ - "$SECOND_CPU_IDLE_PCT_BW%" \ - ":" \ - "$CMP_CPU_IDLE_PCT_BW%" -SUMMARY+=$cxt - -printf -v cxt "Latency in ns (Read/Write)\n$CMP_FMT$CMP_FMT$CMP_FMT\n" \ - "Random:" \ - "$(commaize $FIRST_RAND_READ_LAT) / $(commaize $FIRST_RAND_WRITE_LAT)" \ - "vs" \ - "$(commaize $SECOND_RAND_READ_LAT) / $(commaize $SECOND_RAND_WRITE_LAT)" \ - ":" \ - "$CMP_RAND_READ_LAT / $CMP_RAND_WRITE_LAT"\ - "Sequential:" \ - "$(commaize $FIRST_SEQ_READ_LAT) / $(commaize $FIRST_SEQ_WRITE_LAT)" \ - "vs" \ - "$(commaize $SECOND_SEQ_READ_LAT) / $(commaize $SECOND_SEQ_WRITE_LAT)" \ - ":" \ - "$CMP_SEQ_READ_LAT / $CMP_SEQ_WRITE_LAT"\ - "CPU Idleness:" \ - "$FIRST_CPU_IDLE_PCT_LAT%"\ - "vs" \ - "$SECOND_CPU_IDLE_PCT_LAT%" \ - ":" \ - "$CMP_CPU_IDLE_PCT_LAT%" -SUMMARY+=$cxt +if [ x"$CPU_IDLE_PROF" = x"enabled" ]; then + printf -v cxt "IOPS (Read/Write)\n$CMP_FMT$CMP_FMT$CMP_FMT\n" \ + "Random:" \ + "$(commaize $FIRST_RAND_READ_IOPS) / $(commaize $FIRST_RAND_WRITE_IOPS)" \ + "vs" \ + "$(commaize $SECOND_RAND_READ_IOPS) / $(commaize $SECOND_RAND_WRITE_IOPS)" \ + ":" \ + "$CMP_RAND_READ_IOPS / $CMP_RAND_WRITE_IOPS" \ + "Sequential:" \ + "$(commaize $FIRST_SEQ_READ_IOPS) / $(commaize $FIRST_SEQ_WRITE_IOPS)" \ + "vs" \ + "$(commaize $SECOND_SEQ_READ_IOPS) / $(commaize $SECOND_SEQ_WRITE_IOPS)" \ + ":" \ + "$CMP_SEQ_READ_IOPS / $CMP_SEQ_WRITE_IOPS" \ + "CPU Idleness:" \ + "$FIRST_CPU_IDLE_PCT_IOPS%" \ + "vs" \ + "$SECOND_CPU_IDLE_PCT_IOPS%"\ + ":" \ + "$CMP_CPU_IDLE_PCT_IOPS%" + SUMMARY+=$cxt + + printf -v cxt "Bandwidth in KiB/sec (Read/Write)\n$CMP_FMT$CMP_FMT$CMP_FMT\n" \ + "Random:" \ + "$(commaize $FIRST_RAND_READ_BW) / $(commaize $FIRST_RAND_WRITE_BW)" \ + "vs" \ + "$(commaize $SECOND_RAND_READ_BW) / $(commaize $SECOND_RAND_WRITE_BW)" \ + ":" \ + "$CMP_RAND_READ_BW / $CMP_RAND_WRITE_BW" \ + "Sequential:" \ + "$(commaize $FIRST_SEQ_READ_BW) / $(commaize $FIRST_SEQ_WRITE_BW)" \ + "vs" \ + "$(commaize $SECOND_SEQ_READ_BW) / $(commaize $SECOND_SEQ_WRITE_BW)" \ + ":" \ + "$CMP_SEQ_READ_BW / $CMP_SEQ_WRITE_BW" \ + "CPU Idleness:" \ + "$FIRST_CPU_IDLE_PCT_BW%" \ + "vs" \ + "$SECOND_CPU_IDLE_PCT_BW%" \ + ":" \ + "$CMP_CPU_IDLE_PCT_BW%" + SUMMARY+=$cxt + + printf -v cxt "Latency in ns (Read/Write)\n$CMP_FMT$CMP_FMT$CMP_FMT\n" \ + "Random:" \ + "$(commaize $FIRST_RAND_READ_LAT) / $(commaize $FIRST_RAND_WRITE_LAT)" \ + "vs" \ + "$(commaize $SECOND_RAND_READ_LAT) / $(commaize $SECOND_RAND_WRITE_LAT)" \ + ":" \ + "$CMP_RAND_READ_LAT / $CMP_RAND_WRITE_LAT" \ + "Sequential:" \ + "$(commaize $FIRST_SEQ_READ_LAT) / $(commaize $FIRST_SEQ_WRITE_LAT)" \ + "vs" \ + "$(commaize $SECOND_SEQ_READ_LAT) / $(commaize $SECOND_SEQ_WRITE_LAT)" \ + ":" \ + "$CMP_SEQ_READ_LAT / $CMP_SEQ_WRITE_LAT" \ + "CPU Idleness:" \ + "$FIRST_CPU_IDLE_PCT_LAT%" \ + "vs" \ + "$SECOND_CPU_IDLE_PCT_LAT%" \ + ":" \ + "$CMP_CPU_IDLE_PCT_LAT%" + SUMMARY+=$cxt +else + printf -v cxt "IOPS (Read/Write)\n$CMP_FMT$CMP_FMT\n" \ + "Random:" \ + "$(commaize $FIRST_RAND_READ_IOPS) / $(commaize $FIRST_RAND_WRITE_IOPS)" \ + "vs" \ + "$(commaize $SECOND_RAND_READ_IOPS) / $(commaize $SECOND_RAND_WRITE_IOPS)" \ + ":" \ + "$CMP_RAND_READ_IOPS / $CMP_RAND_WRITE_IOPS" \ + "Sequential:" \ + "$(commaize $FIRST_SEQ_READ_IOPS) / $(commaize $FIRST_SEQ_WRITE_IOPS)" \ + "vs" \ + "$(commaize $SECOND_SEQ_READ_IOPS) / $(commaize $SECOND_SEQ_WRITE_IOPS)" \ + ":" \ + "$CMP_SEQ_READ_IOPS / $CMP_SEQ_WRITE_IOPS" + SUMMARY+=$cxt + + printf -v cxt "Bandwidth in KiB/sec (Read/Write)\n$CMP_FMT$CMP_FMT\n" \ + "Random:" \ + "$(commaize $FIRST_RAND_READ_BW) / $(commaize $FIRST_RAND_WRITE_BW)" \ + "vs" \ + "$(commaize $SECOND_RAND_READ_BW) / $(commaize $SECOND_RAND_WRITE_BW)" \ + ":" \ + "$CMP_RAND_READ_BW / $CMP_RAND_WRITE_BW" \ + "Sequential:" \ + "$(commaize $FIRST_SEQ_READ_BW) / $(commaize $FIRST_SEQ_WRITE_BW)" \ + "vs" \ + "$(commaize $SECOND_SEQ_READ_BW) / $(commaize $SECOND_SEQ_WRITE_BW)" \ + ":" \ + "$CMP_SEQ_READ_BW / $CMP_SEQ_WRITE_BW" + SUMMARY+=$cxt + + printf -v cxt "Latency in ns (Read/Write)\n$CMP_FMT$CMP_FMT\n" \ + "Random:" \ + "$(commaize $FIRST_RAND_READ_LAT) / $(commaize $FIRST_RAND_WRITE_LAT)" \ + "vs" \ + "$(commaize $SECOND_RAND_READ_LAT) / $(commaize $SECOND_RAND_WRITE_LAT)" \ + ":" \ + "$CMP_RAND_READ_LAT / $CMP_RAND_WRITE_LAT" \ + "Sequential:" \ + "$(commaize $FIRST_SEQ_READ_LAT) / $(commaize $FIRST_SEQ_WRITE_LAT)" \ + "vs" \ + "$(commaize $SECOND_SEQ_READ_LAT) / $(commaize $SECOND_SEQ_WRITE_LAT)" \ + ":" \ + "$CMP_SEQ_READ_LAT / $CMP_SEQ_WRITE_LAT" + SUMMARY+=$cxt +fi echo "$SUMMARY" > $RESULT cat $RESULT diff --git a/fio/parse.sh b/fio/parse.sh index 822e9be..2a5c843 100755 --- a/fio/parse.sh +++ b/fio/parse.sh @@ -36,51 +36,75 @@ fi RESULT=${1}.summary -QUICK_MODE_TEXT="QUICK MODE: DISABLED" +QUICK_MODE_TEXT="Quick Mode: disabled" if [ -n "$QUICK_MODE" ]; then - QUICK_MODE_TEXT="QUICK MODE ENABLED" + QUICK_MODE_TEXT="Quick Mode: enabled" fi -SIZE_TEXT="SIZE: 10g" +SIZE_TEXT="Size: 10g" if [ -n "$SIZE" ]; then - SIZE_TEXT="SIZE: $SIZE" + SIZE_TEXT="Size: $SIZE" fi SUMMARY=" -===================== +========================= FIO Benchmark Summary For: $PREFIX +CPU Idleness Profiling: $CPU_IDLE_PROF $SIZE_TEXT $QUICK_MODE_TEXT -===================== +========================= " -printf -v cxt "IOPS (Read/Write)\n$FMT$FMT$FMT\n"\ - "Random:" \ - "$(commaize $RAND_READ_IOPS) / $(commaize $RAND_WRITE_IOPS)" \ - "Sequential:" \ - "$(commaize $SEQ_READ_IOPS) / $(commaize $SEQ_WRITE_IOPS)" \ - "CPU Idleness:" \ - "$CPU_IDLE_PCT_IOPS%" -SUMMARY+=$cxt - -printf -v cxt "Bandwidth in KiB/sec (Read/Write)\n$FMT$FMT$FMT\n"\ - "Random:" \ - "$(commaize $RAND_READ_BW) / $(commaize $RAND_WRITE_BW)" \ - "Sequential:" \ - "$(commaize $SEQ_READ_BW) / $(commaize $SEQ_WRITE_BW)" \ - "CPU Idleness:" \ - "$CPU_IDLE_PCT_BW%" -SUMMARY+=$cxt - -printf -v cxt "Latency in ns (Read/Write)\n$FMT$FMT$FMT\n"\ - "Random:" \ - "$(commaize $RAND_READ_LAT) / $(commaize $RAND_WRITE_LAT)" \ - "Sequential:" \ - "$(commaize $SEQ_READ_LAT) / $(commaize $SEQ_WRITE_LAT)" \ - "CPU Idleness:" \ - "$CPU_IDLE_PCT_LAT%" -SUMMARY+=$cxt +if [ x"$CPU_IDLE_PROF" = x"enabled" ]; then + printf -v cxt "IOPS (Read/Write)\n$FMT$FMT$FMT\n"\ + "Random:" \ + "$(commaize $RAND_READ_IOPS) / $(commaize $RAND_WRITE_IOPS)" \ + "Sequential:" \ + "$(commaize $SEQ_READ_IOPS) / $(commaize $SEQ_WRITE_IOPS)" \ + "CPU Idleness:" \ + "$CPU_IDLE_PCT_IOPS%" + SUMMARY+=$cxt + + printf -v cxt "Bandwidth in KiB/sec (Read/Write)\n$FMT$FMT$FMT\n"\ + "Random:" \ + "$(commaize $RAND_READ_BW) / $(commaize $RAND_WRITE_BW)" \ + "Sequential:" \ + "$(commaize $SEQ_READ_BW) / $(commaize $SEQ_WRITE_BW)" \ + "CPU Idleness:" \ + "$CPU_IDLE_PCT_BW%" + SUMMARY+=$cxt + + printf -v cxt "Latency in ns (Read/Write)\n$FMT$FMT\n"\ + "Random:" \ + "$(commaize $RAND_READ_LAT) / $(commaize $RAND_WRITE_LAT)" \ + "Sequential:" \ + "$(commaize $SEQ_READ_LAT) / $(commaize $SEQ_WRITE_LAT)" \ + "CPU Idleness:" \ + "$CPU_IDLE_PCT_LAT%" + SUMMARY+=$cxt +else + printf -v cxt "IOPS (Read/Write)\n$FMT$FMT\n"\ + "Random:" \ + "$(commaize $RAND_READ_IOPS) / $(commaize $RAND_WRITE_IOPS)" \ + "Sequential:" \ + "$(commaize $SEQ_READ_IOPS) / $(commaize $SEQ_WRITE_IOPS)" + SUMMARY+=$cxt + + printf -v cxt "Bandwidth in KiB/sec (Read/Write)\n$FMT$FMT$FMT\n"\ + "Random:" \ + "$(commaize $RAND_READ_BW) / $(commaize $RAND_WRITE_BW)" \ + "Sequential:" \ + "$(commaize $SEQ_READ_BW) / $(commaize $SEQ_WRITE_BW)" + SUMMARY+=$cxt + + printf -v cxt "Latency in ns (Read/Write)\n$FMT$FMT\n"\ + "Random:" \ + "$(commaize $RAND_READ_LAT) / $(commaize $RAND_WRITE_LAT)" \ + "Sequential:" \ + "$(commaize $SEQ_READ_LAT) / $(commaize $SEQ_WRITE_LAT)" + SUMMARY+=$cxt +fi echo "$SUMMARY" > $RESULT cat $RESULT diff --git a/fio/run.sh b/fio/run.sh index be3898b..22c60ac 100755 --- a/fio/run.sh +++ b/fio/run.sh @@ -16,6 +16,10 @@ if [ -z "$TEST_FILE" ]; then exit 1 fi +if [ x"$CPU_IDLE_PROF" = x"enabled" ]; then + IDLE_PROF="--idle-prof=percpu" +fi + echo TEST_FILE: $TEST_FILE OUTPUT=$2 @@ -49,13 +53,13 @@ OUTPUT_BW=${OUTPUT}-bandwidth.json OUTPUT_LAT=${OUTPUT}-latency.json echo Benchmarking $IOPS_FIO into $OUTPUT_IOPS -fio $CURRENT_DIR/$IOPS_FIO --idle-prof=percpu --filename=$TEST_FILE --size=$TEST_SIZE \ +fio $CURRENT_DIR/$IOPS_FIO $IDLE_PROF --filename=$TEST_FILE --size=$TEST_SIZE \ --output-format=json --output=$OUTPUT_IOPS echo Benchmarking $BW_FIO into $OUTPUT_BW -fio $CURRENT_DIR/$BW_FIO --idle-prof=percpu --filename=$TEST_FILE --size=$TEST_SIZE \ +fio $CURRENT_DIR/$BW_FIO $IDLE_PROF --filename=$TEST_FILE --size=$TEST_SIZE \ --output-format=json --output=$OUTPUT_BW echo Benchmarking $LAT_FIO into $OUTPUT_LAT -fio $CURRENT_DIR/$LAT_FIO --idle-prof=percpu --filename=$TEST_FILE --size=$TEST_SIZE \ +fio $CURRENT_DIR/$LAT_FIO $IDLE_PROF --filename=$TEST_FILE --size=$TEST_SIZE \ --output-format=json --output=$OUTPUT_LAT if [ -z "$SKIP_PARSE" ]; then From eaf910fb7af697782aa237a4c0ff134937f8f71c Mon Sep 17 00:00:00 2001 From: Derek Su Date: Sun, 7 Apr 2024 17:22:55 +0000 Subject: [PATCH 2/3] Customizable IO testing with selective IO types and metrics Users have the option to select specific IO types, including random read (randread), random write (randwrite), sequential read (seqread), and sequential write (seqwrite), as well as metrics like IOPS, bandwidth, and latency. There's no requirement to conduct all tests. Longhorn 8254 Signed-off-by: Derek Su --- deploy/fio-cmp.yaml | 4 + deploy/fio.yaml | 4 + fio/bandwidth-quick.fio | 19 - fio/bandwidth.fio | 19 - fio/cmp_parse.sh | 348 +++++++++--------- fio/cmp_run.sh | 18 +- fio/func.sh | 223 +++++++---- .../bandwidth-include.fio} | 0 fio/jobs/bandwidth-quick.fio | 19 + fio/jobs/bandwidth.fio | 19 + fio/{ => jobs}/common-include.fio | 0 fio/{ => jobs}/iops-include.fio | 0 fio/{ => jobs}/iops-quick.fio | 8 +- fio/{ => jobs}/iops.fio | 8 +- .../latency-include.fio} | 0 fio/jobs/latency-quick.fio | 19 + fio/jobs/latency.fio | 19 + fio/{ => jobs}/quick-include.fio | 0 fio/latency-quick.fio | 19 - fio/latency.fio | 19 - fio/parse.sh | 164 ++++----- fio/run.sh | 73 ++-- 22 files changed, 540 insertions(+), 462 deletions(-) delete mode 100644 fio/bandwidth-quick.fio delete mode 100644 fio/bandwidth.fio rename fio/{bw-include.fio => jobs/bandwidth-include.fio} (100%) create mode 100644 fio/jobs/bandwidth-quick.fio create mode 100644 fio/jobs/bandwidth.fio rename fio/{ => jobs}/common-include.fio (100%) rename fio/{ => jobs}/iops-include.fio (100%) rename fio/{ => jobs}/iops-quick.fio (80%) rename fio/{ => jobs}/iops.fio (80%) rename fio/{lat-include.fio => jobs/latency-include.fio} (100%) create mode 100644 fio/jobs/latency-quick.fio create mode 100644 fio/jobs/latency.fio rename fio/{ => jobs}/quick-include.fio (100%) delete mode 100644 fio/latency-quick.fio delete mode 100644 fio/latency.fio diff --git a/deploy/fio-cmp.yaml b/deploy/fio-cmp.yaml index 51237bc..29fca37 100644 --- a/deploy/fio-cmp.yaml +++ b/deploy/fio-cmp.yaml @@ -57,6 +57,10 @@ spec: value: "30G" # must be smaller or match the PVC size - name: CPU_IDLE_PROF value: "disabled" # must be "enabled" or "disabled" + - name: IO_TYPES + value: "seqread,seqwrite,randread,randwrite" + - name: METRICS + value: "bandwidth,iops,latency" volumeMounts: - name: vol1 mountPath: /volume1/ diff --git a/deploy/fio.yaml b/deploy/fio.yaml index ec9f777..9e80b3b 100644 --- a/deploy/fio.yaml +++ b/deploy/fio.yaml @@ -36,6 +36,10 @@ spec: value: "30G" # must be 10% smaller than the PVC size due to filesystem also took space - name: CPU_IDLE_PROF value: "disabled" # must be "enabled" or "disabled" + - name: IO_TYPES + value: "seqread,seqwrite,randread,randwrite" + - name: METRICS + value: "bandwidth,iops,latency" volumeMounts: - name: vol mountPath: /volume/ diff --git a/fio/bandwidth-quick.fio b/fio/bandwidth-quick.fio deleted file mode 100644 index 2bf3b0a..0000000 --- a/fio/bandwidth-quick.fio +++ /dev/null @@ -1,19 +0,0 @@ -[rand-read-bw] -readwrite=randread -include bw-include.fio -include quick-include.fio - -[rand-write-bw] -readwrite=randwrite -include bw-include.fio -include quick-include.fio - -[seq-read-bw] -readwrite=read -include bw-include.fio -include quick-include.fio - -[seq-write-bw] -readwrite=write -include bw-include.fio -include quick-include.fio diff --git a/fio/bandwidth.fio b/fio/bandwidth.fio deleted file mode 100644 index ecb7db1..0000000 --- a/fio/bandwidth.fio +++ /dev/null @@ -1,19 +0,0 @@ -[rand-read-bw] -readwrite=randread -include bw-include.fio -include common-include.fio - -[rand-write-bw] -readwrite=randwrite -include bw-include.fio -include common-include.fio - -[seq-read-bw] -readwrite=read -include bw-include.fio -include common-include.fio - -[seq-write-bw] -readwrite=write -include bw-include.fio -include common-include.fio diff --git a/fio/cmp_parse.sh b/fio/cmp_parse.sh index 3c280d6..2abcd0f 100755 --- a/fio/cmp_parse.sh +++ b/fio/cmp_parse.sh @@ -5,82 +5,91 @@ set -e CURRENT_DIR="$(dirname "$(readlink -f "$0")")" source $CURRENT_DIR/func.sh -if [ -z "FIRST_VOL_NAME" ]; then - echo Require the first volume name - exit 1 +if [ -z "${1}" ]; then + echo Require FIO IO types + exit 1 fi +IO_TYPES="${1}" -if [ -z "SECOND_VOL_NAME" ]; then - echo Require the second volume name - exit 1 +if [ -z "${2}" ]; then + echo Require FIO metrics + exit 1 fi +METRICS="${2}" -FIRST_IOPS=${FIRST_VOL_NAME}-iops.json -FIRST_BW=${FIRST_VOL_NAME}-bandwidth.json -FIRST_LAT=${FIRST_VOL_NAME}-latency.json - -SECOND_IOPS=${SECOND_VOL_NAME}-iops.json -SECOND_BW=${SECOND_VOL_NAME}-bandwidth.json -SECOND_LAT=${SECOND_VOL_NAME}-latency.json +if [ -z "FIRST_VOL_NAME" ]; then + echo Require the first volume name + exit 1 +fi -parse_iops $FIRST_IOPS -FIRST_RAND_READ_IOPS=$RAND_READ_IOPS -FIRST_RAND_WRITE_IOPS=$RAND_WRITE_IOPS -FIRST_SEQ_READ_IOPS=$SEQ_READ_IOPS -FIRST_SEQ_WRITE_IOPS=$SEQ_WRITE_IOPS -FIRST_CPU_IDLE_PCT_IOPS=$CPU_IDLE_PCT_IOPS +if [ -z "SECOND_VOL_NAME" ]; then + echo Require the second volume name + exit 1 +fi -parse_iops $SECOND_IOPS -SECOND_RAND_READ_IOPS=$RAND_READ_IOPS -SECOND_RAND_WRITE_IOPS=$RAND_WRITE_IOPS -SECOND_SEQ_READ_IOPS=$SEQ_READ_IOPS -SECOND_SEQ_WRITE_IOPS=$SEQ_WRITE_IOPS -SECOND_CPU_IDLE_PCT_IOPS=$CPU_IDLE_PCT_IOPS +IFS=',' read -r -a io_types_array <<< "${IO_TYPES}" +IFS=',' read -r -a metrics_array <<< "${METRICS}" + +to_uppercase() { + local input_str="$1" + local uppercase_str="${input_str^^}" # Convert to uppercase + echo "$uppercase_str" +} + +parse_metrics() { + local vol_name="$1" + local prefix="$2" + + if [[ -z "$vol_name" || -z "$prefix" ]]; then + echo "parse_metrics: Missing required parameters." >&2 + return 1 + fi + + for METRIC in "${metrics_array[@]}"; do + for IO_TYPE in "${io_types_array[@]}"; do + local output="${vol_name}-${IO_TYPE}-${METRIC}.json" + local parse_func="parse_${IO_TYPE}_${METRIC}" + + if declare -f "$parse_func" > /dev/null; then + $parse_func "$output" + + local metric=`to_uppercase $METRIC` + local io_type=`to_uppercase $IO_TYPE` + local var_suffix="" + local var_name="" + + var_suffix="${io_type}_${metric^^}" + var_name="${prefix}_${var_suffix}" + declare -g "$var_name=${!var_suffix}" + + var_suffix="CPU_IDLE_PCT_${io_type}_${metric^^}" + var_name="${prefix}_${var_suffix}" + declare -g "$var_name=${!var_suffix}" + else + echo "parse_metrics: Parser function '$parse_func' not found for $output." >&2 + fi + done + done +} + +parse_metrics "$FIRST_VOL_NAME" "FIRST" +parse_metrics "$SECOND_VOL_NAME" "SECOND" calc_cmp_iops +calc_cmp_bandwidth +calc_cmp_latency -parse_bw $FIRST_BW -FIRST_RAND_READ_BW=$RAND_READ_BW -FIRST_RAND_WRITE_BW=$RAND_WRITE_BW -FIRST_SEQ_READ_BW=$SEQ_READ_BW -FIRST_SEQ_WRITE_BW=$SEQ_WRITE_BW -FIRST_CPU_IDLE_PCT_BW=$CPU_IDLE_PCT_BW - -parse_bw $SECOND_BW -SECOND_RAND_READ_BW=$RAND_READ_BW -SECOND_RAND_WRITE_BW=$RAND_WRITE_BW -SECOND_SEQ_READ_BW=$SEQ_READ_BW -SECOND_SEQ_WRITE_BW=$SEQ_WRITE_BW -SECOND_CPU_IDLE_PCT_BW=$CPU_IDLE_PCT_BW - -calc_cmp_bw - -parse_lat $FIRST_LAT -FIRST_RAND_READ_LAT=$RAND_READ_LAT -FIRST_RAND_WRITE_LAT=$RAND_WRITE_LAT -FIRST_SEQ_READ_LAT=$SEQ_READ_LAT -FIRST_SEQ_WRITE_LAT=$SEQ_WRITE_LAT -FIRST_CPU_IDLE_PCT_LAT=$CPU_IDLE_PCT_LAT - -parse_lat $SECOND_LAT -SECOND_RAND_READ_LAT=$RAND_READ_LAT -SECOND_RAND_WRITE_LAT=$RAND_WRITE_LAT -SECOND_SEQ_READ_LAT=$SEQ_READ_LAT -SECOND_SEQ_WRITE_LAT=$SEQ_WRITE_LAT -SECOND_CPU_IDLE_PCT_LAT=$CPU_IDLE_PCT_LAT - -calc_cmp_lat - +# Build the summary with header information RESULT=${FIRST_VOL_NAME}_vs_${SECOND_VOL_NAME}.summary QUICK_MODE_TEXT="Quick Mode: disabled" if [ -n "$QUICK_MODE" ]; then - QUICK_MODE_TEXT="Quick Mode: enabled" + QUICK_MODE_TEXT="Quick Mode: enabled" fi SIZE_TEXT="SIZE: 10g" if [ -n "$SIZE" ]; then - SIZE_TEXT="Size: $SIZE" + SIZE_TEXT="Size: $SIZE" fi SUMMARY=" @@ -94,118 +103,121 @@ $QUICK_MODE_TEXT " printf -v header "$CMP_FMT" \ - "" $FIRST_VOL_NAME "vs" $SECOND_VOL_NAME ":" "Change" + "" $FIRST_VOL_NAME "vs" $SECOND_VOL_NAME ":" "Change" SUMMARY+=$header -if [ x"$CPU_IDLE_PROF" = x"enabled" ]; then - printf -v cxt "IOPS (Read/Write)\n$CMP_FMT$CMP_FMT$CMP_FMT\n" \ - "Random:" \ - "$(commaize $FIRST_RAND_READ_IOPS) / $(commaize $FIRST_RAND_WRITE_IOPS)" \ - "vs" \ - "$(commaize $SECOND_RAND_READ_IOPS) / $(commaize $SECOND_RAND_WRITE_IOPS)" \ - ":" \ - "$CMP_RAND_READ_IOPS / $CMP_RAND_WRITE_IOPS" \ - "Sequential:" \ - "$(commaize $FIRST_SEQ_READ_IOPS) / $(commaize $FIRST_SEQ_WRITE_IOPS)" \ - "vs" \ - "$(commaize $SECOND_SEQ_READ_IOPS) / $(commaize $SECOND_SEQ_WRITE_IOPS)" \ - ":" \ - "$CMP_SEQ_READ_IOPS / $CMP_SEQ_WRITE_IOPS" \ - "CPU Idleness:" \ - "$FIRST_CPU_IDLE_PCT_IOPS%" \ - "vs" \ - "$SECOND_CPU_IDLE_PCT_IOPS%"\ - ":" \ - "$CMP_CPU_IDLE_PCT_IOPS%" - SUMMARY+=$cxt - - printf -v cxt "Bandwidth in KiB/sec (Read/Write)\n$CMP_FMT$CMP_FMT$CMP_FMT\n" \ - "Random:" \ - "$(commaize $FIRST_RAND_READ_BW) / $(commaize $FIRST_RAND_WRITE_BW)" \ - "vs" \ - "$(commaize $SECOND_RAND_READ_BW) / $(commaize $SECOND_RAND_WRITE_BW)" \ - ":" \ - "$CMP_RAND_READ_BW / $CMP_RAND_WRITE_BW" \ - "Sequential:" \ - "$(commaize $FIRST_SEQ_READ_BW) / $(commaize $FIRST_SEQ_WRITE_BW)" \ - "vs" \ - "$(commaize $SECOND_SEQ_READ_BW) / $(commaize $SECOND_SEQ_WRITE_BW)" \ - ":" \ - "$CMP_SEQ_READ_BW / $CMP_SEQ_WRITE_BW" \ - "CPU Idleness:" \ - "$FIRST_CPU_IDLE_PCT_BW%" \ - "vs" \ - "$SECOND_CPU_IDLE_PCT_BW%" \ - ":" \ - "$CMP_CPU_IDLE_PCT_BW%" - SUMMARY+=$cxt - - printf -v cxt "Latency in ns (Read/Write)\n$CMP_FMT$CMP_FMT$CMP_FMT\n" \ - "Random:" \ - "$(commaize $FIRST_RAND_READ_LAT) / $(commaize $FIRST_RAND_WRITE_LAT)" \ - "vs" \ - "$(commaize $SECOND_RAND_READ_LAT) / $(commaize $SECOND_RAND_WRITE_LAT)" \ - ":" \ - "$CMP_RAND_READ_LAT / $CMP_RAND_WRITE_LAT" \ - "Sequential:" \ - "$(commaize $FIRST_SEQ_READ_LAT) / $(commaize $FIRST_SEQ_WRITE_LAT)" \ - "vs" \ - "$(commaize $SECOND_SEQ_READ_LAT) / $(commaize $SECOND_SEQ_WRITE_LAT)" \ - ":" \ - "$CMP_SEQ_READ_LAT / $CMP_SEQ_WRITE_LAT" \ - "CPU Idleness:" \ - "$FIRST_CPU_IDLE_PCT_LAT%" \ - "vs" \ - "$SECOND_CPU_IDLE_PCT_LAT%" \ - ":" \ - "$CMP_CPU_IDLE_PCT_LAT%" - SUMMARY+=$cxt -else - printf -v cxt "IOPS (Read/Write)\n$CMP_FMT$CMP_FMT\n" \ - "Random:" \ - "$(commaize $FIRST_RAND_READ_IOPS) / $(commaize $FIRST_RAND_WRITE_IOPS)" \ - "vs" \ - "$(commaize $SECOND_RAND_READ_IOPS) / $(commaize $SECOND_RAND_WRITE_IOPS)" \ - ":" \ - "$CMP_RAND_READ_IOPS / $CMP_RAND_WRITE_IOPS" \ - "Sequential:" \ - "$(commaize $FIRST_SEQ_READ_IOPS) / $(commaize $FIRST_SEQ_WRITE_IOPS)" \ - "vs" \ - "$(commaize $SECOND_SEQ_READ_IOPS) / $(commaize $SECOND_SEQ_WRITE_IOPS)" \ - ":" \ - "$CMP_SEQ_READ_IOPS / $CMP_SEQ_WRITE_IOPS" - SUMMARY+=$cxt - - printf -v cxt "Bandwidth in KiB/sec (Read/Write)\n$CMP_FMT$CMP_FMT\n" \ - "Random:" \ - "$(commaize $FIRST_RAND_READ_BW) / $(commaize $FIRST_RAND_WRITE_BW)" \ - "vs" \ - "$(commaize $SECOND_RAND_READ_BW) / $(commaize $SECOND_RAND_WRITE_BW)" \ - ":" \ - "$CMP_RAND_READ_BW / $CMP_RAND_WRITE_BW" \ - "Sequential:" \ - "$(commaize $FIRST_SEQ_READ_BW) / $(commaize $FIRST_SEQ_WRITE_BW)" \ - "vs" \ - "$(commaize $SECOND_SEQ_READ_BW) / $(commaize $SECOND_SEQ_WRITE_BW)" \ - ":" \ - "$CMP_SEQ_READ_BW / $CMP_SEQ_WRITE_BW" - SUMMARY+=$cxt - - printf -v cxt "Latency in ns (Read/Write)\n$CMP_FMT$CMP_FMT\n" \ - "Random:" \ - "$(commaize $FIRST_RAND_READ_LAT) / $(commaize $FIRST_RAND_WRITE_LAT)" \ - "vs" \ - "$(commaize $SECOND_RAND_READ_LAT) / $(commaize $SECOND_RAND_WRITE_LAT)" \ - ":" \ - "$CMP_RAND_READ_LAT / $CMP_RAND_WRITE_LAT" \ - "Sequential:" \ - "$(commaize $FIRST_SEQ_READ_LAT) / $(commaize $FIRST_SEQ_WRITE_LAT)" \ - "vs" \ - "$(commaize $SECOND_SEQ_READ_LAT) / $(commaize $SECOND_SEQ_WRITE_LAT)" \ - ":" \ - "$CMP_SEQ_READ_LAT / $CMP_SEQ_WRITE_LAT" - SUMMARY+=$cxt +#!/bin/bash + +# Define a function to add metrics to the summary +add_metrics_to_summary() { + local metric_name="${1}" + local metric_unit="${2}" + + local first_randread="${3}" + local first_cpu_idle_pct_randread="${4}" + local first_randwrite="${5}" + local first_cpu_idle_pct_randwrite="${6}" + local second_randread="${7}" + local second_cpu_idle_pct_randread="${8}" + local second_randwrite="${9}" + local second_cpu_idle_pct_randwrite="${10}" + local cmp_randread="${11}" + local cmp_cpu_idle_pct_randread="${12}" + local cmp_randwrite="${13}" + local cmp_cpu_idle_pct_randwrite="${14}" + + local first_seqread="${15}" + local first_cpu_idle_pct_seqread="${16}" + local first_seqwrite="${17}" + local first_cpu_idle_pct_seqwrite="${18}" + local second_seqread="${19}" + local second_cpu_idle_pct_seqread="${20}" + local second_seqwrite="${21}" + local second_cpu_idle_pct_seqwrite="${22}" + local cmp_seqread="${23}" + local cmp_cpu_idle_pct_seqread="${24}" + local cmp_seqwrite="${25}" + local cmp_cpu_idle_pct_seqwrite="${26}" + + if [ "$CPU_IDLE_PROF" = "enabled" ]; then + printf -v cxt "${metric_name} in ${metric_unit} with CPU idleness in percent (Read/Write)\n${CMP_FMT}${CMP_FMT}${CMP_FMT}\n" \ + "Random:" \ + "$(commaize "${first_randread}") ($(commaize "${first_cpu_idle_pct_randread}")) / $(commaize "${first_randwrite}") ($(commaize "${first_cpu_idle_pct_randwrite}"))" \ + "vs" \ + "$(commaize "${second_randread}") ($(commaize "${second_cpu_idle_pct_randread}")) / $(commaize "${second_randwrite}") ($(commaize "${second_cpu_idle_pct_randwrite}"))" ":" \ + "${cmp_randread} (${cmp_cpu_idle_pct_randread}) / ${cmp_randwrite} (${cmp_cpu_idle_pct_randwrite})" \ + "Sequential:" \ + "$(commaize "${first_seqread}") ($(commaize "${first_cpu_idle_pct_seqread}")) / $(commaize "${first_seqwrite}") ($(commaize "${first_cpu_idle_pct_seqwrite}"))" \ + "vs" \ + "$(commaize "${second_seqread}") ($(commaize "${second_cpu_idle_pct_seqread}")) / $(commaize "${second_seqwrite}") ($(commaize "${second_cpu_idle_pct_seqwrite}"))" ":" \ + "${cmp_seqread} (${cmp_cpu_idle_pct_seqread}) / ${cmp_seqwrite} (${cmp_cpu_idle_pct_seqwrite})" + else + printf -v cxt "${metric_name} in KiB/sec (Read/Write)\n${CMP_FMT}${CMP_FMT}${CMP_FMT}\n" \ + "Random:" \ + "$(commaize "${first_randread}") / $(commaize "${first_randwrite}")" \ + "vs" \ + "$(commaize "${second_randread}") / $(commaize "${second_randwrite}")" ":" \ + "${cmp_randread} / ${cmp_randwrite}" \ + "Sequential:" \ + "$(commaize "${first_seqread}") / $(commaize "${first_seqwrite}")" \ + "vs" \ + "$(commaize "${second_seqread}") / $(commaize "${second_seqwrite}")" ":" \ + "${cmp_seqread} / ${cmp_seqwrite}" + fi + SUMMARY+="${cxt}" +} + +# Check CPU_IDLE_PROF status +CPU_IDLE_STATUS="disabled" +if [ "x$CPU_IDLE_PROF" = "xenabled" ]; then + CPU_IDLE_STATUS="enabled" fi +# Example usage +add_metrics_to_summary "IOPS" "ops" \ + "$FIRST_RANDREAD_IOPS" "$FIRST_CPU_IDLE_PCT_RANDREAD_IOPS" \ + "$FIRST_RANDWRITE_IOPS" "$FIRST_CPU_IDLE_PCT_RANDWRITE_IOPS" \ + "$SECOND_RANDREAD_IOPS" "$SECOND_CPU_IDLE_PCT_RANDREAD_IOPS" \ + "$SECOND_RANDWRITE_IOPS" "$SECOND_CPU_IDLE_PCT_RANDWRITE_IOPS" \ + "$CMP_RANDREAD_IOPS" "$CMP_CPU_IDLE_PCT_RANDREAD_IOPS" \ + "$CMP_RANDWRITE_IOPS" "$CMP_CPU_IDLE_PCT_RANDWRITE_IOPS" \ + "$FIRST_SEQREAD_IOPS" "$FIRST_CPU_IDLE_PCT_SEQREAD_IOPS" \ + "$FIRST_SEQWRITE_IOPS" "$FIRST_CPU_IDLE_PCT_SEQWRITE_IOPS" \ + "$SECOND_SEQREAD_IOPS" "$SECOND_CPU_IDLE_PCT_SEQREAD_IOPS" \ + "$SECOND_SEQWRITE_IOPS" "$SECOND_CPU_IDLE_PCT_SEQWRITE_IOPS" \ + "$CMP_SEQREAD_IOPS" "$CMP_CPU_IDLE_PCT_SEQREAD_IOPS" \ + "$CMP_SEQWRITE_IOPS" "$CMP_CPU_IDLE_PCT_SEQWRITE_IOPS" + +add_metrics_to_summary "Bandwidth" "KiB/sec" \ + "$FIRST_RANDREAD_BANDWIDTH" "$FIRST_CPU_IDLE_PCT_RANDREAD_BANDWIDTH" \ + "$FIRST_RANDWRITE_BANDWIDTH" "$FIRST_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH" \ + "$SECOND_RANDREAD_BANDWIDTH" "$SECOND_CPU_IDLE_PCT_RANDREAD_BANDWIDTH" \ + "$SECOND_RANDWRITE_BANDWIDTH" "$SECOND_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH" \ + "$CMP_RANDREAD_BANDWIDTH" "$CMP_CPU_IDLE_PCT_RANDREAD_BANDWIDTH" \ + "$CMP_RANDWRITE_BANDWIDTH" "$CMP_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH" \ + "$FIRST_SEQREAD_BANDWIDTH" "$FIRST_CPU_IDLE_PCT_SEQREAD_BANDWIDTH" \ + "$FIRST_SEQWRITE_BANDWIDTH" "$FIRST_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH" \ + "$SECOND_SEQREAD_BANDWIDTH" "$SECOND_CPU_IDLE_PCT_SEQREAD_BANDWIDTH" \ + "$SECOND_SEQWRITE_BANDWIDTH" "$SECOND_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH" \ + "$CMP_SEQREAD_BANDWIDTH" "$CMP_CPU_IDLE_PCT_SEQREAD_BANDWIDTH" \ + "$CMP_SEQWRITE_BANDWIDTH" "$CMP_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH" + +add_metrics_to_summary "Latency" "ns" \ + "$FIRST_RANDREAD_LATENCY" "$FIRST_CPU_IDLE_PCT_RANDREAD_LATENCY" \ + "$FIRST_RANDWRITE_LATENCY" "$FIRST_CPU_IDLE_PCT_RANDWRITE_LATENCY" \ + "$SECOND_RANDREAD_LATENCY" "$SECOND_CPU_IDLE_PCT_RANDREAD_LATENCY" \ + "$SECOND_RANDWRITE_LATENCY" "$SECOND_CPU_IDLE_PCT_RANDWRITE_LATENCY" \ + "$CMP_RANDREAD_LATENCY" "$CMP_CPU_IDLE_PCT_RANDREAD_LATENCY" \ + "$CMP_RANDWRITE_LATENCY" "$CMP_CPU_IDLE_PCT_RANDWRITE_LATENCY" \ + "$FIRST_SEQREAD_LATENCY" "$FIRST_CPU_IDLE_PCT_SEQREAD_LATENCY" \ + "$FIRST_SEQWRITE_LATENCY" "$FIRST_CPU_IDLE_PCT_SEQWRITE_LATENCY" \ + "$SECOND_SEQREAD_LATENCY" "$SECOND_CPU_IDLE_PCT_SEQREAD_LATENCY" \ + "$SECOND_SEQWRITE_LATENCY" "$SECOND_CPU_IDLE_PCT_SEQWRITE_LATENCY" \ + "$CMP_SEQREAD_LATENCY" "$CMP_CPU_IDLE_PCT_SEQREAD_LATENCY" \ + "$CMP_SEQWRITE_LATENCY" "$CMP_CPU_IDLE_PCT_SEQWRITE_LATENCY" + + echo "$SUMMARY" > $RESULT cat $RESULT + + diff --git a/fio/cmp_run.sh b/fio/cmp_run.sh index 1c39b9a..6a005a2 100755 --- a/fio/cmp_run.sh +++ b/fio/cmp_run.sh @@ -6,23 +6,23 @@ CURRENT_DIR="$(dirname "$(readlink -f "$0")")" source $CURRENT_DIR/func.sh if [ -z "FIRST_VOL_NAME" ]; then - echo Require the first volume name - exit 1 + echo Require the first volume name + exit 1 fi if [ -z "FIRST_VOL_FILE" ]; then - echo Require the first volume file location - exit 1 + echo Require the first volume file location + exit 1 fi if [ -z "SECOND_VOL_NAME" ]; then - echo Require the second volume name - exit 1 + echo Require the second volume name + exit 1 fi if [ -z "SECOND_VOL_FILE" ]; then - echo Require the second volume file location - exit 1 + echo Require the second volume file location + exit 1 fi #disable parsing in run.sh @@ -31,4 +31,4 @@ export SKIP_PARSE=1 $CURRENT_DIR/run.sh $FIRST_VOL_FILE $FIRST_VOL_NAME $CURRENT_DIR/run.sh $SECOND_VOL_FILE $SECOND_VOL_NAME -$CURRENT_DIR/cmp_parse.sh +$CURRENT_DIR/cmp_parse.sh "$IO_TYPES" "$METRICS" diff --git a/fio/func.sh b/fio/func.sh index 06079a5..7a699fd 100644 --- a/fio/func.sh +++ b/fio/func.sh @@ -1,83 +1,168 @@ #!/bin/bash -parse_iops() { - local OUTPUT_IOPS=$1 - RAND_READ_IOPS=`cat $OUTPUT_IOPS | jq '.jobs[0].read.iops_mean'| cut -f1 -d.` - RAND_WRITE_IOPS=`cat $OUTPUT_IOPS | jq '.jobs[1].write.iops_mean'| cut -f1 -d.` - SEQ_READ_IOPS=`cat $OUTPUT_IOPS | jq '.jobs[2].read.iops_mean'| cut -f1 -d.` - SEQ_WRITE_IOPS=`cat $OUTPUT_IOPS | jq '.jobs[3].write.iops_mean'| cut -f1 -d.` - CPU_IDLE_PCT_IOPS=`cat $OUTPUT_IOPS | jq '.cpu_idleness.system' | cut -f1 -d.` +# IOPS +parse_seqread_iops() { + local OUTPUT=${1} + SEQREAD_IOPS=`cat $OUTPUT | jq '.jobs[0].read.iops_mean'| cut -f1 -d.` + CPU_IDLE_PCT_SEQREAD_IOPS=`cat $OUTPUT | jq '.cpu_idleness.system' | cut -f1 -d.` } -parse_bw() { - local OUTPUT_BW=$1 - RAND_READ_BW=`cat $OUTPUT_BW | jq '.jobs[0].read.bw_mean'| cut -f1 -d.` - RAND_WRITE_BW=`cat $OUTPUT_BW | jq '.jobs[1].write.bw_mean'| cut -f1 -d.` - SEQ_READ_BW=`cat $OUTPUT_BW | jq '.jobs[2].read.bw_mean'| cut -f1 -d.` - SEQ_WRITE_BW=`cat $OUTPUT_BW | jq '.jobs[3].write.bw_mean'| cut -f1 -d.` - CPU_IDLE_PCT_BW=`cat $OUTPUT_BW| jq '.cpu_idleness.system' | cut -f1 -d.` +parse_seqwrite_iops() { + local OUTPUT=${1} + SEQWRITE_IOPS=`cat $OUTPUT | jq '.jobs[0].write.iops_mean'| cut -f1 -d.` + CPU_IDLE_PCT_SEQWRITE_IOPS=`cat $OUTPUT | jq '.cpu_idleness.system' | cut -f1 -d.` } -parse_lat() { - local OUTPUT_LAT=$1 - RAND_READ_LAT=`cat $OUTPUT_LAT | jq '.jobs[0].read.lat_ns.mean'| cut -f1 -d.` - RAND_WRITE_LAT=`cat $OUTPUT_LAT | jq '.jobs[1].write.lat_ns.mean'| cut -f1 -d.` - SEQ_READ_LAT=`cat $OUTPUT_LAT | jq '.jobs[2].read.lat_ns.mean'| cut -f1 -d.` - SEQ_WRITE_LAT=`cat $OUTPUT_LAT | jq '.jobs[3].write.lat_ns.mean'| cut -f1 -d.` - CPU_IDLE_PCT_LAT=`cat $OUTPUT_LAT| jq '.cpu_idleness.system' | cut -f1 -d.` +parse_randread_iops() { + local OUTPUT=${1} + RANDREAD_IOPS=`cat $OUTPUT | jq '.jobs[0].read.iops_mean'| cut -f1 -d.` + CPU_IDLE_PCT_RANDREAD_IOPS=`cat $OUTPUT | jq '.cpu_idleness.system' | cut -f1 -d.` } -FMT="%15s%25s\n" -CMP_FMT="%15s%25s%5s%25s%5s%20s\n" +parse_randwrite_iops() { + local OUTPUT=${1} + RANDWRITE_IOPS=`cat $OUTPUT | jq '.jobs[0].write.iops_mean'| cut -f1 -d.` + CPU_IDLE_PCT_RANDWRITE_IOPS=`cat $OUTPUT | jq '.cpu_idleness.system' | cut -f1 -d.` +} + +# Bandwidth +parse_seqread_bandwidth() { + local OUTPUT=${1} + SEQREAD_BANDWIDTH=`cat $OUTPUT | jq '.jobs[0].read.bw_mean'| cut -f1 -d.` + CPU_IDLE_PCT_SEQREAD_BANDWIDTH=`cat $OUTPUT | jq '.cpu_idleness.system' | cut -f1 -d.` +} + +parse_seqwrite_bandwidth() { + local OUTPUT=${1} + SEQWRITE_BANDWIDTH=`cat $OUTPUT | jq '.jobs[0].write.bw_mean'| cut -f1 -d.` + CPU_IDLE_PCT_SEQWRITE_BANDWIDTH=`cat $OUTPUT | jq '.cpu_idleness.system' | cut -f1 -d.` +} + +parse_randread_bandwidth() { + local OUTPUT=${1} + RANDREAD_BANDWIDTH=`cat $OUTPUT | jq '.jobs[0].read.bw_mean'| cut -f1 -d.` + CPU_IDLE_PCT_RANDREAD_BANDWIDTH=`cat $OUTPUT | jq '.cpu_idleness.system' | cut -f1 -d.` +} + +parse_randwrite_bandwidth() { + local OUTPUT=${1} + RANDWRITE_BANDWIDTH=`cat $OUTPUT | jq '.jobs[0].write.bw_mean'| cut -f1 -d.` + CPU_IDLE_PCT_RANDWRITE_BANDWIDTH=`cat $OUTPUT | jq '.cpu_idleness.system' | cut -f1 -d.` +} + +# Latency +parse_seqread_latency() { + local OUTPUT=${1} + SEQREAD_LATENCY=`cat $OUTPUT | jq '.jobs[0].read.lat_ns.mean'| cut -f1 -d.` + CPU_IDLE_PCT_SEQREAD_LATENCY=`cat $OUTPUT | jq '.cpu_idleness.system' | cut -f1 -d.` +} + +parse_seqwrite_latency() { + local OUTPUT=${1} + SEQWRITE_LATENCY=`cat $OUTPUT | jq '.jobs[0].write.lat_ns.mean'| cut -f1 -d.` + CPU_IDLE_PCT_SEQWRITE_LATENCY=`cat $OUTPUT | jq '.cpu_idleness.system' | cut -f1 -d.` +} + +parse_randread_latency() { + local OUTPUT=${1} + RANDREAD_LATENCY=`cat $OUTPUT | jq '.jobs[0].read.lat_ns.mean'| cut -f1 -d.` + CPU_IDLE_PCT_RANDREAD_LATENCY=`cat $OUTPUT | jq '.cpu_idleness.system' | cut -f1 -d.` +} + +parse_randwrite_latency() { + local OUTPUT=${1} + RANDWRITE_LATENCY=`cat $OUTPUT | jq '.jobs[0].write.lat_ns.mean'| cut -f1 -d.` + CPU_IDLE_PCT_RANDWRITE_LATENCY=`cat $OUTPUT | jq '.cpu_idleness.system' | cut -f1 -d.` +} + + +FMT="%25s%25s\n" +CMP_FMT="%20s%30s%10s%30s%10s%25s\n" commaize() { - echo $1 | sed ':a;s/\B[0-9]\{3\}\>/,&/;ta' + echo $1 | sed ':a;s/\B[0-9]\{3\}\>/,&/;ta' } calc_cmp_iops() { - DELTA_RAND_READ_IOPS=$(($SECOND_RAND_READ_IOPS-$FIRST_RAND_READ_IOPS)) - CMP_RAND_READ_IOPS=`awk "BEGIN {printf \"%.2f\", - $DELTA_RAND_READ_IOPS*100/$FIRST_RAND_READ_IOPS}"`"%" - DELTA_RAND_WRITE_IOPS=$(($SECOND_RAND_WRITE_IOPS-$FIRST_RAND_WRITE_IOPS)) - CMP_RAND_WRITE_IOPS=`awk "BEGIN {printf \"%.2f\", - $DELTA_RAND_WRITE_IOPS*100/$FIRST_RAND_WRITE_IOPS}"`"%" - DELTA_SEQ_READ_IOPS=$(($SECOND_SEQ_READ_IOPS-$FIRST_SEQ_READ_IOPS)) - CMP_SEQ_READ_IOPS=`awk "BEGIN {printf \"%.2f\", - $DELTA_SEQ_READ_IOPS*100/$FIRST_SEQ_READ_IOPS}"`"%" - DELTA_SEQ_WRITE_IOPS=$(($SECOND_SEQ_WRITE_IOPS-$FIRST_SEQ_WRITE_IOPS)) - CMP_SEQ_WRITE_IOPS=`awk "BEGIN {printf \"%.2f\", - $DELTA_SEQ_WRITE_IOPS*100/$FIRST_SEQ_WRITE_IOPS}"`"%" - CMP_CPU_IDLE_PCT_IOPS=$(($SECOND_CPU_IDLE_PCT_IOPS - $FIRST_CPU_IDLE_PCT_IOPS)) -} - -calc_cmp_bw() { - DELTA_RAND_READ_BW=$(($SECOND_RAND_READ_BW-$FIRST_RAND_READ_BW)) - CMP_RAND_READ_BW=`awk "BEGIN {printf \"%.2f\", - $DELTA_RAND_READ_BW*100/$FIRST_RAND_READ_BW}"`"%" - DELTA_RAND_WRITE_BW=$(($SECOND_RAND_WRITE_BW-$FIRST_RAND_WRITE_BW)) - CMP_RAND_WRITE_BW=`awk "BEGIN {printf \"%.2f\", - $DELTA_RAND_WRITE_BW*100/$FIRST_RAND_WRITE_BW}"`"%" - DELTA_SEQ_READ_BW=$(($SECOND_SEQ_READ_BW-$FIRST_SEQ_READ_BW)) - CMP_SEQ_READ_BW=`awk "BEGIN {printf \"%.2f\", - $DELTA_SEQ_READ_BW*100/$FIRST_SEQ_READ_BW}"`"%" - DELTA_SEQ_WRITE_BW=$(($SECOND_SEQ_WRITE_BW-$FIRST_SEQ_WRITE_BW)) - CMP_SEQ_WRITE_BW=`awk "BEGIN {printf \"%.2f\", - $DELTA_SEQ_WRITE_BW*100/$FIRST_SEQ_WRITE_BW}"`"%" - CMP_CPU_IDLE_PCT_BW=$(($SECOND_CPU_IDLE_PCT_BW - $FIRST_CPU_IDLE_PCT_BW)) -} - -calc_cmp_lat() { - DELTA_RAND_READ_LAT=$(($SECOND_RAND_READ_LAT-$FIRST_RAND_READ_LAT)) - CMP_RAND_READ_LAT=`awk "BEGIN {printf \"%.2f\", - $DELTA_RAND_READ_LAT*100/$FIRST_RAND_READ_LAT}"`"%" - DELTA_RAND_WRITE_LAT=$(($SECOND_RAND_WRITE_LAT-$FIRST_RAND_WRITE_LAT)) - CMP_RAND_WRITE_LAT=`awk "BEGIN {printf \"%.2f\", - $DELTA_RAND_WRITE_LAT*100/$FIRST_RAND_WRITE_LAT}"`"%" - DELTA_SEQ_READ_LAT=$(($SECOND_SEQ_READ_LAT-$FIRST_SEQ_READ_LAT)) - CMP_SEQ_READ_LAT=`awk "BEGIN {printf \"%.2f\", - $DELTA_SEQ_READ_LAT*100/$FIRST_SEQ_READ_LAT}"`"%" - DELTA_SEQ_WRITE_LAT=$(($SECOND_SEQ_WRITE_LAT-$FIRST_SEQ_WRITE_LAT)) - CMP_SEQ_WRITE_LAT=`awk "BEGIN {printf \"%.2f\", - $DELTA_SEQ_WRITE_LAT*100/$FIRST_SEQ_WRITE_LAT}"`"%" - CMP_CPU_IDLE_PCT_LAT=$(($SECOND_CPU_IDLE_PCT_LAT - $FIRST_CPU_IDLE_PCT_LAT)) + DELTA_RANDREAD_IOPS=$((${SECOND_RANDREAD_IOPS:-0}-${FIRST_RANDREAD_IOPS:-0})) + CMP_RANDREAD_IOPS=`awk "BEGIN {printf \"%.2f\", + ${DELTA_RANDREAD_IOPS:-0}*100/${FIRST_RANDREAD_IOPS:-0}}"`"%" + DELTA_RANDWRITE_IOPS=$((${SECOND_RANDWRITE_IOPS:-0}-${FIRST_RANDWRITE_IOPS:-0})) + CMP_RANDWRITE_IOPS=`awk "BEGIN {printf \"%.2f\", + ${DELTA_RANDWRITE_IOPS:-0}*100/${FIRST_RANDWRITE_IOPS:-0}}"`"%" + DELTA_SEQREAD_IOPS=$((${SECOND_SEQREAD_IOPS:-0}-${FIRST_SEQREAD_IOPS:-0})) + CMP_SEQREAD_IOPS=`awk "BEGIN {printf \"%.2f\", + ${DELTA_SEQREAD_IOPS:-0}*100/${FIRST_SEQREAD_IOPS:-0}}"`"%" + DELTA_SEQWRITE_IOPS=$((${SECOND_SEQWRITE_IOPS:-0}-${FIRST_SEQWRITE_IOPS:-0})) + CMP_SEQWRITE_IOPS=`awk "BEGIN {printf \"%.2f\", + ${DELTA_SEQWRITE_IOPS:-0}*100/${FIRST_SEQWRITE_IOPS:-0}}"`"%" + + DELTA_CPU_IDLE_PCT_RANDREAD_IOPS=$((${SECOND_CPU_IDLE_PCT_RANDREAD_IOPS:-0}-${FIRST_CPU_IDLE_PCT_RANDREAD_IOPS:-0})) + CMP_CPU_IDLE_PCT_RANDREAD_IOPS=`awk "BEGIN {printf \"%.2f\", + ${DELTA_CPU_IDLE_PCT_RANDREAD_IOPS:-0}*100/${FIRST_CPU_IDLE_PCT_RANDREAD_IOPS:-0}}"`"%" + DELTA_CPU_IDLE_PCT_RANDWRITE_IOPS=$((${SECOND_CPU_IDLE_PCT_RANDWRITE_IOPS:-0}-${FIRST_CPU_IDLE_PCT_RANDWRITE_IOPS:-0})) + CMP_CPU_IDLE_PCT_RANDWRITE_IOPS=`awk "BEGIN {printf \"%.2f\", + ${DELTA_CPU_IDLE_PCT_RANDWRITE_IOPS:-0}*100/${FIRST_CPU_IDLE_PCT_RANDWRITE_IOPS:-0}}"`"%" + DELTA_CPU_IDLE_PCT_SEQREAD_IOPS=$((${SECOND_CPU_IDLE_PCT_SEQREAD_IOPS:-0}-${FIRST_CPU_IDLE_PCT_SEQREAD_IOPS:-0})) + CMP_CPU_IDLE_PCT_SEQREAD_IOPS=`awk "BEGIN {printf \"%.2f\", + ${DELTA_CPU_IDLE_PCT_SEQREAD_IOPS:-0}*100/${FIRST_CPU_IDLE_PCT_SEQREAD_IOPS:-0}}"`"%" + DELTA_CPU_IDLE_PCT_SEQWRITE_IOPS=$((${SECOND_CPU_IDLE_PCT_SEQWRITE_IOPS:-0}-${FIRST_CPU_IDLE_PCT_SEQWRITE_IOPS:-0})) + CMP_CPU_IDLE_PCT_SEQWRITE_IOPS=`awk "BEGIN {printf \"%.2f\", + ${DELTA_CPU_IDLE_PCT_SEQWRITE_IOPS:-0}*100/${FIRST_CPU_IDLE_PCT_SEQWRITE_IOPS:-0}}"`"%" +} + +calc_cmp_bandwidth() { + DELTA_RANDREAD_BANDWIDTH=$((${SECOND_RANDREAD_BANDWIDTH:-0}-${FIRST_RANDREAD_BANDWIDTH:-0})) + CMP_RANDREAD_BANDWIDTH=`awk "BEGIN {printf \"%.2f\", + ${DELTA_RANDREAD_BANDWIDTH:-0}*100/${FIRST_RANDREAD_BANDWIDTH:-0}}"`"%" + DELTA_RANDWRITE_BANDWIDTH=$((${SECOND_RANDWRITE_BANDWIDTH:-0}-${FIRST_RANDWRITE_BANDWIDTH:-0})) + CMP_RANDWRITE_BANDWIDTH=`awk "BEGIN {printf \"%.2f\", + ${DELTA_RANDWRITE_BANDWIDTH:-0}*100/${FIRST_RANDWRITE_BANDWIDTH:-0}}"`"%" + DELTA_SEQREAD_BANDWIDTH=$((${SECOND_SEQREAD_BANDWIDTH:-0}-${FIRST_SEQREAD_BANDWIDTH:-0})) + CMP_SEQREAD_BANDWIDTH=`awk "BEGIN {printf \"%.2f\", + ${DELTA_SEQREAD_BANDWIDTH:-0}*100/${FIRST_SEQREAD_BANDWIDTH:-0}}"`"%" + DELTA_SEQWRITE_BANDWIDTH=$((${SECOND_SEQWRITE_BANDWIDTH:-0}-${FIRST_SEQWRITE_BANDWIDTH:-0})) + CMP_SEQWRITE_BANDWIDTH=`awk "BEGIN {printf \"%.2f\", + ${DELTA_SEQWRITE_BANDWIDTH:-0}*100/${FIRST_SEQWRITE_BANDWIDTH:-0}}"`"%" + + DELTA_CPU_IDLE_PCT_RANDREAD_BANDWIDTH=$((${SECOND_CPU_IDLE_PCT_RANDREAD_BANDWIDTH:-0}-${FIRST_CPU_IDLE_PCT_RANDREAD_BANDWIDTH:-0})) + CMP_CPU_IDLE_PCT_RANDREAD_BANDWIDTH=`awk "BEGIN {printf \"%.2f\", + ${DELTA_CPU_IDLE_PCT_RANDREAD_BANDWIDTH:-0}*100/${FIRST_CPU_IDLE_PCT_RANDREAD_BANDWIDTH:-0}}"`"%" + DELTA_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH=$((${SECOND_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH:-0}-${FIRST_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH:-0})) + CMP_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH=`awk "BEGIN {printf \"%.2f\", + ${DELTA_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH:-0}*100/${FIRST_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH:-0}}"`"%" + DELTA_CPU_IDLE_PCT_SEQREAD_BANDWIDTH=$((${SECOND_CPU_IDLE_PCT_SEQREAD_BANDWIDTH:-0}-${FIRST_CPU_IDLE_PCT_SEQREAD_BANDWIDTH:-0})) + CMP_CPU_IDLE_PCT_SEQREAD_BANDWIDTH=`awk "BEGIN {printf \"%.2f\", + ${DELTA_CPU_IDLE_PCT_SEQREAD_BANDWIDTH:-0}*100/${FIRST_CPU_IDLE_PCT_SEQREAD_BANDWIDTH:-0}}"`"%" + DELTA_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH=$((${SECOND_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH:-0}-${FIRST_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH:-0})) + CMP_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH=`awk "BEGIN {printf \"%.2f\", + ${DELTA_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH:-0}*100/${FIRST_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH:-0}}"`"%" +} + +calc_cmp_latency() { + DELTA_RANDREAD_LATENCY=$((${SECOND_RANDREAD_LATENCY:-0}-${FIRST_RANDREAD_LATENCY:-0})) + CMP_RANDREAD_LATENCY=`awk "BEGIN {printf \"%.2f\", + ${DELTA_RANDREAD_LATENCY:-0}*100/${FIRST_RANDREAD_LATENCY:-0}}"`"%" + DELTA_RANDWRITE_LATENCY=$((${SECOND_RANDWRITE_LATENCY:-0}-${FIRST_RANDWRITE_LATENCY:-0})) + CMP_RANDWRITE_LATENCY=`awk "BEGIN {printf \"%.2f\", + ${DELTA_RANDWRITE_LATENCY:-0}*100/${FIRST_RANDWRITE_LATENCY:-0}}"`"%" + DELTA_SEQREAD_LATENCY=$((${SECOND_SEQREAD_LATENCY:-0}-${FIRST_SEQREAD_LATENCY:-0})) + CMP_SEQREAD_LATENCY=`awk "BEGIN {printf \"%.2f\", + ${DELTA_SEQREAD_LATENCY:-0}*100/${FIRST_SEQREAD_LATENCY:-0}}"`"%" + DELTA_SEQWRITE_LATENCY=$((${SECOND_SEQWRITE_LATENCY:-0}-${FIRST_SEQWRITE_LATENCY:-0})) + CMP_SEQWRITE_LATENCY=`awk "BEGIN {printf \"%.2f\", + ${DELTA_SEQWRITE_LATENCY:-0}*100/${FIRST_SEQWRITE_LATENCY:-0}}"`"%" + + DELTA_CPU_IDLE_PCT_RANDREAD_LATENCY=$((${SECOND_CPU_IDLE_PCT_RANDREAD_LATENCY:-0}-${FIRST_CPU_IDLE_PCT_RANDREAD_LATENCY:-0})) + CMP_CPU_IDLE_PCT_RANDREAD_LATENCY=`awk "BEGIN {printf \"%.2f\", + ${DELTA_CPU_IDLE_PCT_RANDREAD_LATENCY:-0}*100/${FIRST_CPU_IDLE_PCT_RANDREAD_LATENCY:-0}}"`"%" + DELTA_CPU_IDLE_PCT_RANDWRITE_LATENCY=$((${SECOND_CPU_IDLE_PCT_RANDWRITE_LATENCY:-0}-${FIRST_CPU_IDLE_PCT_RANDWRITE_LATENCY:-0})) + CMP_CPU_IDLE_PCT_RANDWRITE_LATENCY=`awk "BEGIN {printf \"%.2f\", + ${DELTA_CPU_IDLE_PCT_RANDWRITE_LATENCY:-0}*100/${FIRST_CPU_IDLE_PCT_RANDWRITE_LATENCY:-0}}"`"%" + DELTA_CPU_IDLE_PCT_SEQREAD_LATENCY=$((${SECOND_CPU_IDLE_PCT_SEQREAD_LATENCY:-0}-${FIRST_CPU_IDLE_PCT_SEQREAD_LATENCY:-0})) + CMP_CPU_IDLE_PCT_SEQREAD_LATENCY=`awk "BEGIN {printf \"%.2f\", + ${DELTA_CPU_IDLE_PCT_SEQREAD_LATENCY:-0}*100/${FIRST_CPU_IDLE_PCT_SEQREAD_LATENCY:-0}}"`"%" + DELTA_CPU_IDLE_PCT_SEQWRITE_LATENCY=$((${SECOND_CPU_IDLE_PCT_SEQWRITE_LATENCY:-0}-${FIRST_CPU_IDLE_PCT_SEQWRITE_LATENCY:-0})) + CMP_CPU_IDLE_PCT_SEQWRITE_LATENCY=`awk "BEGIN {printf \"%.2f\", + ${DELTA_CPU_IDLE_PCT_SEQWRITE_LATENCY:-0}*100/${FIRST_CPU_IDLE_PCT_SEQWRITE_LATENCY:-0}}"`"%" } diff --git a/fio/bw-include.fio b/fio/jobs/bandwidth-include.fio similarity index 100% rename from fio/bw-include.fio rename to fio/jobs/bandwidth-include.fio diff --git a/fio/jobs/bandwidth-quick.fio b/fio/jobs/bandwidth-quick.fio new file mode 100644 index 0000000..8f1e9e6 --- /dev/null +++ b/fio/jobs/bandwidth-quick.fio @@ -0,0 +1,19 @@ +[randread-bandwidth] +readwrite=randread +include bandwidth-include.fio +include quick-include.fio + +[randwrite-bandwidth] +readwrite=randwrite +include bandwidth-include.fio +include quick-include.fio + +[seqread-bandwidth] +readwrite=read +include bandwidth-include.fio +include quick-include.fio + +[seqwrite-bandwidth] +readwrite=write +include bandwidth-include.fio +include quick-include.fio diff --git a/fio/jobs/bandwidth.fio b/fio/jobs/bandwidth.fio new file mode 100644 index 0000000..d652b57 --- /dev/null +++ b/fio/jobs/bandwidth.fio @@ -0,0 +1,19 @@ +[randread-bandwidth] +readwrite=randread +include bandwidth-include.fio +include common-include.fio + +[randwrite-bandwidth] +readwrite=randwrite +include bandwidth-include.fio +include common-include.fio + +[seqread-bandwidth] +readwrite=read +include bandwidth-include.fio +include common-include.fio + +[seqwrite-bandwidth] +readwrite=write +include bandwidth-include.fio +include common-include.fio diff --git a/fio/common-include.fio b/fio/jobs/common-include.fio similarity index 100% rename from fio/common-include.fio rename to fio/jobs/common-include.fio diff --git a/fio/iops-include.fio b/fio/jobs/iops-include.fio similarity index 100% rename from fio/iops-include.fio rename to fio/jobs/iops-include.fio diff --git a/fio/iops-quick.fio b/fio/jobs/iops-quick.fio similarity index 80% rename from fio/iops-quick.fio rename to fio/jobs/iops-quick.fio index 7af961c..6196b88 100644 --- a/fio/iops-quick.fio +++ b/fio/jobs/iops-quick.fio @@ -1,19 +1,19 @@ -[rand-read-iops] +[randread-iops] readwrite=randread include iops-include.fio include quick-include.fio -[rand-write-iops] +[randwrite-iops] readwrite=randwrite include iops-include.fio include quick-include.fio -[seq-read-iops] +[seqread-iops] readwrite=read include iops-include.fio include quick-include.fio -[seq-write-iops] +[seqwrite-iops] readwrite=write include iops-include.fio include quick-include.fio diff --git a/fio/iops.fio b/fio/jobs/iops.fio similarity index 80% rename from fio/iops.fio rename to fio/jobs/iops.fio index 19e4586..325b6c5 100644 --- a/fio/iops.fio +++ b/fio/jobs/iops.fio @@ -1,19 +1,19 @@ -[rand-read-iops] +[randread-iops] readwrite=randread include iops-include.fio include common-include.fio -[rand-write-iops] +[randwrite-iops] readwrite=randwrite include iops-include.fio include common-include.fio -[seq-read-iops] +[seqread-iops] readwrite=read include iops-include.fio include common-include.fio -[seq-write-iops] +[seqwrite-iops] readwrite=write include iops-include.fio include common-include.fio diff --git a/fio/lat-include.fio b/fio/jobs/latency-include.fio similarity index 100% rename from fio/lat-include.fio rename to fio/jobs/latency-include.fio diff --git a/fio/jobs/latency-quick.fio b/fio/jobs/latency-quick.fio new file mode 100644 index 0000000..a1a5a41 --- /dev/null +++ b/fio/jobs/latency-quick.fio @@ -0,0 +1,19 @@ +[randread-latency] +readwrite=randread +include latency-include.fio +include quick-include.fio + +[randwrite-latency] +readwrite=randwrite +include latency-include.fio +include quick-include.fio + +[seqread-latency] +readwrite=read +include latency-include.fio +include quick-include.fio + +[seqwrite-latency] +readwrite=write +include latency-include.fio +include quick-include.fio diff --git a/fio/jobs/latency.fio b/fio/jobs/latency.fio new file mode 100644 index 0000000..241a069 --- /dev/null +++ b/fio/jobs/latency.fio @@ -0,0 +1,19 @@ +[randread-latency] +readwrite=randread +include latency-include.fio +include common-include.fio + +[randwrite-latency] +readwrite=randwrite +include latency-include.fio +include common-include.fio + +[seqread-latency] +readwrite=read +include latency-include.fio +include common-include.fio + +[seqwrite-latency] +readwrite=write +include latency-include.fio +include common-include.fio diff --git a/fio/quick-include.fio b/fio/jobs/quick-include.fio similarity index 100% rename from fio/quick-include.fio rename to fio/jobs/quick-include.fio diff --git a/fio/latency-quick.fio b/fio/latency-quick.fio deleted file mode 100644 index be347cb..0000000 --- a/fio/latency-quick.fio +++ /dev/null @@ -1,19 +0,0 @@ -[rand-read-lat] -readwrite=randread -include lat-include.fio -include quick-include.fio - -[rand-write-lat] -readwrite=randwrite -include lat-include.fio -include quick-include.fio - -[seq-read-lat] -readwrite=read -include lat-include.fio -include quick-include.fio - -[seq-write-lat] -readwrite=write -include lat-include.fio -include quick-include.fio diff --git a/fio/latency.fio b/fio/latency.fio deleted file mode 100644 index 973abf7..0000000 --- a/fio/latency.fio +++ /dev/null @@ -1,19 +0,0 @@ -[rand-read-lat] -readwrite=randread -include lat-include.fio -include common-include.fio - -[rand-write-lat] -readwrite=randwrite -include lat-include.fio -include common-include.fio - -[seq-read-lat] -readwrite=read -include lat-include.fio -include common-include.fio - -[seq-write-lat] -readwrite=write -include lat-include.fio -include common-include.fio diff --git a/fio/parse.sh b/fio/parse.sh index 2a5c843..f1a0746 100755 --- a/fio/parse.sh +++ b/fio/parse.sh @@ -5,106 +5,98 @@ set -e CURRENT_DIR="$(dirname "$(readlink -f "$0")")" source $CURRENT_DIR/func.sh -if [ -z $1 ]; -then - echo Require FIO output prefix - exit 1 +append_metric() { + local metric_name="${1}" + local metric_unit="${2}" + local randread="${3}" + local cpu_idle_pct_randread="${4}" + local randwrite="${5}" + local cpu_idle_pct_randwrite="${6}" + local seqread="${7}" + local cpu_idle_pct_seqread="${8}" + local seqwrite="${9}" + local cpu_idle_pct_seqwrite="${10}" + + if [ "$CPU_IDLE_PROF" = "enabled" ]; then + # If CPU idle profiling is enabled, include it in the output + printf -v cxt "%s in %s with CPU idleness in percent (Read/Write)\n$FMT$FMT\n" \ + "$metric_name" "$metric_unit" \ + "Random:" \ + "$(commaize "${randread:-0}") ($(commaize "${cpu_idle_pct_randread:-0}")) / $(commaize "${randwrite:-0}") ($(commaize "${cpu_idle_pct_randwrite:-0}"))" \ + "Sequential:" \ + "$(commaize "${seqread:-0}") ($(commaize "${cpu_idle_pct_seqread:-0}")) / $(commaize "${seqwrite:-0}") ($(commaize "${cpu_idle_pct_seqwrite:-0}"))" + else + # If CPU idle profiling is not enabled, exclude it from the output + printf -v cxt "%s in %s (Read/Write)\n$FMT$FMT\n" \ + "$metric_name" "$metric_unit" \ + "Random:" \ + "$(commaize "${randread:-0}") / $(commaize "${randwrite:-0}")" \ + "Sequential:" \ + "$(commaize "${seqread:-0}") / $(commaize "${seqwrite:-0}")" + fi + SUMMARY+="$cxt" +} + + +if [ -z "${1}" ]; then + echo Require FIO IO types + exit 1 fi +IO_TYPES="${1}" -PREFIX=${1} -OUTPUT_IOPS=${PREFIX}-iops.json -OUTPUT_BW=${PREFIX}-bandwidth.json -OUTPUT_LAT=${PREFIX}-latency.json - -if [ ! -f "$OUTPUT_IOPS" ]; then - echo "$OUTPUT_IOPS doesn't exist" -else - parse_iops $OUTPUT_IOPS +if [ -z "${2}" ]; then + echo Require FIO metrics + exit 1 fi +METRICS="${2}" -if [ ! -f "$OUTPUT_BW" ]; then - echo "$OUTPUT_BW doesn't exist" -else - parse_bw $OUTPUT_BW +if [ -z "${3}" ]; then + echo Require FIO output prefix + exit 1 fi +PREFIX="${3}" -if [ ! -f "$OUTPUT_LAT" ]; then - echo "$OUTPUT_LAT doesn't exist" -else - parse_lat $OUTPUT_LAT -fi -RESULT=${1}.summary +IFS=',' read -r -a io_types_array <<< "${IO_TYPES}" +IFS=',' read -r -a metrics_array <<< "${METRICS}" -QUICK_MODE_TEXT="Quick Mode: disabled" -if [ -n "$QUICK_MODE" ]; then - QUICK_MODE_TEXT="Quick Mode: enabled" -fi +for TYPE in "${io_types_array[@]}"; do + for METRIC in "${metrics_array[@]}"; do + OUTPUT="${PREFIX}-${TYPE}-${METRIC}.json" + parse_${TYPE}_${METRIC} "$OUTPUT" + done +done -SIZE_TEXT="Size: 10g" -if [ -n "$SIZE" ]; then - SIZE_TEXT="Size: $SIZE" -fi +# Initialize the result file name +RESULT=${PREFIX}.summary +# Build the summary with header information SUMMARY=" ========================= FIO Benchmark Summary For: $PREFIX -CPU Idleness Profiling: $CPU_IDLE_PROF -$SIZE_TEXT -$QUICK_MODE_TEXT +CPU Idleness Profiling: ${CPU_IDLE_PROF:-not provided} +Size: ${SIZE:-10g} +Quick Mode: ${QUICK_MODE:-disabled} ========================= " -if [ x"$CPU_IDLE_PROF" = x"enabled" ]; then - printf -v cxt "IOPS (Read/Write)\n$FMT$FMT$FMT\n"\ - "Random:" \ - "$(commaize $RAND_READ_IOPS) / $(commaize $RAND_WRITE_IOPS)" \ - "Sequential:" \ - "$(commaize $SEQ_READ_IOPS) / $(commaize $SEQ_WRITE_IOPS)" \ - "CPU Idleness:" \ - "$CPU_IDLE_PCT_IOPS%" - SUMMARY+=$cxt - - printf -v cxt "Bandwidth in KiB/sec (Read/Write)\n$FMT$FMT$FMT\n"\ - "Random:" \ - "$(commaize $RAND_READ_BW) / $(commaize $RAND_WRITE_BW)" \ - "Sequential:" \ - "$(commaize $SEQ_READ_BW) / $(commaize $SEQ_WRITE_BW)" \ - "CPU Idleness:" \ - "$CPU_IDLE_PCT_BW%" - SUMMARY+=$cxt - - printf -v cxt "Latency in ns (Read/Write)\n$FMT$FMT\n"\ - "Random:" \ - "$(commaize $RAND_READ_LAT) / $(commaize $RAND_WRITE_LAT)" \ - "Sequential:" \ - "$(commaize $SEQ_READ_LAT) / $(commaize $SEQ_WRITE_LAT)" \ - "CPU Idleness:" \ - "$CPU_IDLE_PCT_LAT%" - SUMMARY+=$cxt -else - printf -v cxt "IOPS (Read/Write)\n$FMT$FMT\n"\ - "Random:" \ - "$(commaize $RAND_READ_IOPS) / $(commaize $RAND_WRITE_IOPS)" \ - "Sequential:" \ - "$(commaize $SEQ_READ_IOPS) / $(commaize $SEQ_WRITE_IOPS)" - SUMMARY+=$cxt - - printf -v cxt "Bandwidth in KiB/sec (Read/Write)\n$FMT$FMT$FMT\n"\ - "Random:" \ - "$(commaize $RAND_READ_BW) / $(commaize $RAND_WRITE_BW)" \ - "Sequential:" \ - "$(commaize $SEQ_READ_BW) / $(commaize $SEQ_WRITE_BW)" - SUMMARY+=$cxt - - printf -v cxt "Latency in ns (Read/Write)\n$FMT$FMT\n"\ - "Random:" \ - "$(commaize $RAND_READ_LAT) / $(commaize $RAND_WRITE_LAT)" \ - "Sequential:" \ - "$(commaize $SEQ_READ_LAT) / $(commaize $SEQ_WRITE_LAT)" - SUMMARY+=$cxt -fi - -echo "$SUMMARY" > $RESULT -cat $RESULT +# Append performance metrics to the summary +append_metric "IOPS" "ops" \ + "$RANDREAD_IOPS" "$CPU_IDLE_PCT_RANDREAD_IOPS" \ + "$RANDWRITE_IOPS" "$CPU_IDLE_PCT_RANDWRITE_IOPS" \ + "$SEQREAD_IOPS" "$CPU_IDLE_PCT_SEQREAD_IOPS" \ + "$SEQWRITE_IOPS" "$CPU_IDLE_PCT_SEQWRITE_IOPS" +append_metric "Bandwidth" "KiB/sec" \ + "$RANDREAD_BANDWIDTH" "$CPU_IDLE_PCT_RANDREAD_BANDWIDTH" \ + "$RANDWRITE_BANDWIDTH" "$CPU_IDLE_PCT_RANDWRITE_BANDWIDTH" \ + "$SEQREAD_BANDWIDTH" "$CPU_IDLE_PCT_SEQREAD_BANDWIDTH" \ + "$SEQWRITE_BANDWIDTH" "$CPU_IDLE_PCT_SEQWRITE_BANDWIDTH" +append_metric "Latency" "ns" \ + "$RANDREAD_LATENCY" "$CPU_IDLE_PCT_RANDREAD_LATENCY" \ + "$RANDWRITE_LATENCY" "$CPU_IDLE_PCT_RANDWRITE_LATENCY" \ + "$SEQREAD_LATENCY" "$CPU_IDLE_PCT_SEQREAD_LATENCY" \ + "$SEQWRITE_LATENCY" "$CPU_IDLE_PCT_SEQWRITE_LATENCY" + +echo "$SUMMARY" > "$RESULT" +cat "$RESULT" diff --git a/fio/run.sh b/fio/run.sh index 22c60ac..66f77c6 100755 --- a/fio/run.sh +++ b/fio/run.sh @@ -3,65 +3,46 @@ set -e CURRENT_DIR="$(dirname "$(readlink -f "$0")")" +TEST_FILE="${1:-$FILE_NAME}" +OUTPUT="${2:-test_device}" +TEST_SIZE="${3:-${SIZE:-10g}}" -TEST_FILE=$1 - -# cmdline overrides the environment variable if [ -z "$TEST_FILE" ]; then - TEST_FILE=$FILE_NAME + echo "Require test file name" + exit 1 fi -if [ -z "$TEST_FILE" ]; then - echo Require test file name - exit 1 -fi +echo "TEST_FILE: $TEST_FILE" +echo "TEST_OUTPUT_PREFIX: $OUTPUT" +echo "TEST_SIZE: $TEST_SIZE" if [ x"$CPU_IDLE_PROF" = x"enabled" ]; then - IDLE_PROF="--idle-prof=percpu" + IDLE_PROF="--idle-prof=percpu" fi -echo TEST_FILE: $TEST_FILE +IO_TYPES="${IO_TYPES:-seqread,seqwrite,randread,randwrite}" +METRICS="${METRICS:-bandwidth,iops,latency}" -OUTPUT=$2 -if [ -z $OUTPUT ]; -then - OUTPUT=test_device -fi -echo TEST_OUTPUT_PREFIX: $OUTPUT +echo "IO_TYPES: $IO_TYPES" +echo "METRICS: $METRICS" -TEST_SIZE=$3 -if [ -z "$TEST_SIZE" ]; then - TEST_SIZE=$SIZE -fi -if [ -z "$TEST_SIZE" ]; then - TEST_SIZE="10g" -fi -echo TEST_SIZE: $TEST_SIZE +IFS=',' read -r -a io_types_array <<< "${IO_TYPES}" +IFS=',' read -r -a metrics_array <<< "${METRICS}" -IOPS_FIO="iops.fio" -BW_FIO="bandwidth.fio" -LAT_FIO="latency.fio" -if [ -n "$QUICK_MODE" ]; then - echo QUICK_MODE: enabled - IOPS_FIO="iops-quick.fio" - BW_FIO="bandwidth-quick.fio" - LAT_FIO="latency-quick.fio" -fi +for TYPE in "${io_types_array[@]}"; do + for METRIC in "${metrics_array[@]}"; do + echo "Running $TYPE $METRIC test" -OUTPUT_IOPS=${OUTPUT}-iops.json -OUTPUT_BW=${OUTPUT}-bandwidth.json -OUTPUT_LAT=${OUTPUT}-latency.json + JOB_FILE="$CURRENT_DIR/jobs/$METRIC.fio" + if [ "$QUICK_MODE" = "enabled" ]; then + JOB_FILE="$CURRENT_DIR/jobs/$METRIC-quick.fio" + fi -echo Benchmarking $IOPS_FIO into $OUTPUT_IOPS -fio $CURRENT_DIR/$IOPS_FIO $IDLE_PROF --filename=$TEST_FILE --size=$TEST_SIZE \ - --output-format=json --output=$OUTPUT_IOPS -echo Benchmarking $BW_FIO into $OUTPUT_BW -fio $CURRENT_DIR/$BW_FIO $IDLE_PROF --filename=$TEST_FILE --size=$TEST_SIZE \ - --output-format=json --output=$OUTPUT_BW -echo Benchmarking $LAT_FIO into $OUTPUT_LAT -fio $CURRENT_DIR/$LAT_FIO $IDLE_PROF --filename=$TEST_FILE --size=$TEST_SIZE \ - --output-format=json --output=$OUTPUT_LAT + fio "$CURRENT_DIR/jobs/$METRIC.fio" $IDLE_PROF --section="${TYPE}-${METRIC}" --filename="$TEST_FILE" --size="$TEST_SIZE" --output-format=json --output="${OUTPUT}-${TYPE}-${METRIC}.json" + done +done if [ -z "$SKIP_PARSE" ]; then - $CURRENT_DIR/parse.sh $OUTPUT + "$CURRENT_DIR/parse.sh" "$IO_TYPES" "$METRICS" "$OUTPUT" fi + From 305568e6a6c2d737e442476991fe840512ddabd6 Mon Sep 17 00:00:00 2001 From: Derek Su Date: Mon, 8 Apr 2024 03:20:57 +0000 Subject: [PATCH 3/3] Expose P99 latency Expose 99th percentile. It means that 99% of the requests should be faster than given latency. Longhorn 8254 Signed-off-by: Derek Su --- fio/cmp_parse.sh | 88 +++++++++++++++++++++++++++--------------------- fio/cmp_run.sh | 6 ++-- fio/func.sh | 23 ++++++++++++- fio/parse.sh | 49 +++++++++++++++++---------- fio/run.sh | 5 ++- 5 files changed, 108 insertions(+), 63 deletions(-) diff --git a/fio/cmp_parse.sh b/fio/cmp_parse.sh index 2abcd0f..80e3f0d 100755 --- a/fio/cmp_parse.sh +++ b/fio/cmp_parse.sh @@ -17,6 +17,8 @@ if [ -z "${2}" ]; then fi METRICS="${2}" +P99_LATENCY="${3:-false}" + if [ -z "FIRST_VOL_NAME" ]; then echo Require the first volume name exit 1 @@ -49,6 +51,9 @@ parse_metrics() { for IO_TYPE in "${io_types_array[@]}"; do local output="${vol_name}-${IO_TYPE}-${METRIC}.json" local parse_func="parse_${IO_TYPE}_${METRIC}" + if [ "$P99_LATENCY" = "true" ]; then + parse_func="parse_${IO_TYPE}_${METRIC}_p99" + fi if declare -f "$parse_func" > /dev/null; then $parse_func "$output" @@ -80,8 +85,6 @@ calc_cmp_bandwidth calc_cmp_latency # Build the summary with header information -RESULT=${FIRST_VOL_NAME}_vs_${SECOND_VOL_NAME}.summary - QUICK_MODE_TEXT="Quick Mode: disabled" if [ -n "$QUICK_MODE" ]; then QUICK_MODE_TEXT="Quick Mode: enabled" @@ -92,22 +95,31 @@ if [ -n "$SIZE" ]; then SIZE_TEXT="Size: $SIZE" fi +# Determine the file name suffix and title based on P99_LATENCY +if [ "$P99_LATENCY" = "false" ]; then + FILE_SUFFIX="summary" + TITLE="FIO Benchmark Comparison Summary" +else + FILE_SUFFIX="p99_latency.summary" + TITLE="FIO Benchmark P99 Latency Comparison Summary" +fi + +RESULT="${FIRST_VOL_NAME}_vs_${SECOND_VOL_NAME}_${FILE_SUFFIX}" + SUMMARY=" -================================ -FIO Benchmark Comparsion Summary +=============================== +$TITLE For: $FIRST_VOL_NAME vs $SECOND_VOL_NAME CPU Idleness Profiling: $CPU_IDLE_PROF $SIZE_TEXT $QUICK_MODE_TEXT -================================ +=============================== " printf -v header "$CMP_FMT" \ "" $FIRST_VOL_NAME "vs" $SECOND_VOL_NAME ":" "Change" SUMMARY+=$header -#!/bin/bash - # Define a function to add metrics to the summary add_metrics_to_summary() { local metric_name="${1}" @@ -139,7 +151,7 @@ add_metrics_to_summary() { local cmp_seqwrite="${25}" local cmp_cpu_idle_pct_seqwrite="${26}" - if [ "$CPU_IDLE_PROF" = "enabled" ]; then + if [ "$CPU_IDLE_PROF" = "enabled" ] && [ "$P99_LATENCY" = "false" ]; then printf -v cxt "${metric_name} in ${metric_unit} with CPU idleness in percent (Read/Write)\n${CMP_FMT}${CMP_FMT}${CMP_FMT}\n" \ "Random:" \ "$(commaize "${first_randread}") ($(commaize "${first_cpu_idle_pct_randread}")) / $(commaize "${first_randwrite}") ($(commaize "${first_cpu_idle_pct_randwrite}"))" \ @@ -174,33 +186,35 @@ if [ "x$CPU_IDLE_PROF" = "xenabled" ]; then fi # Example usage -add_metrics_to_summary "IOPS" "ops" \ - "$FIRST_RANDREAD_IOPS" "$FIRST_CPU_IDLE_PCT_RANDREAD_IOPS" \ - "$FIRST_RANDWRITE_IOPS" "$FIRST_CPU_IDLE_PCT_RANDWRITE_IOPS" \ - "$SECOND_RANDREAD_IOPS" "$SECOND_CPU_IDLE_PCT_RANDREAD_IOPS" \ - "$SECOND_RANDWRITE_IOPS" "$SECOND_CPU_IDLE_PCT_RANDWRITE_IOPS" \ - "$CMP_RANDREAD_IOPS" "$CMP_CPU_IDLE_PCT_RANDREAD_IOPS" \ - "$CMP_RANDWRITE_IOPS" "$CMP_CPU_IDLE_PCT_RANDWRITE_IOPS" \ - "$FIRST_SEQREAD_IOPS" "$FIRST_CPU_IDLE_PCT_SEQREAD_IOPS" \ - "$FIRST_SEQWRITE_IOPS" "$FIRST_CPU_IDLE_PCT_SEQWRITE_IOPS" \ - "$SECOND_SEQREAD_IOPS" "$SECOND_CPU_IDLE_PCT_SEQREAD_IOPS" \ - "$SECOND_SEQWRITE_IOPS" "$SECOND_CPU_IDLE_PCT_SEQWRITE_IOPS" \ - "$CMP_SEQREAD_IOPS" "$CMP_CPU_IDLE_PCT_SEQREAD_IOPS" \ - "$CMP_SEQWRITE_IOPS" "$CMP_CPU_IDLE_PCT_SEQWRITE_IOPS" - -add_metrics_to_summary "Bandwidth" "KiB/sec" \ - "$FIRST_RANDREAD_BANDWIDTH" "$FIRST_CPU_IDLE_PCT_RANDREAD_BANDWIDTH" \ - "$FIRST_RANDWRITE_BANDWIDTH" "$FIRST_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH" \ - "$SECOND_RANDREAD_BANDWIDTH" "$SECOND_CPU_IDLE_PCT_RANDREAD_BANDWIDTH" \ - "$SECOND_RANDWRITE_BANDWIDTH" "$SECOND_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH" \ - "$CMP_RANDREAD_BANDWIDTH" "$CMP_CPU_IDLE_PCT_RANDREAD_BANDWIDTH" \ - "$CMP_RANDWRITE_BANDWIDTH" "$CMP_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH" \ - "$FIRST_SEQREAD_BANDWIDTH" "$FIRST_CPU_IDLE_PCT_SEQREAD_BANDWIDTH" \ - "$FIRST_SEQWRITE_BANDWIDTH" "$FIRST_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH" \ - "$SECOND_SEQREAD_BANDWIDTH" "$SECOND_CPU_IDLE_PCT_SEQREAD_BANDWIDTH" \ - "$SECOND_SEQWRITE_BANDWIDTH" "$SECOND_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH" \ - "$CMP_SEQREAD_BANDWIDTH" "$CMP_CPU_IDLE_PCT_SEQREAD_BANDWIDTH" \ - "$CMP_SEQWRITE_BANDWIDTH" "$CMP_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH" +if [ "$P99_LATENCY" = "false" ]; then + add_metrics_to_summary "IOPS" "ops" \ + "$FIRST_RANDREAD_IOPS" "$FIRST_CPU_IDLE_PCT_RANDREAD_IOPS" \ + "$FIRST_RANDWRITE_IOPS" "$FIRST_CPU_IDLE_PCT_RANDWRITE_IOPS" \ + "$SECOND_RANDREAD_IOPS" "$SECOND_CPU_IDLE_PCT_RANDREAD_IOPS" \ + "$SECOND_RANDWRITE_IOPS" "$SECOND_CPU_IDLE_PCT_RANDWRITE_IOPS" \ + "$CMP_RANDREAD_IOPS" "$CMP_CPU_IDLE_PCT_RANDREAD_IOPS" \ + "$CMP_RANDWRITE_IOPS" "$CMP_CPU_IDLE_PCT_RANDWRITE_IOPS" \ + "$FIRST_SEQREAD_IOPS" "$FIRST_CPU_IDLE_PCT_SEQREAD_IOPS" \ + "$FIRST_SEQWRITE_IOPS" "$FIRST_CPU_IDLE_PCT_SEQWRITE_IOPS" \ + "$SECOND_SEQREAD_IOPS" "$SECOND_CPU_IDLE_PCT_SEQREAD_IOPS" \ + "$SECOND_SEQWRITE_IOPS" "$SECOND_CPU_IDLE_PCT_SEQWRITE_IOPS" \ + "$CMP_SEQREAD_IOPS" "$CMP_CPU_IDLE_PCT_SEQREAD_IOPS" \ + "$CMP_SEQWRITE_IOPS" "$CMP_CPU_IDLE_PCT_SEQWRITE_IOPS" + + add_metrics_to_summary "Bandwidth" "KiB/sec" \ + "$FIRST_RANDREAD_BANDWIDTH" "$FIRST_CPU_IDLE_PCT_RANDREAD_BANDWIDTH" \ + "$FIRST_RANDWRITE_BANDWIDTH" "$FIRST_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH" \ + "$SECOND_RANDREAD_BANDWIDTH" "$SECOND_CPU_IDLE_PCT_RANDREAD_BANDWIDTH" \ + "$SECOND_RANDWRITE_BANDWIDTH" "$SECOND_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH" \ + "$CMP_RANDREAD_BANDWIDTH" "$CMP_CPU_IDLE_PCT_RANDREAD_BANDWIDTH" \ + "$CMP_RANDWRITE_BANDWIDTH" "$CMP_CPU_IDLE_PCT_RANDWRITE_BANDWIDTH" \ + "$FIRST_SEQREAD_BANDWIDTH" "$FIRST_CPU_IDLE_PCT_SEQREAD_BANDWIDTH" \ + "$FIRST_SEQWRITE_BANDWIDTH" "$FIRST_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH" \ + "$SECOND_SEQREAD_BANDWIDTH" "$SECOND_CPU_IDLE_PCT_SEQREAD_BANDWIDTH" \ + "$SECOND_SEQWRITE_BANDWIDTH" "$SECOND_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH" \ + "$CMP_SEQREAD_BANDWIDTH" "$CMP_CPU_IDLE_PCT_SEQREAD_BANDWIDTH" \ + "$CMP_SEQWRITE_BANDWIDTH" "$CMP_CPU_IDLE_PCT_SEQWRITE_BANDWIDTH" +fi add_metrics_to_summary "Latency" "ns" \ "$FIRST_RANDREAD_LATENCY" "$FIRST_CPU_IDLE_PCT_RANDREAD_LATENCY" \ @@ -218,6 +232,4 @@ add_metrics_to_summary "Latency" "ns" \ echo "$SUMMARY" > $RESULT -cat $RESULT - - +cat $RESULT \ No newline at end of file diff --git a/fio/cmp_run.sh b/fio/cmp_run.sh index 6a005a2..edf42a1 100755 --- a/fio/cmp_run.sh +++ b/fio/cmp_run.sh @@ -25,10 +25,8 @@ if [ -z "SECOND_VOL_FILE" ]; then exit 1 fi -#disable parsing in run.sh -export SKIP_PARSE=1 - $CURRENT_DIR/run.sh $FIRST_VOL_FILE $FIRST_VOL_NAME $CURRENT_DIR/run.sh $SECOND_VOL_FILE $SECOND_VOL_NAME -$CURRENT_DIR/cmp_parse.sh "$IO_TYPES" "$METRICS" +$CURRENT_DIR/cmp_parse.sh "$IO_TYPES" "$METRICS" "false" +$CURRENT_DIR/cmp_parse.sh "$IO_TYPES" "latency" "true" \ No newline at end of file diff --git a/fio/func.sh b/fio/func.sh index 7a699fd..e1d5cc0 100644 --- a/fio/func.sh +++ b/fio/func.sh @@ -75,8 +75,29 @@ parse_randwrite_latency() { CPU_IDLE_PCT_RANDWRITE_LATENCY=`cat $OUTPUT | jq '.cpu_idleness.system' | cut -f1 -d.` } +# Latency 99th percentile +parse_seqread_latency_p99() { + local OUTPUT=${1} + SEQREAD_LATENCY=`cat $OUTPUT | jq '.jobs[0].read.clat_ns.percentile["99.000000"]'| cut -f1 -d.` +} + +parse_seqwrite_latency_p99() { + local OUTPUT=${1} + SEQWRITE_LATENCY=`cat $OUTPUT | jq '.jobs[0].write.clat_ns.percentile["99.000000"]'| cut -f1 -d.` +} + +parse_randread_latency_p99() { + local OUTPUT=${1} + RANDREAD_LATENCY=`cat $OUTPUT | jq '.jobs[0].read.clat_ns.percentile["99.000000"]'| cut -f1 -d.` +} + +parse_randwrite_latency_p99() { + local OUTPUT=${1} + RANDWRITE_LATENCY=`cat $OUTPUT | jq '.jobs[0].write.clat_ns.percentile["99.000000"]'| cut -f1 -d.` +} + -FMT="%25s%25s\n" +FMT="%30s%30s\n" CMP_FMT="%20s%30s%10s%30s%10s%25s\n" commaize() { diff --git a/fio/parse.sh b/fio/parse.sh index f1a0746..a2f7ab4 100755 --- a/fio/parse.sh +++ b/fio/parse.sh @@ -17,7 +17,7 @@ append_metric() { local seqwrite="${9}" local cpu_idle_pct_seqwrite="${10}" - if [ "$CPU_IDLE_PROF" = "enabled" ]; then + if [ "$CPU_IDLE_PROF" = "enabled" ] && [ "$P99_LATENCY" = "false" ]; then # If CPU idle profiling is enabled, include it in the output printf -v cxt "%s in %s with CPU idleness in percent (Read/Write)\n$FMT$FMT\n" \ "$metric_name" "$metric_unit" \ @@ -56,6 +56,7 @@ if [ -z "${3}" ]; then fi PREFIX="${3}" +P99_LATENCY="${4:-true}" IFS=',' read -r -a io_types_array <<< "${IO_TYPES}" IFS=',' read -r -a metrics_array <<< "${METRICS}" @@ -63,35 +64,49 @@ IFS=',' read -r -a metrics_array <<< "${METRICS}" for TYPE in "${io_types_array[@]}"; do for METRIC in "${metrics_array[@]}"; do OUTPUT="${PREFIX}-${TYPE}-${METRIC}.json" - parse_${TYPE}_${METRIC} "$OUTPUT" + if [ "$P99_LATENCY" = "true" ]; then + parse_${TYPE}_${METRIC}_p99 "$OUTPUT" + else + parse_${TYPE}_${METRIC} "$OUTPUT" + fi done done # Initialize the result file name -RESULT=${PREFIX}.summary - # Build the summary with header information +if [ "$P99_LATENCY" = "false" ]; then + RESULT="${PREFIX}.summary" + TITLE="FIO Benchmark Summary" +else + RESULT="${PREFIX}_p99_latency.summary" + TITLE="FIO Benchmark P99 Latency Summary" +fi + +# Construct the SUMMARY with dynamic content SUMMARY=" -========================= -FIO Benchmark Summary +================================== +$TITLE For: $PREFIX CPU Idleness Profiling: ${CPU_IDLE_PROF:-not provided} Size: ${SIZE:-10g} Quick Mode: ${QUICK_MODE:-disabled} -========================= +================================== " # Append performance metrics to the summary -append_metric "IOPS" "ops" \ - "$RANDREAD_IOPS" "$CPU_IDLE_PCT_RANDREAD_IOPS" \ - "$RANDWRITE_IOPS" "$CPU_IDLE_PCT_RANDWRITE_IOPS" \ - "$SEQREAD_IOPS" "$CPU_IDLE_PCT_SEQREAD_IOPS" \ - "$SEQWRITE_IOPS" "$CPU_IDLE_PCT_SEQWRITE_IOPS" -append_metric "Bandwidth" "KiB/sec" \ - "$RANDREAD_BANDWIDTH" "$CPU_IDLE_PCT_RANDREAD_BANDWIDTH" \ - "$RANDWRITE_BANDWIDTH" "$CPU_IDLE_PCT_RANDWRITE_BANDWIDTH" \ - "$SEQREAD_BANDWIDTH" "$CPU_IDLE_PCT_SEQREAD_BANDWIDTH" \ - "$SEQWRITE_BANDWIDTH" "$CPU_IDLE_PCT_SEQWRITE_BANDWIDTH" +if [ "$P99_LATENCY" = "false" ]; then + append_metric "IOPS" "ops" \ + "$RANDREAD_IOPS" "$CPU_IDLE_PCT_RANDREAD_IOPS" \ + "$RANDWRITE_IOPS" "$CPU_IDLE_PCT_RANDWRITE_IOPS" \ + "$SEQREAD_IOPS" "$CPU_IDLE_PCT_SEQREAD_IOPS" \ + "$SEQWRITE_IOPS" "$CPU_IDLE_PCT_SEQWRITE_IOPS" + append_metric "Bandwidth" "KiB/sec" \ + "$RANDREAD_BANDWIDTH" "$CPU_IDLE_PCT_RANDREAD_BANDWIDTH" \ + "$RANDWRITE_BANDWIDTH" "$CPU_IDLE_PCT_RANDWRITE_BANDWIDTH" \ + "$SEQREAD_BANDWIDTH" "$CPU_IDLE_PCT_SEQREAD_BANDWIDTH" \ + "$SEQWRITE_BANDWIDTH" "$CPU_IDLE_PCT_SEQWRITE_BANDWIDTH" +fi + append_metric "Latency" "ns" \ "$RANDREAD_LATENCY" "$CPU_IDLE_PCT_RANDREAD_LATENCY" \ "$RANDWRITE_LATENCY" "$CPU_IDLE_PCT_RANDWRITE_LATENCY" \ diff --git a/fio/run.sh b/fio/run.sh index 66f77c6..2dfbbbc 100755 --- a/fio/run.sh +++ b/fio/run.sh @@ -42,7 +42,6 @@ for TYPE in "${io_types_array[@]}"; do done done -if [ -z "$SKIP_PARSE" ]; then - "$CURRENT_DIR/parse.sh" "$IO_TYPES" "$METRICS" "$OUTPUT" -fi +"$CURRENT_DIR/parse.sh" "$IO_TYPES" "$METRICS" "$OUTPUT" "false" +"$CURRENT_DIR/parse.sh" "$IO_TYPES" "latency" "$OUTPUT" "true"