核心功能: - ✅ Categories/Series双视图管理(category_view.rs + import_markdown.rs) - ✅ FUSE Multi-Volume支持(tree_type参数) - ✅ SSH/SFTP/SCP/rsync协议完整实现(4042行) - ✅ NFS/SMB Module Phase 1-3完成 - ✅ Archive Module Phase 1-4完成(2916行) - ✅ Download Center API完整实现 - ✅ S3兼容API实现(560行) Git配置修正: - ✅ 删除错误origin(gitea.momentry.ddns.net) - ✅ 删除m5max128(指向机器名) - ✅ 设置origin = m5max128gitea.momentry.ddns.net/admin/markbase - ✅ 设置m4minigitea = m4minigitea.momentry.ddns.net/warren/markbase 数据清理: - ✅ 删除38个临时SQLite(保留accusys.sqlite、demo.sqlite) - ✅ 删除.bak、test_*.bin、调试脚本等临时文件 - ✅ 删除临时目录(build/、download files/、raid_test/等) - ✅ 更新.gitignore排除临时文件 架构优化: - 52个文件修改,2434行新增,4739行删除 - Workspace成员整合(16个crate) - 数据库状态:accusys.sqlite保留(主demo测试) 远程同步: - ✅ 准备推送到m5max128gitea(远程Gitea) - ✅ 准备推送到m4minigitea(本地Gitea)
164 lines
4.5 KiB
Bash
Executable File
164 lines
4.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# MarkBase Archive Module Performance Test Script
|
|
|
|
echo "========================================="
|
|
echo "MarkBase Archive Performance Test Suite"
|
|
echo "========================================="
|
|
|
|
# Configuration
|
|
SERVER_URL="http://localhost:11438"
|
|
UPLOAD_ENDPOINT="/api/v2/upload"
|
|
USER_ID="perf_test"
|
|
TEST_DIR="/tmp/markbase_perf_test"
|
|
LOG_FILE="/tmp/markbase_perf_results.log"
|
|
|
|
# Create test directory
|
|
mkdir -p $TEST_DIR
|
|
|
|
# Function to generate test ZIP files
|
|
generate_test_zip() {
|
|
size=$1
|
|
name=$2
|
|
|
|
echo "Generating $size MB test ZIP file..."
|
|
|
|
# Create temp directory with files
|
|
temp_dir=$(mktemp -d)
|
|
for i in {1..10}; do
|
|
dd if=/dev/urandom of="$temp_dir/file_$i.txt" bs=1M count=$((size / 10)) 2>/dev/null
|
|
done
|
|
|
|
# Create ZIP
|
|
cd $temp_dir
|
|
zip -r "$TEST_DIR/$name" . >/dev/null 2>&1
|
|
cd -
|
|
rm -rf $temp_dir
|
|
|
|
echo "Generated $TEST_DIR/$name ($(du -h $TEST_DIR/$name | cut -f1))"
|
|
}
|
|
|
|
# Function to test upload performance
|
|
test_upload() {
|
|
file=$1
|
|
description=$2
|
|
|
|
echo ""
|
|
echo "Testing: $description"
|
|
echo "File: $file"
|
|
|
|
# Measure upload time
|
|
start_time=$(date +%s%N)
|
|
|
|
response=$(curl -s -w "\n%{http_code}\n%{time_total}" \
|
|
-X POST "$SERVER_URL$UPLOAD_ENDPOINT/$USER_ID" \
|
|
-F "file=@$file")
|
|
|
|
end_time=$(date +%s%N)
|
|
|
|
# Parse response
|
|
http_code=$(echo "$response" | tail -n 2 | head -n 1)
|
|
time_total=$(echo "$response" | tail -n 1)
|
|
json_response=$(echo "$response" | head -n -2)
|
|
|
|
# Calculate duration in milliseconds
|
|
duration_ms=$(( (end_time - start_time) / 1000000 ))
|
|
|
|
# Log results
|
|
echo "HTTP Code: $http_code"
|
|
echo "Upload Time: ${time_total}s"
|
|
echo "Duration: ${duration_ms}ms"
|
|
|
|
if [ "$http_code" == "201" ]; then
|
|
echo "✅ Upload successful"
|
|
|
|
# Check if extracted field exists
|
|
if echo "$json_response" | jq -e '.extracted' >/dev/null 2>&1; then
|
|
extracted_count=$(echo "$json_response" | jq -r '.extracted.count')
|
|
extracted_bytes=$(echo "$json_response" | jq -r '.extracted.bytes')
|
|
echo "✅ Extracted: $extracted_count files, $extracted_bytes bytes"
|
|
|
|
echo "SUCCESS|$description|$http_code|${time_total}s|${duration_ms}ms|$extracted_count|$extracted_bytes" >> $LOG_FILE
|
|
else
|
|
echo "⚠️ No extracted field in response"
|
|
echo "PARTIAL|$description|$http_code|${time_total}s|${duration_ms}ms" >> $LOG_FILE
|
|
fi
|
|
else
|
|
echo "❌ Upload failed"
|
|
echo "FAILED|$description|$http_code|${time_total}s|${duration_ms}ms" >> $LOG_FILE
|
|
fi
|
|
}
|
|
|
|
# Function to test concurrent uploads
|
|
test_concurrent() {
|
|
count=$1
|
|
|
|
echo ""
|
|
echo "Testing concurrent uploads: $count simultaneous"
|
|
|
|
# Generate small test files
|
|
for i in {1..$count}; do
|
|
temp_dir=$(mktemp -d)
|
|
echo "file $i content" > "$temp_dir/test_$i.txt"
|
|
cd $temp_dir
|
|
zip -r "$TEST_DIR/concurrent_$i.zip" test_$i.txt >/dev/null 2>&1
|
|
cd -
|
|
rm -rf $temp_dir
|
|
done
|
|
|
|
# Run concurrent uploads
|
|
start_time=$(date +%s%N)
|
|
|
|
for i in {1..$count}; do
|
|
curl -s -X POST "$SERVER_URL$UPLOAD_ENDPOINT/concurrent_test" \
|
|
-F "file=@$TEST_DIR/concurrent_$i.zip" &
|
|
done
|
|
|
|
# Wait for all to complete
|
|
wait
|
|
|
|
end_time=$(date +%s%N)
|
|
duration_ms=$(( (end_time - start_time) / 1000000 ))
|
|
|
|
echo "Total time for $count concurrent uploads: ${duration_ms}ms"
|
|
echo "CONCURRENT|$count uploads|${duration_ms}ms" >> $LOG_FILE
|
|
|
|
# Cleanup
|
|
rm -f $TEST_DIR/concurrent_*.zip
|
|
}
|
|
|
|
# Main test execution
|
|
echo ""
|
|
echo "Starting performance tests..."
|
|
echo "Log file: $LOG_FILE"
|
|
echo ""
|
|
|
|
# Test 1: Small file (10MB)
|
|
generate_test_zip 10 "test_10mb.zip"
|
|
test_upload "$TEST_DIR/test_10mb.zip" "10MB ZIP file"
|
|
|
|
# Test 2: Medium file (100MB)
|
|
generate_test_zip 100 "test_100mb.zip"
|
|
test_upload "$TEST_DIR/test_100mb.zip" "100MB ZIP file"
|
|
|
|
# Test 3: Large file (1GB) - Optional, comment out if needed
|
|
# generate_test_zip 1000 "test_1gb.zip"
|
|
# test_upload "$TEST_DIR/test_1gb.zip" "1GB ZIP file"
|
|
|
|
# Test 4: Concurrent uploads (10)
|
|
test_concurrent 10
|
|
|
|
# Test 5: Concurrent uploads (50)
|
|
test_concurrent 50
|
|
|
|
echo ""
|
|
echo "========================================="
|
|
echo "Performance tests completed"
|
|
echo "Results saved to: $LOG_FILE"
|
|
echo "========================================="
|
|
echo ""
|
|
echo "Summary:"
|
|
cat $LOG_FILE
|
|
|
|
# Cleanup
|
|
rm -rf $TEST_DIR |