-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfs-test.sh
More file actions
executable file
·695 lines (596 loc) · 22.4 KB
/
fs-test.sh
File metadata and controls
executable file
·695 lines (596 loc) · 22.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
#!/bin/bash
# Usage: ./fs-test.sh <test_directory> <duration> <reader_jobs>
#
# Runs a 3-phase filesystem performance test:
# Phase 1: Write scale-up (find peak write throughput)
# Phase 2: Read scale-up (find peak read throughput)
# Phase 3: Full duplex with fixed readers at 400MB/s rate limit,
# scale writers until max write throughput or readers drop below 365MB/s
#
# Examples:
# ./fs-test.sh /mnt/testfs 30 8
# ./fs-test.sh /data/perf 60 16
set -euo pipefail
# Check if fio is installed
command -v fio >/dev/null || { echo "ERROR: fio not in PATH, try \"dnf install fio\" or \"brew install fio\""; exit 1; }
command -v bc >/dev/null || { echo "ERROR: bc not in PATH, try \"dnf install bc\" or \"brew install bc\""; exit 1; }
# Parse command-line arguments
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <test_directory> <duration_seconds> <reader_jobs>"
echo ""
echo "Examples:"
echo " $0 /mnt/testfs 30 8"
echo " $0 /data/perf 60 16"
exit 1
fi
TEST_DIR="$1"
DURATION="$2"
READER_JOBS="$3"
# Validate inputs
if ! [[ $DURATION =~ ^[0-9]+$ ]]; then
echo "ERROR: duration must be an integer (seconds)"
exit 1
fi
if ! [[ $READER_JOBS =~ ^[0-9]+$ ]] || [ $READER_JOBS -lt 1 ]; then
echo "ERROR: reader_jobs must be a positive integer"
exit 1
fi
if [ ! -d "$TEST_DIR" ]; then
echo "ERROR: $TEST_DIR is not a valid directory"
exit 1
fi
# Check if directory is writable
if [ ! -w "$TEST_DIR" ]; then
echo "ERROR: $TEST_DIR is not writable"
exit 1
fi
# Configuration
USE_DIRECT=0 # Set to 0 to disable O_DIRECT (for filesystems that don't support it)
FORCE_MAX_JOBS=1 # Set to 1 to force testing all job counts up to MAX_JOBS (disable early break-out)
BLOCK_SIZE="1M"
IO_ENGINE="libaio"
IO_DEPTH=32
FILE_SIZE="10G"
START_JOBS=4
MAX_JOBS=32
TEST_DATE=$(date '+%Y%m%dT%H%M%S')
HOST=$(hostname -s)
LOG_DIR="./fio_logs_fs_${TEST_DATE}"
TEST_FILES_DIR="${TEST_DIR}/fio_test_${TEST_DATE}"
# Create log directory
mkdir -p "$LOG_DIR"
# Create test files directory
mkdir -p "$TEST_FILES_DIR"
# Main log file (detailed output)
MAIN_LOG="${LOG_DIR}/fs-test-${HOST}.log"
# Record start time
TEST_START_TIME=$(date +%s)
# Function to log to file and optionally to stderr
log() {
echo "$@" >> "$MAIN_LOG"
}
log_err() {
echo "$@" | tee -a "$MAIN_LOG" >&2
}
# Cleanup function
cleanup() {
log "Cleaning up test files..."
rm -rf "$TEST_FILES_DIR"
log "Cleanup complete"
}
# Register cleanup on exit
trap cleanup EXIT
# Function to parse fio output and extract bandwidth in MiB/s
parse_bandwidth() {
local output="$1"
local type="$2" # "WRITE" or "READ"
local perf_line=$(echo "$output" | grep -Eo "${type}: bw=[0-9.]+[KMGT]?i?B/s" | head -1)
if [[ "$perf_line" =~ bw=([0-9.]+)([KMGT]?i?B)/s ]]; then
local perf_val=${BASH_REMATCH[1]}
local unit=${BASH_REMATCH[2]}
case "$unit" in
KiB)
echo "scale=2; $perf_val / 1024" | bc
;;
MiB)
echo "$perf_val"
;;
GiB)
echo "scale=2; $perf_val * 1024" | bc
;;
TiB)
echo "scale=2; $perf_val * 1024 * 1024" | bc
;;
*)
echo "0"
;;
esac
else
echo "0"
fi
}
# Function to run fio sequential write test
run_write_test() {
local num_jobs="$1"
local output_file="${LOG_DIR}/write_${num_jobs}jobs.txt"
log "Running write test with $num_jobs jobs..."
# Generate file list
local file_list=""
for i in $(seq 1 "$num_jobs"); do
file_list="${file_list}:${TEST_FILES_DIR}/testfile_write_${i}.dat"
done
file_list="${file_list:1}" # Remove leading colon
fio --name=seqwrite \
--filename="$file_list" \
--rw=write \
--bs="$BLOCK_SIZE" \
--ioengine="$IO_ENGINE" \
--iodepth="$IO_DEPTH" \
--numjobs="$num_jobs" \
--runtime="$DURATION" \
--time_based \
--direct=$USE_DIRECT \
--size="$FILE_SIZE" \
--group_reporting \
>"$output_file" 2>&1
cat "$output_file" >> "$MAIN_LOG"
local bw=$(parse_bandwidth "$(cat "$output_file")" "WRITE")
echo "$bw"
}
# Function to run fio sequential read test
run_read_test() {
local num_jobs="$1"
local output_file="${LOG_DIR}/read_${num_jobs}jobs.txt"
log "Running read test with $num_jobs jobs..."
# Drop caches if O_DIRECT is disabled
if [ $USE_DIRECT -eq 0 ]; then
sync
echo 3 > /proc/sys/vm/drop_caches 2>/dev/null || true
log "Dropped caches (O_DIRECT disabled)"
fi
# Generate file list
local file_list=""
for i in $(seq 1 "$num_jobs"); do
file_list="${file_list}:${TEST_FILES_DIR}/testfile_read_${i}.dat"
done
file_list="${file_list:1}" # Remove leading colon
fio --name=seqread \
--filename="$file_list" \
--rw=read \
--bs="$BLOCK_SIZE" \
--ioengine="$IO_ENGINE" \
--iodepth="$IO_DEPTH" \
--numjobs="$num_jobs" \
--runtime="$DURATION" \
--time_based \
--direct=$USE_DIRECT \
--size="$FILE_SIZE" \
--group_reporting \
>"$output_file" 2>&1
cat "$output_file" >> "$MAIN_LOG"
local bw=$(parse_bandwidth "$(cat "$output_file")" "READ")
echo "$bw"
}
# Function to run full duplex test with per-job reader stats
run_fdx_test() {
local write_jobs="$1"
local read_jobs="$2"
local output_file="${LOG_DIR}/fdx_w${write_jobs}_r${read_jobs}.txt"
log "Running full duplex test with $write_jobs write jobs and $read_jobs read jobs (rate-limited to 400MB/s each)..."
# Drop caches if O_DIRECT is disabled
if [ $USE_DIRECT -eq 0 ]; then
sync
echo 3 > /proc/sys/vm/drop_caches 2>/dev/null || true
log "Dropped caches (O_DIRECT disabled)"
fi
# Generate write file list
local write_file_list=""
for i in $(seq 1 "$write_jobs"); do
write_file_list="${write_file_list}:${TEST_FILES_DIR}/testfile_fdx_write_${i}.dat"
done
write_file_list="${write_file_list:1}" # Remove leading colon
# Generate read file list
local read_file_list=""
for i in $(seq 1 "$read_jobs"); do
read_file_list="${read_file_list}:${TEST_FILES_DIR}/testfile_fdx_read_${i}.dat"
done
read_file_list="${read_file_list:1}" # Remove leading colon
# Run without group_reporting for readers to get per-job stats
fio --name=fdx_write \
--filename="$write_file_list" \
--rw=write \
--bs="$BLOCK_SIZE" \
--ioengine="$IO_ENGINE" \
--iodepth="$IO_DEPTH" \
--numjobs="$write_jobs" \
--runtime="$DURATION" \
--time_based \
--direct=$USE_DIRECT \
--size="$FILE_SIZE" \
--group_reporting \
--new_group \
--name=fdx_read \
--filename="$read_file_list" \
--rw=read \
--bs="$BLOCK_SIZE" \
--ioengine="$IO_ENGINE" \
--iodepth="$IO_DEPTH" \
--numjobs="$read_jobs" \
--runtime="$DURATION" \
--time_based \
--direct=$USE_DIRECT \
--size="$FILE_SIZE" \
--rate=400m \
>"$output_file" 2>&1
cat "$output_file" >> "$MAIN_LOG"
# Parse write bandwidth (grouped)
local write_bw=$(parse_bandwidth "$(cat "$output_file")" "WRITE")
# Parse individual read job bandwidths
local read_bws=()
local min_read_bw=999999
local total_read_bw=0
local job_num=0
# Extract per-job read bandwidth
# Strategy 1: Look for per-job lines in fdx_read section (format: " fdx_read.X.0")
while IFS= read -r line; do
if [[ "$line" =~ fdx_read\.[0-9]+\.[0-9]+.*read:.*bw=([0-9.]+)([KMGT]?i?B)/s ]]; then
local perf_val=${BASH_REMATCH[1]}
local unit=${BASH_REMATCH[2]}
local bw_mib=0
case "$unit" in
KiB)
bw_mib=$(echo "scale=2; $perf_val / 1024" | bc)
;;
MiB)
bw_mib=$perf_val
;;
GiB)
bw_mib=$(echo "scale=2; $perf_val * 1024" | bc)
;;
TiB)
bw_mib=$(echo "scale=2; $perf_val * 1024 * 1024" | bc)
;;
esac
read_bws+=("$bw_mib")
total_read_bw=$(echo "scale=2; $total_read_bw + $bw_mib" | bc)
if (( $(echo "$bw_mib < $min_read_bw" | bc -l) )); then
min_read_bw=$bw_mib
fi
job_num=$((job_num + 1))
fi
done < "$output_file"
# Strategy 2: If no per-job stats found, look for "read:" lines after fdx_read job header
if [ $job_num -eq 0 ]; then
local in_read_jobs=0
while IFS= read -r line; do
# Detect start of fdx_read jobs section
if [[ "$line" =~ ^fdx_read: ]]; then
in_read_jobs=1
continue
fi
# Stop at next major section (Run status, disk stats, etc)
if [ $in_read_jobs -eq 1 ] && [[ "$line" =~ ^(Run status|Disk stats): ]]; then
break
fi
# Capture individual read job stats
if [ $in_read_jobs -eq 1 ] && [[ "$line" =~ ^[[:space:]]+read:.*bw=([0-9.]+)([KMGT]?i?B)/s ]]; then
local perf_val=${BASH_REMATCH[1]}
local unit=${BASH_REMATCH[2]}
local bw_mib=0
case "$unit" in
KiB)
bw_mib=$(echo "scale=2; $perf_val / 1024" | bc)
;;
MiB)
bw_mib=$perf_val
;;
GiB)
bw_mib=$(echo "scale=2; $perf_val * 1024" | bc)
;;
TiB)
bw_mib=$(echo "scale=2; $perf_val * 1024 * 1024" | bc)
;;
esac
read_bws+=("$bw_mib")
total_read_bw=$(echo "scale=2; $total_read_bw + $bw_mib" | bc)
if (( $(echo "$bw_mib < $min_read_bw" | bc -l) )); then
min_read_bw=$bw_mib
fi
job_num=$((job_num + 1))
fi
done < "$output_file"
fi
# If we still didn't find enough per-job stats, use average as fallback
if [ $job_num -lt $read_jobs ]; then
log "WARNING: Only found $job_num per-job read stats, expected $read_jobs"
log "Using average as fallback"
total_read_bw=$(parse_bandwidth "$(cat "$output_file")" "READ")
local avg_read_bw=$(echo "scale=2; $total_read_bw / $read_jobs" | bc)
min_read_bw=$avg_read_bw
log "Fallback average: ${avg_read_bw} MiB/s per reader"
fi
local avg_read_bw=$(echo "scale=2; $total_read_bw / $read_jobs" | bc)
echo "${write_bw}:${total_read_bw}:${avg_read_bw}:${min_read_bw}"
}
# Main test execution
log "=========================================="
log "FILESYSTEM PERFORMANCE TEST"
log "=========================================="
log "Invocation: $0 $TEST_DIR $DURATION $READER_JOBS"
log "Test Directory: $TEST_DIR"
log "Test Files Directory: $TEST_FILES_DIR"
log "Test Date: $TEST_DATE"
log "Duration per test: ${DURATION}s"
log "O_DIRECT: $([ $USE_DIRECT -eq 1 ] && echo 'enabled' || echo 'disabled')"
log "Log Directory: $LOG_DIR"
log ""
echo "=========================================="
echo "FILESYSTEM PERFORMANCE TEST"
echo "=========================================="
echo "Test Directory: $TEST_DIR"
echo "Test Duration: ${DURATION}s per test"
echo "Test Date: $TEST_DATE"
echo ""
# Phase 1: Sequential Write Scale-Up
log ""
log "=========================================="
log "PHASE 1: Sequential Write Scale-Up"
log "=========================================="
log "Test Directory: $TEST_DIR"
log "Test Date: $TEST_DATE"
log "Duration per test: ${DURATION}s"
log ""
echo "Phase 1: Sequential Write Scale-Up"
echo "------------------------------------"
# Run baseline single job test first
echo "[Phase 1] Testing write baseline: jobs=1"
log "Running baseline single job write test..."
sync
single_write_perf=$(run_write_test 1)
log "Write jobs=1 (baseline): ${single_write_perf} MiB/s"
log ""
echo "[Phase 1] Baseline: $(printf "%.0f" "$single_write_perf") MiB/s"
max_write_perf=$single_write_perf
optimal_write_jobs=1
prev_write_perf=$single_write_perf
jobs=$START_JOBS
while [ $jobs -le $MAX_JOBS ]; do
echo "[Phase 1] Testing write: jobs=$jobs"
sync
write_bw=$(run_write_test "$jobs")
write_bw_int=$(printf "%.0f" "$write_bw")
log "Write jobs=$jobs: ${write_bw} MiB/s"
if (( $(echo "$write_bw > $max_write_perf" | bc -l) )); then
max_write_perf=$write_bw
optimal_write_jobs=$jobs
fi
# Stop if performance increase is not more than 1% from previous (unless FORCE_MAX_JOBS is set)
if [ $FORCE_MAX_JOBS -eq 0 ] && (( $(echo "$prev_write_perf > 0" | bc -l) )); then
increase=$(echo "scale=2; ($write_bw - $prev_write_perf) / $prev_write_perf * 100" | bc)
if (( $(echo "$increase <= 1" | bc -l) )); then
log "Performance increase only ${increase}% (not more than 1%), stopping scale-up"
break
fi
fi
prev_write_perf=$write_bw
jobs=$((jobs + 1))
done
log ""
log "Phase 1 Complete: Optimal write performance: ${max_write_perf} MiB/s with ${optimal_write_jobs} jobs"
echo "[Phase 1] Complete: Peak $(printf "%.0f" "$max_write_perf") MiB/s with $optimal_write_jobs jobs"
echo ""
# Phase 2: Sequential Read Scale-Up
log ""
log "=========================================="
log "PHASE 2: Sequential Read Scale-Up"
log "=========================================="
log ""
echo "Phase 2: Sequential Read Scale-Up"
echo "----------------------------------"
# Pre-create files for read tests
echo "[Phase 2] Preparing test files for read tests..."
log "Pre-creating test files for read tests..."
for i in $(seq 1 "$MAX_JOBS"); do
fio --name=prep \
--filename="${TEST_FILES_DIR}/testfile_read_${i}.dat" \
--rw=write \
--bs="$BLOCK_SIZE" \
--ioengine="$IO_ENGINE" \
--iodepth="$IO_DEPTH" \
--size="$FILE_SIZE" \
--direct=$USE_DIRECT \
>/dev/null 2>&1
done
log "Test files created"
sync
# Run baseline single job test first
echo "[Phase 2] Testing read baseline: jobs=1"
log "Running baseline single job read test..."
sync
single_read_perf=$(run_read_test 1)
log "Read jobs=1 (baseline): ${single_read_perf} MiB/s"
log ""
echo "[Phase 2] Baseline: $(printf "%.0f" "$single_read_perf") MiB/s"
max_read_perf=$single_read_perf
optimal_read_jobs=1
prev_read_perf=$single_read_perf
jobs=$START_JOBS
while [ $jobs -le $MAX_JOBS ]; do
echo "[Phase 2] Testing read: jobs=$jobs"
sync
read_bw=$(run_read_test "$jobs")
read_bw_int=$(printf "%.0f" "$read_bw")
log "Read jobs=$jobs: ${read_bw} MiB/s"
if (( $(echo "$read_bw > $max_read_perf" | bc -l) )); then
max_read_perf=$read_bw
optimal_read_jobs=$jobs
fi
# Stop if performance increase is not more than 1% from previous (unless FORCE_MAX_JOBS is set)
if [ $FORCE_MAX_JOBS -eq 0 ] && (( $(echo "$prev_read_perf > 0" | bc -l) )); then
increase=$(echo "scale=2; ($read_bw - $prev_read_perf) / $prev_read_perf * 100" | bc)
if (( $(echo "$increase <= 1" | bc -l) )); then
log "Performance increase only ${increase}% (not more than 1%), stopping scale-up"
break
fi
fi
prev_read_perf=$read_bw
jobs=$((jobs + 1))
done
log ""
log "Phase 2 Complete: Optimal read performance: ${max_read_perf} MiB/s with ${optimal_read_jobs} jobs"
echo "[Phase 2] Complete: Peak $(printf "%.0f" "$max_read_perf") MiB/s with $optimal_read_jobs jobs"
echo ""
# Phase 3: Full Duplex Test with Fixed Readers
log ""
log "=========================================="
log "PHASE 3: Full Duplex Test"
log "=========================================="
log "Fixed read jobs (rate-limited to 400 MB/s each, target min 365 MB/s per reader)"
log "Scaling write jobs to find maximum write throughput"
log ""
echo "Phase 3: Full Duplex Test"
echo "-------------------------"
echo "Strategy: Fixed readers at 400MB/s rate limit"
echo " Scale writers until max throughput or readers drop below 365MB/s"
echo ""
TARGET_MIN_READ=365
RATE_LIMIT=400
# Pre-create files for full duplex tests
echo "[Phase 3] Preparing test files for full duplex tests..."
log "Pre-creating test files for full duplex tests..."
# Create read files
for i in $(seq 1 32); do
fio --name=prep \
--filename="${TEST_FILES_DIR}/testfile_fdx_read_${i}.dat" \
--rw=write \
--bs="$BLOCK_SIZE" \
--ioengine="$IO_ENGINE" \
--iodepth="$IO_DEPTH" \
--size="$FILE_SIZE" \
--direct=$USE_DIRECT \
>/dev/null 2>&1
done
log "Full duplex test files created"
sync
# Use the reader count from command-line arguments
read_jobs=$READER_JOBS
max_writers=0
max_write_perf=0
max_total_read_perf=0
max_avg_read=0
max_min_read=0
log "Testing with ${read_jobs} fixed read jobs..."
echo "[Phase 3] Fixed readers: $read_jobs (rate-limited to ${RATE_LIMIT}MB/s each)"
echo "[Phase 3] Minimum acceptable read performance: ${TARGET_MIN_READ}MB/s per reader"
echo ""
# Scale up writers from 1 to 32
for write_jobs in $(seq 1 32); do
echo "[Phase 3] Testing FDX: writers=$write_jobs, readers=$read_jobs"
# Drop caches before test
sync
result=$(run_fdx_test "$write_jobs" "$read_jobs")
write_bw=$(echo "$result" | cut -d: -f1)
total_read_bw=$(echo "$result" | cut -d: -f2)
avg_read_bw=$(echo "$result" | cut -d: -f3)
min_read_bw=$(echo "$result" | cut -d: -f4)
log "Writers=$write_jobs: write=${write_bw} MiB/s, total_read=${total_read_bw} MiB/s, avg_read=${avg_read_bw} MiB/s, min_read=${min_read_bw} MiB/s"
# Check if minimum reader still meets threshold
if (( $(echo "$min_read_bw >= $TARGET_MIN_READ" | bc -l) )); then
max_writers=$write_jobs
max_write_perf=$write_bw
max_total_read_perf=$total_read_bw
max_avg_read=$avg_read_bw
max_min_read=$min_read_bw
echo " ✓ Writers=$write_jobs: write=$(printf "%.0f" "$write_bw") MiB/s, min_read=$(printf "%.0f" "$min_read_bw") MiB/s"
log "Valid config: $write_jobs writers maintain minimum read performance (min=${min_read_bw} MiB/s)"
else
echo " ✗ Writers=$write_jobs: min_read=$(printf "%.0f" "$min_read_bw") MiB/s (below ${TARGET_MIN_READ} MiB/s threshold)"
log "Writers=$write_jobs caused read performance to drop below ${TARGET_MIN_READ} MiB/s (min=${min_read_bw} MiB/s), stopping"
break
fi
done
log ""
log "Phase 3 Complete"
echo ""
echo "[Phase 3] Complete"
echo ""
# Calculate total test time
TEST_END_TIME=$(date +%s)
TOTAL_TEST_TIME=$((TEST_END_TIME - TEST_START_TIME))
TEST_HOURS=$((TOTAL_TEST_TIME / 3600))
TEST_MINUTES=$(((TOTAL_TEST_TIME % 3600) / 60))
TEST_SECONDS=$((TOTAL_TEST_TIME % 60))
# Final results summary
log ""
log "=========================================="
log "FINAL RESULTS SUMMARY"
log "=========================================="
log "Invocation: $0 $TEST_DIR $DURATION $READER_JOBS"
log "Test Directory: $TEST_DIR"
log "Test Duration: ${DURATION}s per test"
log "Test Date: $TEST_DATE"
log "Total Test Time: ${TEST_HOURS}h ${TEST_MINUTES}m ${TEST_SECONDS}s"
log ""
log "Phase 1 - Sequential Write Scale-Up:"
log " Single Job Performance: $(printf "%.0f" "$single_write_perf") MiB/s"
log " Peak Performance: $(printf "%.0f" "$max_write_perf") MiB/s"
log " Optimal Jobs: $optimal_write_jobs"
log ""
log "Phase 2 - Sequential Read Scale-Up:"
log " Single Job Performance: $(printf "%.0f" "$single_read_perf") MiB/s"
log " Peak Performance: $(printf "%.0f" "$max_read_perf") MiB/s"
log " Optimal Jobs: $optimal_read_jobs"
log ""
log "Phase 3 - Full Duplex (Write + Rate-Limited Read):"
if [ $max_writers -gt 0 ]; then
log " Fixed Read Jobs: $read_jobs (rate-limited to ${RATE_LIMIT} MB/s each)"
log " Maximum Write Jobs: $max_writers"
log " Write Performance: $(printf "%.0f" "$max_write_perf") MiB/s"
log " Total Read Performance: $(printf "%.0f" "$max_total_read_perf") MiB/s"
log " Average Read per Job: $(printf "%.0f" "$max_avg_read") MiB/s"
log " Minimum Read per Job: $(printf "%.0f" "$max_min_read") MiB/s"
log " Status: All readers maintain minimum threshold (${TARGET_MIN_READ} MiB/s)"
else
log " No configuration found - even 1 writer causes read performance degradation"
fi
log "=========================================="
log ""
# Output final results to stdout
echo "=========================================="
echo "FILESYSTEM PERFORMANCE TEST RESULTS"
echo "=========================================="
echo "Test Directory: $TEST_DIR"
echo "Test Duration: ${DURATION}s per test"
echo "Test Date: $TEST_DATE"
echo "Total Test Time: ${TEST_HOURS}h ${TEST_MINUTES}m ${TEST_SECONDS}s"
echo ""
echo "Phase 1 - Sequential Write Scale-Up:"
echo " Single Job Performance: $(printf "%.0f" "$single_write_perf") MiB/s"
echo " Peak Performance: $(printf "%.0f" "$max_write_perf") MiB/s"
echo " Optimal Jobs: $optimal_write_jobs"
echo ""
echo "Phase 2 - Sequential Read Scale-Up:"
echo " Single Job Performance: $(printf "%.0f" "$single_read_perf") MiB/s"
echo " Peak Performance: $(printf "%.0f" "$max_read_perf") MiB/s"
echo " Optimal Jobs: $optimal_read_jobs"
echo ""
echo "Phase 3 - Full Duplex (Write + Rate-Limited Read):"
if [ $max_writers -gt 0 ]; then
echo " Configuration:"
echo " Fixed Read Jobs: $read_jobs (rate-limited to ${RATE_LIMIT} MB/s each)"
echo " Maximum Write Jobs: $max_writers"
echo ""
echo " Results:"
echo " Write Performance: $(printf "%.0f" "$max_write_perf") MiB/s"
echo " Total Read Performance: $(printf "%.0f" "$max_total_read_perf") MiB/s"
echo " Average Read per Job: $(printf "%.0f" "$max_avg_read") MiB/s"
echo " Minimum Read per Job: $(printf "%.0f" "$max_min_read") MiB/s"
echo ""
echo " Status: ✓ All readers maintain minimum threshold (${TARGET_MIN_READ} MiB/s)"
else
echo " Status: ✗ No configuration found - even 1 writer causes read performance degradation"
fi
echo ""
echo "Detailed logs: $LOG_DIR"
echo "Main log: $MAIN_LOG"
echo "=========================================="