Skip to content

Instantly share code, notes, and snippets.

@leonroy
Created May 16, 2021 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonroy/e841c805b59515289075b04674491bd0 to your computer and use it in GitHub Desktop.
Save leonroy/e841c805b59515289075b04674491bd0 to your computer and use it in GitHub Desktop.
Sysbench script to measure random I/O
#!/bin/bash
# Set to 2x RAM
FILE_TOTAL_SIZE="32G"
#Set to long enough to complete several runs
MAX_TIME="240"
#For random IO set to 4K otherwise set to 1M for sequential
FILE_BLOCK_SIZE="4K"
logdate=$(date +%F)
echo "Preparing test"
sysbench --test=fileio --file-total-size=$FILE_TOTAL_SIZE prepare
echo "Running tests"
for run in 1 2 3; do
for each in 1 4 8 16 32 64; do
#echo "############## Running Test - Read/Write - Thread Number:" $each "- Run:" $run "##############"
#sysbench --test=fileio --file-total-size=$FILE_TOTAL_SIZE --file-test-mode=rndrw --max-time=$MAX_TIME --max-requests=0 --file-block-size=$FILE_BLOCK_SIZE --num-threads=$each --file-fsync-all run > log-$logdate-readwrite-${each}T-${run}R.log
echo "############## Running Test - Write - Thread Number:" $each "- Run:" $run "##############"
sysbench --test=fileio --file-total-size=$FILE_TOTAL_SIZE --file-test-mode=rndwr --max-time=$MAX_TIME --max-requests=0 --file-block-size=$FILE_BLOCK_SIZE --num-threads=$each --file-fsync-all run > log-$logdate-write-${each}T-${run}R.log
echo "############## Running Test - Read - Thread Number:" $each "- Run:" $run "##############"
sysbench --test=fileio --file-total-size=$FILE_TOTAL_SIZE --file-test-mode=rndrd --max-time=$MAX_TIME --max-requests=0 --file-block-size=$FILE_BLOCK_SIZE --num-threads=$each run > log-$logdate-read-${each}T-${run}R.log
done
done
echo "Cleaning up"
sysbench --test=fileio --file-total-size=$FILE_TOTAL_SIZE cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment