Last active
January 12, 2024 05:54
-
-
Save MrCroxx/1d5936038d86e7c413f695e3aef1e0a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -euo pipefail | |
| BASE=$1 | |
| FILE="${BASE}/fio" | |
| echo "${FILE} will be used for benchmark." | tee benchmark.log | |
| SIZE=$(df -Ph ${BASE} | awk 'NR==2 {print $4}') | |
| echo "Available size: ${SIZE}" | tee -a benchmark.log | |
| DIGIT=$(echo ${SIZE} | grep -o -E '[0-9]+') | |
| UNIT=$(echo ${SIZE} | grep -o -E '[a-zA-Z]+') | |
| SIZE="$(echo "${DIGIT} * 0.95 / 1" | bc)${UNIT}" | |
| echo "Benchmark Size: ${SIZE}" | tee -a benchmark.log | |
| echo "Preconditioning (Round 1/2)..." | tee -a benchmark.log | |
| fio --filename=${FILE} --rw=write --size=${SIZE} --direct=1 --verify=0 --ioengine=libaio \ | |
| --bs=1M --numjobs=1 --iodepth=8 --group_reporting \ | |
| --name=P1 --output=precondition.1.txt | |
| cat precondition.1.txt | tee -a benchmark.log | |
| echo "Preconditioning (Round 2/2)..." | tee -a benchmark.log | |
| fio --filename=${FILE} --rw=write --size=${SIZE} --direct=1 --verify=0 --ioengine=libaio \ | |
| --bs=1M --numjobs=1 --iodepth=8 --group_reporting \ | |
| --name=P2 --output=precondition.2.txt | |
| cat precondition.2.txt | tee -a benchmark.log | |
| echo "Benchmarking 128K SEQ W 8T64Q..." | tee -a benchmark.log | |
| fio --filename=${FILE} --rw=write --size=${SIZE} --direct=1 --verify=0 --ioengine=libaio \ | |
| --bs=128K --numjobs=8 --iodepth=64 --group_reporting \ | |
| --time_based=1 --ramp_time=120s --runtime=120s \ | |
| --name=128K_SEQ_W_8T64Q --output=128k_seq_w_8t64q.txt | |
| cat 128k_seq_w_8t64q.txt | tee -a benchmark.log | |
| echo "Benchmarking 128K SEQ R 8T64Q..." | tee -a benchmark.log | |
| fio --filename=${FILE} --rw=read --size=${SIZE} --direct=1 --verify=0 --ioengine=libaio \ | |
| --bs=128K --numjobs=8 --iodepth=64 --group_reporting \ | |
| --time_based=1 --ramp_time=120s --runtime=120s \ | |
| --name=128K_SEQ_R_8T64Q --output=128k_seq_r_8t64q.txt | |
| cat 128k_seq_r_8t64q.txt | tee -a benchmark.log | |
| echo "Benchmarking 4K RND W 8T256Q..." | tee -a benchmark.log | |
| fio --filename=${FILE} --rw=randwrite --size=${SIZE} --direct=1 --verify=0 --ioengine=libaio \ | |
| --bs=128K --numjobs=8 --iodepth=256 --group_reporting \ | |
| --time_based=1 --ramp_time=120s --runtime=120s \ | |
| --name=4K_RND_W_8T256Q --output=4k_rnd_w_8t256q.txt | |
| cat 4k_rnd_w_8t256q.txt | tee -a benchmark.log | |
| echo "Benchmarking 4K RND R 8T256Q..." | tee -a benchmark.log | |
| fio --filename=${FILE} --rw=randread --size=${SIZE} --direct=1 --verify=0 --ioengine=libaio \ | |
| --bs=128K --numjobs=8 --iodepth=256 --group_reporting \ | |
| --time_based=1 --ramp_time=120s --runtime=120s \ | |
| --name=4K_RND_R_8T256Q --output=4k_rnd_r_8t256q.txt | |
| cat 4k_rnd_r_8t256q.txt | tee -a benchmark.log | |
| echo "Benchmarking 4K RND W 1T8Q FDATASYNC..." | tee -a benchmark.log | |
| fio --filename=${FILE} --rw=randwrite --size=${SIZE} --direct=1 --verify=0 --ioengine=libaio \ | |
| --bs=4K --iodepth=8 --group_reporting --fdatasync=1 \ | |
| --time_based=1 --ramp_time=10s --runtime=30s \ | |
| --name=4K_RND_w_1T8Q_FDATASYNC --output=4k_rnd_w_1t8q_fdatasync.txt | |
| cat 4k_rnd_w_1t8q_fdatasync.txt | tee -a benchmark.log | |
| echo "Benchmarking 4K RND W 1T1Q FDATASYNC PSYNC..." | tee -a benchmark.log | |
| fio --filename=${FILE} --rw=randwrite --size=${SIZE} --direct=1 --verify=0 --ioengine=psync \ | |
| --bs=4K --iodepth=1 --group_reporting --fdatasync=1 \ | |
| --time_based=1 --ramp_time=10s --runtime=30s \ | |
| --name=4K_RND_w_1T1Q_FDATASYNC_PSYNC --output=4k_rnd_w_1t1q_fdatasync_psync.txt | |
| cat 4k_rnd_w_1t1q_fdatasync_psync.txt | tee -a benchmark.log | |
| echo "Saving benchmark results to benchmark.tar..." | tee -a benchmark.log | |
| tar cvf benchmark.tar benchmark.log precondition.1.txt precondition.2.txt 128k_seq_w_8t64q.txt 128k_seq_r_8t64q.txt 4k_rnd_w_8t256q.txt 4k_rnd_r_8t256q.txt 4k_rnd_w_1t8q_fdatasync.txt 4k_rnd_w_1t1q_fdatasync_psync.txt | |
| echo "Benchmark results saved to benchmark.tar!" | |
| rm ${FILE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment