- Archive: 85 agent .txt files → docs/archive/agents/legacy_txt/ - Scripts: Move 110 shell scripts → scripts/ (keep deploy.sh in root) - Models: Move 18 .safetensors → ml/models/checkpoints/training_artifacts/ - Delete: 34 directories (~33GB freed) - target/, coverage_*, test artifacts - Build: Clean 14 build artifacts (.rlib, .o, .pid, binaries) - Tests: Move 14 .rs files → tests/standalone/ - SQL: Move 5 files → sql/ (keep init-db*.sql for Docker) - Wave 153: Archive to docs/archive/historical/wave153/ - Docs: Archive 9 markdown files to wave_d/reports/ and historical/ Total impact: ~34GB freed (both waves), root directory cleaned from 583 to ~40 essential files Directory count reduced from 65 to 31 (52% reduction) All historical data preserved in organized archive structure
153 lines
4.6 KiB
Bash
Executable File
153 lines
4.6 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# gRPC Load Test using ghz (Go-based gRPC benchmarking tool)
|
|
#
|
|
# Install ghz: https://github.com/bojand/ghz
|
|
# MacOS: brew install ghz
|
|
# Linux: Download from releases
|
|
|
|
set -e
|
|
|
|
echo "======================================================================="
|
|
echo " FOXHUNT TRADING SERVICE - gRPC LOAD TEST (ghz)"
|
|
echo "======================================================================="
|
|
echo ""
|
|
|
|
# Check if ghz is installed
|
|
if ! command -v ghz &> /dev/null; then
|
|
echo "❌ ghz is not installed"
|
|
echo ""
|
|
echo "Install with:"
|
|
echo " Ubuntu/Debian: wget https://github.com/bojand/ghz/releases/download/v0.117.0/ghz-linux-x86_64.tar.gz && tar -xzf ghz-linux-x86_64.tar.gz && sudo mv ghz /usr/local/bin/"
|
|
echo " MacOS: brew install ghz"
|
|
echo " Arch: yay -S ghz"
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|
|
# Check if grpcurl is available (for service inspection)
|
|
if command -v grpcurl &> /dev/null; then
|
|
echo "✅ grpcurl available for service inspection"
|
|
else
|
|
echo "⚠️ grpcurl not available (optional)"
|
|
fi
|
|
|
|
# Configuration
|
|
GRPC_HOST="localhost:50052"
|
|
PROTO_PATH="tli/proto/trading.proto"
|
|
SERVICE="foxhunt.tli.TradingService"
|
|
METHOD="SubmitOrder"
|
|
|
|
echo "Configuration:"
|
|
echo " gRPC Host: $GRPC_HOST"
|
|
echo " Proto: $PROTO_PATH"
|
|
echo " Service: $SERVICE"
|
|
echo " Method: $METHOD"
|
|
echo ""
|
|
|
|
# Test 1: Baseline (low load)
|
|
echo "======================================================================="
|
|
echo " TEST 1: BASELINE (1,000 requests, 10 RPS)"
|
|
echo "======================================================================="
|
|
ghz --proto "$PROTO_PATH" \
|
|
--import-paths="." \
|
|
--call "$SERVICE/$METHOD" \
|
|
--insecure \
|
|
--total 1000 \
|
|
--concurrency 10 \
|
|
--rps 10 \
|
|
--data '{
|
|
"symbol": "BTC/USD",
|
|
"side": "BUY",
|
|
"order_type": "LIMIT",
|
|
"quantity": 1.0,
|
|
"price": 50000.0,
|
|
"time_in_force": "GTC",
|
|
"client_order_id": "test-{{.RequestNumber}}"
|
|
}' \
|
|
"$GRPC_HOST" || echo "⚠️ Test 1 failed or partially completed"
|
|
|
|
echo ""
|
|
|
|
# Test 2: Medium load
|
|
echo "======================================================================="
|
|
echo " TEST 2: MEDIUM LOAD (5,000 requests, 500 RPS, 50 concurrent)"
|
|
echo "======================================================================="
|
|
ghz --proto "$PROTO_PATH" \
|
|
--import-paths="." \
|
|
--call "$SERVICE/$METHOD" \
|
|
--insecure \
|
|
--total 5000 \
|
|
--concurrency 50 \
|
|
--rps 500 \
|
|
--data '{
|
|
"symbol": "ETH/USD",
|
|
"side": "SELL",
|
|
"order_type": "LIMIT",
|
|
"quantity": 10.0,
|
|
"price": 3000.0,
|
|
"time_in_force": "GTC",
|
|
"client_order_id": "test-{{.RequestNumber}}"
|
|
}' \
|
|
"$GRPC_HOST" || echo "⚠️ Test 2 failed or partially completed"
|
|
|
|
echo ""
|
|
|
|
# Test 3: High load (target: 10K orders/sec)
|
|
echo "======================================================================="
|
|
echo " TEST 3: HIGH LOAD (10,000 requests, 10K RPS, 100 concurrent)"
|
|
echo "======================================================================="
|
|
ghz --proto "$PROTO_PATH" \
|
|
--import-paths="." \
|
|
--call "$SERVICE/$METHOD" \
|
|
--insecure \
|
|
--total 10000 \
|
|
--concurrency 100 \
|
|
--rps 10000 \
|
|
--data '{
|
|
"symbol": "SOL/USD",
|
|
"side": "BUY",
|
|
"order_type": "MARKET",
|
|
"quantity": 100.0,
|
|
"time_in_force": "IOC",
|
|
"client_order_id": "test-{{.RequestNumber}}"
|
|
}' \
|
|
"$GRPC_HOST" || echo "⚠️ Test 3 failed or partially completed"
|
|
|
|
echo ""
|
|
|
|
# Test 4: Sustained load (5 minutes at 1K RPS)
|
|
echo "======================================================================="
|
|
echo " TEST 4: SUSTAINED LOAD (5 minutes, 1K RPS)"
|
|
echo "======================================================================="
|
|
echo "Running sustained load for 5 minutes (300,000 total requests)..."
|
|
ghz --proto "$PROTO_PATH" \
|
|
--import-paths="." \
|
|
--call "$SERVICE/$METHOD" \
|
|
--insecure \
|
|
--duration 300s \
|
|
--concurrency 100 \
|
|
--rps 1000 \
|
|
--data '{
|
|
"symbol": "AVAX/USD",
|
|
"side": "{{randomString (\"BUY\" \"SELL\")}}",
|
|
"order_type": "LIMIT",
|
|
"quantity": {{randomInt 1 100}},
|
|
"price": {{randomInt 10 100}},
|
|
"time_in_force": "GTC",
|
|
"client_order_id": "sustained-{{.RequestNumber}}"
|
|
}' \
|
|
"$GRPC_HOST" || echo "⚠️ Test 4 failed or partially completed"
|
|
|
|
echo ""
|
|
echo "======================================================================="
|
|
echo " LOAD TEST COMPLETE"
|
|
echo "======================================================================="
|
|
echo ""
|
|
echo "Check Prometheus metrics:"
|
|
echo " http://localhost:9092/metrics"
|
|
echo ""
|
|
echo "Check Grafana dashboards:"
|
|
echo " http://localhost:3000"
|
|
echo ""
|