Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B38FGKKam5SCGgwgduVAh3
29 lines
1.4 KiB
Bash
Executable File
29 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Why does G1 on 1 CPU touch ~490 MB in a 0.5 s process? Two suspects, tested:
|
|
# 1. the JDK 27 change of MinHeapFreeRatio/MaxHeapFreeRatio from 40/70 to 0/100 -> restored here; no effect
|
|
# 2. G1 simply being allowed to grow toward the 512 MB default maximum heap -> capped here; RSS follows the cap
|
|
# ./scripts/g1-tuning.sh -> docs/output/06-g1-tuning-1cpu.txt
|
|
set -euo pipefail
|
|
source "$(dirname "$0")/env.sh"
|
|
BUILD="$ROOT/build/g1"; mkdir -p "$BUILD"
|
|
"$JDK27/bin/javac" --release 26 -d "$BUILD" "$ROOT"/g1-container/src/*.java
|
|
{
|
|
echo "# JDK 27, G1 (the default), 1 CPU / 2 GB container, 400 batches, 2 runs per configuration"
|
|
echo
|
|
echo "=== flags that differ between 26 and 27 (from -XX:+PrintFlagsFinal)"
|
|
for img in "$IMG26" "$IMG27"; do
|
|
echo "--- $img"
|
|
docker run --rm --cpus=1 --memory=2g "$img" java -XX:+PrintFlagsFinal -version 2>/dev/null \
|
|
| grep -E ' (MinHeapFreeRatio|MaxHeapFreeRatio|MaxHeapSize|ConcGCThreads|ParallelGCThreads|UseCompactObjectHeaders|G1IHOP|UseCompressedClassPointers) ' || true
|
|
done
|
|
echo
|
|
for flags in "" "-XX:MinHeapFreeRatio=40 -XX:MaxHeapFreeRatio=70" "-Xmx256m"; do
|
|
echo "=== $IMG27 flags: [${flags:-none}]"
|
|
for i in 1 2; do
|
|
docker run --rm --cpus=1 --memory=2g -v "$BUILD:/app:ro" "$IMG27" java $flags -cp /app Workload 400 \
|
|
| grep -E 'wall|gc count|peak'
|
|
done
|
|
done
|
|
} > "$OUT/06-g1-tuning-1cpu.txt" 2>&1
|
|
cat "$OUT/06-g1-tuning-1cpu.txt"
|