Tuning Overview
Tuning Principles
JVM is short for Java Virtual Machine. Java code does not need to be recompiled when running on different platforms. The Java language uses the JVM to mask the hardware instruction differences related to specific platforms. In this way, the Java compiler only needs to generate the bytecode that runs on the JVM of multiple platforms without modification. JVM embodies just-in-time compilation (JIT), memory management (garbage collection, GC), and runtime technologies. GC tuning is widely used in performance tuning. This section describes the tuning principles for GC.
- Preferentially select a JDK version as late as possible. Late versions have updated features and optimization, which improves the Java program performance.
- Select a proper heap space for the JVM based on the actual service scenario and hardware resources.
- Select a proper GC algorithm.
In addition, Java provides many tools for monitoring program running and analyzing performance. These tools can be used for Java performance tuning.
Key Tuning Parameters
Optimization Item |
Description |
Default Value |
Effective Scope |
Kunpeng 916 |
Kunpeng 920 |
|---|---|---|---|---|---|
-Xmx |
Maximum available heap memory of the JVM. |
Based on system resources. |
After the Java process restarts. |
Y |
Y |
-Xms |
Initial heap size, which is generally the same as that of Xmx. |
Based on system resources |
After the Java process restarts. |
Y |
Y |
-Xmn |
Size of the young generation heap. |
Based on system resources |
After the Java process restarts. |
Y |
Y |
-Xss |
Heap size for each thread. |
In JDK 1.5 and later versions, the default stack size of each thread is 1 MB. In earlier versions, the default stack size is 256 KB. |
After the Java process restarts. |
Y |
Y |