-
-
Save Vynce/44f224c2846de5fa4cf1d5b1dcad2dc4 to your computer and use it in GitHub Desktop.
Quick and dirty benchmark for large directories in Unraid
This file contains 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 | |
# benchmark_shfs.sh version 0.2 | |
LOG_FILE="/boot/benchmark_shfs.log" | |
TEST_PATH="Download/benchmark" | |
DISK_PATH="/mnt/disk4/$TEST_PATH" | |
SHFS_PATH="/mnt/user/$TEST_PATH" | |
LS_COMMAND="/bin/ls -l --color=never" | |
time_command () { | |
t=$( { time -p "$@" &>/dev/null; } 2>&1) | |
t=${t//[$'\t\r\n ']} | |
t=${t#real} | |
t=${t%%user*} | |
echo "$t" | |
} | |
source /etc/unraid-version | |
source /boot/config/share.cfg | |
echo "Unraid $version" | |
# This can be set in 6.8.0+ under Settings -> Global Share Settings -> Tunable (support Hard Links) | |
echo "Hard Link support: ${fuse_useino:-not set}" | |
echo | |
rm -rf "$DISK_PATH" | |
mkdir -p "$DISK_PATH" | |
echo "NumFiles,DiskTime,SHFSTime" > "$LOG_FILE" | |
STEP_SIZE=100000 | |
MAX_FILES=300000 | |
for (( i = STEP_SIZE; i <= MAX_FILES; i += STEP_SIZE )); do | |
range_start=$(($i - $STEP_SIZE)) | |
range_end=$(($i - 1)) | |
echo "$i files" | |
echo "Writing files" | |
for (( j = range_start; j <= range_end; j++)); do | |
touch "$DISK_PATH/$j" | |
done | |
sync -f "$DISK_PATH" | |
echo -n "Benchmarking disk: " | |
# make sure any caches are warm | |
$LS_COMMAND "$DISK_PATH" > /dev/null | |
disk_time=$(time_command $LS_COMMAND "$DISK_PATH") | |
echo "$disk_time" | |
echo -n "Benchmarking SHFS: " | |
# make sure any caches are warm | |
$LS_COMMAND "$SHFS_PATH" > /dev/null | |
shfs_time=$(time_command $LS_COMMAND "$SHFS_PATH") | |
echo "$shfs_time" | |
echo "$i,$disk_time,$shfs_time" >> "$LOG_FILE" | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment