Created
February 10, 2026 19:38
-
-
Save aahmed-se/0c300429f2ab670007cbb207bccdff66 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 | |
| # ๐๏ธ CLUSTER STORAGE AUDIT (Sequential & Random Suite) | |
| # Usage: ./storage_bench.sh /path/to/mount | |
| DIR=${1:-/data_vast/bench_$(hostname)} | |
| JOBS=16 # Number of simultaneous threads | |
| RUNTIME=10s # Duration of each of the 4 tests | |
| RAMP=5s # Warm-up time to saturate controllers | |
| FILE_SIZE=4G # Data per thread (Total per node = 64GB) | |
| # Ensure target directory exists | |
| mkdir -p "$DIR" | |
| echo "========================================================================" | |
| echo " ๐๏ธ STORAGE PERFORMANCE AUDIT" | |
| echo " ๐ฅ๏ธ Node: $(hostname)" | |
| echo " โ๏ธ Config: $JOBS threads | ${FILE_SIZE} per thread | ${RUNTIME} per test" | |
| echo "========================================================================" | |
| run_fio() { | |
| local label=$1 rw=$2 bs=$3 | |
| printf " %-15s ... " "$label" | |
| # --direct=1 bypasses local RAM cache to test actual storage speed | |
| # --fallocate=none prevents slow pre-zeroing on thin-provisioned storage | |
| result=$(fio --name=bench --group_reporting --time_based=1 \ | |
| --runtime=$RUNTIME --ramp_time=$RAMP \ | |
| --size=$FILE_SIZE --numjobs=$JOBS --ioengine=libaio --direct=1 \ | |
| --iodepth=32 --rw=$rw --bs=$bs --directory=$DIR \ | |
| --thread --fallocate=none --output-format=json 2>/dev/null) | |
| if [ $? -ne 0 ]; then echo "FAILED"; return; fi | |
| # Parse JSON results (Units: BW in Bytes, Latency in Nanoseconds) | |
| stats=$(echo "$result" | python3 -c " | |
| import sys, json | |
| try: | |
| j = json.load(sys.stdin)['jobs'][0] | |
| res = j['read'] if j['read']['bw_bytes'] > 0 else j['write'] | |
| print(f\"{res['bw_bytes']} {res['iops']} {res['clat_ns']['percentile']['99.000000']}\") | |
| except: print('0 0 0')") | |
| read bw iops p99 <<< "$stats" | |
| bw_gb=$(python3 -c "print(f'{$bw / 1e9:.2f}')") | |
| bw_mb=$(python3 -c "print(f'{$bw / 1e6:.0f}')") | |
| iops_k=$(python3 -c "print(f'{$iops / 1e3:.1f}')") | |
| p99_ms=$(python3 -c "print(f'{$p99 / 1e6:.1f}')") | |
| if [ "$bs" == "1m" ]; then | |
| printf "โ %6s GB/s | %8s K IOPS | p99 Latency: %s ms\n" "$bw_gb" "$iops_k" "$p99_ms" | |
| else | |
| printf "โ %6s MB/s | %8s K IOPS | p99 Latency: %s ms\n" "$bw_mb" "$iops_k" "$p99_ms" | |
| fi | |
| } | |
| # Execute tests in logical order (Write first to initialize data blocks) | |
| run_fio "Seq Write 1M" write 1m | |
| run_fio "Seq Read 1M" read 1m | |
| run_fio "Rand Write 4K" randwrite 4k | |
| run_fio "Rand Read 4K" randread 4k | |
| # Cleanup temporary test files | |
| rm -f "$DIR"/bench.* 2>/dev/null | |
| echo "========================================================================" | |
| echo " Audit Complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment