-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjit-benchmark.sh
More file actions
executable file
Β·122 lines (109 loc) Β· 5.22 KB
/
Copy pathjit-benchmark.sh
File metadata and controls
executable file
Β·122 lines (109 loc) Β· 5.22 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
#!/bin/bash
# ================================================
# π± Sprout JIT Profiling with Gatling
# -----------------------------------------------
# 1. IntelliJμμ μλ² μ€ν (JFR + JIT λ‘κ·Έ)
# 2. Gatling λΆν ν
μ€νΈ μ€ν
# 3. κ²°κ³Ό λΆμ: JFR, Hotspot λ‘κ·Έ, Gatling 리ν¬νΈ
# ================================================
OUTPUT_DIR="./jit-profile"
PORT=8080
# ================================================
# μ€λΉ
# ================================================
mkdir -p "$OUTPUT_DIR"
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo " π± Sprout JIT Profiling with Gatling"
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo ""
# ================================================
# μλ² κ΅¬λ νμΈ
# ================================================
echo "[1/3] Checking if Sprout server is running..."
if ! curl -s "http://localhost:$PORT/benchmark/hello" > /dev/null 2>&1; then
echo ""
echo "Server is NOT running on port $PORT"
echo ""
echo "Start the server from IntelliJ with these VM options:"
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
cat << 'VMEOF'
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
--add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
-XX:StartFlightRecording=filename=jit-profile/recording.jfr,duration=300s,settings=profile
-XX:+UnlockDiagnosticVMOptions
-XX:+LogCompilation
-XX:LogFile=jit-profile/hotspot_%p.log
-XX:+PrintInlining
-XX:+PrintCompilation
-XX:+PrintCodeCache
-XX:+PrintAssembly
-XX:PrintAssemblyOptions=intel
-XX:CompileCommand=print,*benchmark*
-XX:+DebugNonSafepoints
VMEOF
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo ""
echo "Note: -XX:+PrintAssembly requires hsdis library"
echo " Download: https://chriswhocodes.com/hsdis/"
echo " Place at: \$JAVA_HOME/lib/server/"
echo ""
exit 1
fi
echo "β Server is running on port $PORT"
echo ""
# ================================================
# Gatling λΆν ν
μ€νΈ
# ================================================
echo "[2/3] Running Gatling Heavy Load test..."
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo " Simulation: HeavyLoadSimulation"
echo " Warm-up: ~20,000 requests"
echo " Load test: ~80,000 requests"
echo " Total: ~100,000 requests"
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo ""
# Gatling μ€ν
./gradlew gatlingRun --simulation=benchmark.HeavyLoadSimulation
GATLING_EXIT_CODE=$?
if [ $GATLING_EXIT_CODE -ne 0 ]; then
echo ""
echo "Gatling test failed with exit code: $GATLING_EXIT_CODE"
exit $GATLING_EXIT_CODE
fi
echo ""
echo "β Gatling test completed"
echo ""
# ================================================
# κ²°κ³Ό μ 리
# ================================================
echo "[3/3] Collecting profiling results..."
echo ""
# Gatling 리ν¬νΈ κ²½λ‘ μ°ΎκΈ°
LATEST_GATLING_REPORT=$(find build/reports/gatling -type d -name "*HeavyLoadSimulation*" 2>/dev/null | sort -r | head -n 1)
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo " Profiling Complete!"
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo ""
echo "Profiling Data:"
echo " β’ JIT Compilation Log: $OUTPUT_DIR/hotspot_*.log"
echo " β’ JFR Recording: $OUTPUT_DIR/recording.jfr"
echo " β’ Assembly Output: $OUTPUT_DIR/hotspot_*.log (if hsdis available)"
echo ""
echo "Gatling Report:"
if [ -n "$LATEST_GATLING_REPORT" ]; then
echo " β’ HTML Report: $LATEST_GATLING_REPORT/index.html"
echo ""
echo " Open report:"
echo " open $LATEST_GATLING_REPORT/index.html"
else
echo " β’ Check: build/reports/gatling/"
fi
echo ""
echo "Analysis Tools"
echo " 1. JITWatch: Analyze hotspot_*.log for JIT compilation details"
echo " 2. JDK Mission Control: Open recording.jfr for performance profiling"
echo " 3. Gatling: View HTML report for load test metrics"
echo ""
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"