2026-10-31·por Sijie Wang

JVM Tuning by Load Test

JVM tuning by load test: rough notes

What it is. Find JVM-level bottlenecks through load testing, and tune parameters until the service meets its targets under load. Default parameters do not necessarily fit your load; tuning without load-test data is guessing.

Rough flow. Set acceptance targets first: throughput (QPS, Queries Per Second; TPS, Transactions Per Second), latency (p99, the value 99% of requests stay under), error rate, resource caps. Then ramp pressure gradually to find the inflection point where latency or errors start to degrade. First separate the bottleneck: application slowness or JVM-level causes (GC pauses, heap shortage, thread exhaustion).

Tuning knobs, named only. Heap size (Xms/Xmx), GC choice (G1, ZGC, Parallel, each fits different shapes) and GC target (such as MaxGCPauseMillis), thread pools and connection pools, Metaspace, warm-up and CodeCache.

Load generators, named only. Apache JMeter: mature, GUI scripting, many protocols, heavy, distributed setup needed. k6: scripted in JavaScript, command-line, light, CI-friendly. Gatling: Scala DSL, strong single-machine concurrency, good reports. wrk and hey: minimal, for quickly probing the ceiling, not for complex scenarios.

JVM observability, named only. GC logs (-Xlog:gc*): first-hand evidence for pauses and collection frequency. JFR, Java Flight Recorder: low-overhead event recording, viewed with JDK Mission Control. jps lists running Java processes. jstat shows GC and heap statistics live. jinfo views or changes a running JVM's settings. jmap takes heap dumps and histograms, for memory leaks. jstack takes thread dumps, for deadlocks and stuck threads. jcmd is the general diagnostic entry point. jconsole and VisualVM are graphical starters. jhsdb analyses dumps offline. async-profiler with flame graphs locates CPU and memory hot spots. Arthas (Alibaba): live diagnosis without restart, its dashboard shows threads, heap, GC and runtime info on one screen.

One rule. Change one variable at a time, then re-test. The goal is the business metric, not the parameter itself.

sobre esta entrada

Una de las entradas de wiki de sijie. La IA en este sitio está anclada en el mismo corpus y responde en la voz de sijie, con citas que vuelven a entradas como esta — responder le cuesta dinero a sijie, así que espera detrás de un código: ingrese código de acceso →

JVM Tuning by Load Test — Sijie Wang