-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-nlb-quick.sh
More file actions
executable file
·109 lines (87 loc) · 3.07 KB
/
test-nlb-quick.sh
File metadata and controls
executable file
·109 lines (87 loc) · 3.07 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
#!/bin/bash
# Quick AWS NLB Load Test (30 seconds, 5 threads)
# For rapid testing of load balancer behavior
set -e
LOAD_BALANCER_HOST="FlightServer-NLB-cac72f6dd42cf041.elb.us-east-1.amazonaws.com"
TEST_DURATION=30 # 30 seconds
THREADS=5
RESULTS_DIR="nlb-quick-test-$(date +%Y%m%d-%H%M%S)"
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}🚀 Quick AWS NLB Load Test${NC}"
echo "=========================="
echo ""
echo "Configuration:"
echo " Load Balancer: $LOAD_BALANCER_HOST"
echo " Duration: $TEST_DURATION seconds"
echo " Threads: $THREADS"
echo ""
mkdir -p "$RESULTS_DIR"
# Function to run a client thread
run_quick_client() {
local thread_id=$1
local log_file="$RESULTS_DIR/thread-${thread_id}.log"
echo "Thread $thread_id starting..." >> "$log_file"
local start_time=$(date +%s)
local end_time=$((start_time + TEST_DURATION))
local count=0
local success=0
while [ $(date +%s) -lt $end_time ]; do
if java --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED \
-cp "target/classes:$(mvn dependency:build-classpath -Dmdep.outputFile=/dev/stdout -q)" \
org.example.AWSFlightClient "$LOAD_BALANCER_HOST" \
>> "$log_file" 2>&1; then
success=$((success + 1))
fi
count=$((count + 1))
sleep 0.5 # Brief pause between requests
done
echo "Thread $thread_id completed: $success/$count successful" >> "$log_file"
echo "$thread_id,$count,$success" >> "$RESULTS_DIR/results.csv"
}
echo -e "${YELLOW}Starting $THREADS threads for $TEST_DURATION seconds...${NC}"
# Initialize results file
echo "thread_id,total_requests,successful_requests" > "$RESULTS_DIR/results.csv"
# Start threads
for ((i=1; i<=THREADS; i++)); do
echo "Starting thread $i..."
run_quick_client $i &
done
# Show countdown
for ((sec=TEST_DURATION; sec>0; sec--)); do
echo -ne "\r⏰ Time remaining: ${sec}s "
sleep 1
done
echo ""
echo -e "${YELLOW}Waiting for threads to complete...${NC}"
wait
# Generate quick summary
echo ""
echo -e "${GREEN}📊 Quick Results:${NC}"
echo "=================="
total_requests=0
total_success=0
while IFS=, read -r thread_id requests success; do
if [ "$thread_id" != "thread_id" ]; then # Skip header
total_requests=$((total_requests + requests))
total_success=$((total_success + success))
echo " Thread $thread_id: $success/$requests successful"
fi
done < "$RESULTS_DIR/results.csv"
success_rate=0
if [ $total_requests -gt 0 ]; then
success_rate=$(echo "scale=1; $total_success * 100 / $total_requests" | bc -l)
fi
echo ""
echo " Total: $total_success/$total_requests successful (${success_rate}%)"
echo " Rate: $(echo "scale=1; $total_requests / $TEST_DURATION" | bc -l) requests/sec"
echo ""
echo -e "${BLUE}📁 Detailed logs in: $RESULTS_DIR/${NC}"
if (( $(echo "$success_rate >= 90" | bc -l) )); then
echo -e "${GREEN}✅ NLB performing well under concurrent load${NC}"
else
echo -e "${YELLOW}⚠️ Some performance degradation detected${NC}"
fi