There are no tips for JVM adjustment. There are only some principles. You need to set the optimization goal based on the characteristics of your application. Here we collect some content and choose to record it.
Java heap (xmx, XMS) and Java Process heap are two different situations.
The heap of the Java Process includes:
Java heap
Permanent generation
Thread stacks
Native code
Directly allocated memory
Code Generation
Garbage Collection
TCP Buffers
Therefore, we should be careful when setting JVM parameters. Generally, we will set Java heap and perm Gen to select a reasonable value based on the memory size and application characteristics of the operating system. -XMS/-xmxjava heap is not as large as possible, but its general optimization principle is sufficient. If it is too large, the memory will be wasted, at the same time, GC efficiency is affected-XX: newsize/-XX: newratio is generally set to 25%-33% of Java heap, which is too large or too small will affect GC. According to the characteristics of the application, to adjust the GC-related adjustment objectives, the ratio of object life cycle is as follows: * Do not enter the old area for short-lived objects * short-lived objects are killed during minor GC * long-lived objects must be placed in the old area * long-lived objects can be full GC cleaning, however, the full GC should be adjusted to the minimum possible occurrence. No matter what algorithm is used, GC will always cause the application to be paused. The duration ranges from milliseconds to seconds, which will affect the corresponding time of the application, the duration of the pause depends on the characteristics of the application. You can adjust it by setting the GC pause time (note that it is only the expected time, not the absolute time)-XX: maxgcpausemillis-XX: maxgcminorpausemillis, generally, setting a short pause will lead to a relatively frequent GC, which can be adjusted based on the application situation.