mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 16:28:15 +00:00
27468ebfa9
* feat(get): consolidate GET performance optimization Consolidated implementation of all GET performance optimizations into a single, well-organized commit replacing the previous patch-on-patch approach. ## Changes ### Configuration (set_disk/mod.rs) - Consolidated all GET optimization flags into a single organized section - Enabled by default: codec streaming, metadata early-stop, page cache reclaim - Added codec streaming multipart flag (default: disabled) - Added version-aware early-stop flag (default: disabled) - Added adaptive duplex buffer sizing based on object size - All flags use OnceLock caching with rollout percentage support ### Metadata Early-Stop (set_disk/read.rs) - Delete marker early-stop when quorum agrees - Version-aware early-stop for versioned GET requests - MetadataQuorumAccumulator enhanced with: - delete_marker_votes tracking - requested_version_id and matching_version_votes tracking - version_early_stop_decision() method - 6 new tests for version early-stop scenarios ### Codec Streaming (erasure/coding/decode_reader.rs) - DualInFlight (2-stripe lookahead) enabled by default ### Decode Pipeline (erasure/coding/decode.rs) - Stripe prefetch count configuration - Bitrot-decode overlap configuration ### Disk Layer (disk/local.rs) - O_DIRECT read configuration constants (preparation) ### Metrics (io-metrics/lib.rs) - BytesPool acquisition/return metrics - Metadata phase duration with early-stop label - Total duration with reader_path label ### Diagnostics (diagnostics/) - Early-stop reason constants - Pool tier/outcome label constants ### Observability (.docker/observability/) - 3 Grafana dashboards for GET optimization monitoring - Prometheus alert rules (6 alerts: 3 critical, 3 warning) - Updated README.md and README_ZH.md with usage docs ### Config (config/src/constants/runtime.rs) - Page cache reclaim read enabled by default ## Environment Variables | Variable | Default | Description | |----------|---------|-------------| | RUSTFS_GET_CODEC_STREAMING_ENABLE | true | Codec streaming base flag | | RUSTFS_GET_CODEC_STREAMING_ROLLOUT_PCT | 100 | Codec streaming rollout % | | RUSTFS_GET_CODEC_STREAMING_MULTIPART_ENABLE | false | Multipart codec streaming | | RUSTFS_GET_METADATA_EARLY_STOP_ENABLE | true | Early-stop base flag | | RUSTFS_GET_METADATA_EARLY_STOP_ROLLOUT_PCT | 100 | Early-stop rollout % | | RUSTFS_GET_METADATA_VERSION_EARLY_STOP_ENABLE | false | Version-aware early-stop | | RUSTFS_OBJECT_FILE_CACHE_RECLAIM_READ_ENABLE | true | Page cache reclaim | | RUSTFS_OBJECT_DIRECT_IO_READ_ENABLE | false | O_DIRECT (preparation) | | RUSTFS_GET_DECODE_STRIPE_PREFETCH_COUNT | 1 | Stripe prefetch | | RUSTFS_GET_BITROT_DECODE_OVERLAP_ENABLE | false | Bitrot-decode overlap | | RUSTFS_GET_CODEC_STREAMING_MAX_INFLIGHT | 2 | DualInFlight stripes | ## Rollback All optimizations can be disabled via environment variables: RUSTFS_GET_CODEC_STREAMING_ENABLE=false RUSTFS_GET_METADATA_EARLY_STOP_ENABLE=false RUSTFS_OBJECT_FILE_CACHE_RECLAIM_READ_ENABLE=false Co-Authored-By: heihutu <heihutu@gmail.com> * test(get): add stress test scripts for GET optimization validation - quick-validate-get-optimization.sh: Quick 5-minute validation - stress-test-get-optimization.sh: Full 30+ minute stress test - README-stress-test.md: Usage documentation Co-Authored-By: heihutu <heihutu@gmail.com> * test(ecstore): align file cache reclaim defaults * chore(deps): update redis and erasure codec * test(ecstore): align decode fill policy default * test(ecstore): align metadata early-stop default * fix(ecstore): keep metadata early stop opt-in --------- Co-authored-by: heihutu <heihutu@gmail.com>
123 lines
4.2 KiB
Bash
Executable File
123 lines
4.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Quick Validation Script for GET Optimization
|
|
# Usage: ./scripts/quick-validate-get-optimization.sh [TARGET_HOST]
|
|
#
|
|
# Runs quick functional tests to validate GET optimization changes:
|
|
# 1. Basic GET correctness
|
|
# 2. Concurrent GET stability
|
|
# 3. Early-stop behavior
|
|
|
|
set -euo pipefail
|
|
|
|
TARGET_HOST="${1:-localhost:9000}"
|
|
MC_ALIAS="${MC_ALIAS:-rustfs}"
|
|
TEST_BUCKET="quick-validate-$(date +%s)"
|
|
|
|
echo "=========================================="
|
|
echo "Quick GET Optimization Validation"
|
|
echo "=========================================="
|
|
echo "Target: $TARGET_HOST"
|
|
echo ""
|
|
|
|
# Create test bucket
|
|
mc mb "${MC_ALIAS}/${TEST_BUCKET}" 2>/dev/null || true
|
|
|
|
# ============================================================================
|
|
# Test 1: Basic GET Correctness
|
|
# ============================================================================
|
|
echo "[1/3] Basic GET Correctness"
|
|
|
|
# Upload test file
|
|
dd if=/dev/urandom of=/tmp/quick-test.bin bs=1048576 count=1 2>/dev/null
|
|
original_hash=$(md5 -q /tmp/quick-test.bin 2>/dev/null || md5sum /tmp/quick-test.bin | awk '{print $1}')
|
|
|
|
mc cp /tmp/quick-test.bin "${MC_ALIAS}/${TEST_BUCKET}/test.bin" >/dev/null 2>&1
|
|
|
|
# Download and verify
|
|
mc cp "${MC_ALIAS}/${TEST_BUCKET}/test.bin" /tmp/quick-test-download.bin >/dev/null 2>&1
|
|
download_hash=$(md5 -q /tmp/quick-test-download.bin 2>/dev/null || md5sum /tmp/quick-test-download.bin | awk '{print $1}')
|
|
|
|
if [ "$original_hash" = "$download_hash" ]; then
|
|
echo " PASS: Data integrity verified"
|
|
else
|
|
echo " FAIL: Data mismatch (original=$original_hash, download=$download_hash)"
|
|
fi
|
|
|
|
rm -f /tmp/quick-test.bin /tmp/quick-test-download.bin
|
|
|
|
# ============================================================================
|
|
# Test 2: Concurrent GET Stability
|
|
# ============================================================================
|
|
echo "[2/3] Concurrent GET Stability"
|
|
|
|
# Upload multiple test files
|
|
for i in $(seq 1 10); do
|
|
dd if=/dev/urandom of="/tmp/quick-test-${i}.bin" bs=1048576 count=1 2>/dev/null
|
|
mc cp "/tmp/quick-test-${i}.bin" "${MC_ALIAS}/${TEST_BUCKET}/test-${i}.bin" >/dev/null 2>&1
|
|
rm -f "/tmp/quick-test-${i}.bin"
|
|
done
|
|
|
|
# Concurrent download
|
|
passed=0
|
|
failed=0
|
|
|
|
for i in $(seq 1 10); do
|
|
if mc cp "${MC_ALIAS}/${TEST_BUCKET}/test-${i}.bin" "/tmp/quick-download-${i}.bin" >/dev/null 2>&1; then
|
|
size=$(stat -f%z "/tmp/quick-download-${i}.bin" 2>/dev/null || stat -c%s "/tmp/quick-download-${i}.bin" 2>/dev/null)
|
|
if [ "$size" = "1048576" ]; then
|
|
passed=$((passed + 1))
|
|
else
|
|
failed=$((failed + 1))
|
|
fi
|
|
else
|
|
failed=$((failed + 1))
|
|
fi
|
|
rm -f "/tmp/quick-download-${i}.bin"
|
|
done
|
|
|
|
echo " Result: $passed passed, $failed failed"
|
|
|
|
# ============================================================================
|
|
# Test 3: Early-Stop Behavior
|
|
# ============================================================================
|
|
echo "[3/3] Early-Stop Behavior"
|
|
|
|
# Upload a larger test file
|
|
dd if=/dev/urandom of=/tmp/quick-test-large.bin bs=1048576 count=10 2>/dev/null
|
|
mc cp /tmp/quick-test-large.bin "${MC_ALIAS}/${TEST_BUCKET}/test-large.bin" >/dev/null 2>&1
|
|
|
|
# Multiple reads to trigger early-stop
|
|
passed=0
|
|
failed=0
|
|
|
|
for i in $(seq 1 20); do
|
|
if mc cp "${MC_ALIAS}/${TEST_BUCKET}/test-large.bin" "/tmp/quick-large-${i}.bin" >/dev/null 2>&1; then
|
|
size=$(stat -f%z "/tmp/quick-large-${i}.bin" 2>/dev/null || stat -c%s "/tmp/quick-large-${i}.bin" 2>/dev/null)
|
|
if [ "$size" = "10485760" ]; then
|
|
passed=$((passed + 1))
|
|
else
|
|
failed=$((failed + 1))
|
|
fi
|
|
else
|
|
failed=$((failed + 1))
|
|
fi
|
|
rm -f "/tmp/quick-large-${i}.bin"
|
|
done
|
|
|
|
echo " Result: $passed passed, $failed failed"
|
|
|
|
rm -f /tmp/quick-test-large.bin
|
|
|
|
# ============================================================================
|
|
# Cleanup
|
|
# ============================================================================
|
|
echo ""
|
|
echo "Cleaning up..."
|
|
mc rm --recursive --force "${MC_ALIAS}/${TEST_BUCKET}" >/dev/null 2>&1 || true
|
|
mc rb "${MC_ALIAS}/${TEST_BUCKET}" >/dev/null 2>&1 || true
|
|
|
|
echo ""
|
|
echo "=========================================="
|
|
echo "Quick Validation Complete"
|
|
echo "=========================================="
|