A PDF to understand jdk10 GC tuning script – PDF download attached

brief introduction

Today, let's talk about JVM GC tuning parameters in jdk10. There are 1957 JVM parameters in jdk10, including 658 formal parameters.

In fact, jdk10 has not changed much compared with jdk9. One change we can feel is the introduction of the local variable var.

In order to facilitate your reference, the GC parameters in jdk10 are specially summarized into a PDF. This PDF has been increased, decreased and modified on the basis of the previous jdk9. You are welcome to download it.

Java parameter type

In fact, Java parameter types can be divided into three categories.

The first is called standard Java parameters.

These parameters are supported by all JVM implementations and are very common JVM parameters.

We can view it by executing Java commands directly.

The second type is called additional Java parameters. These parameters are specially prepared for the hotspot VM. It is not guaranteed that all JVMs implement these parameters. And these parameters may be modified at any time. Additional Java parameters start with - X.

We can view it through Java - X.

The third category is called advanced parameters. These parameters are developer options and are mainly used for JVM tuning. Like the second type of parameters, these parameters are not guaranteed to be supported by all JVMs and may change at any time.

The third type of parameter starts with - XX. We can view it through Java - XX: + printflagsfinal.

Large Pages

In fact, jdk10 is not much different from jdk9. Here we focus on a feature called large pages.

In fact, large pages is not a new feature of jdk10. It has a long history.

Before talking about large pages, let's talk about memory pages.

CPU accesses memory space through addressing. Generally speaking, the addressing capacity of CPU is limited. The actual physical memory address will be much larger than the addressing range of the CPU.

In order to solve this problem, modern CPU introduces the concepts of MMU (memory management unit) and virtual address space.

Virtual address space is also called virtual address space. In order to isolate different programs from each other and ensure the certainty of addresses in programs, modern computer systems have introduced the concept of virtual address space. In short, it can be regarded as a mapping with the actual physical address. The actual physical address is mapped to the virtual address space by using segmentation or paging technology.

At the same time, in order to solve the problem that the virtual space is larger than the physical memory space, modern computer technology generally uses paging technology.

Paging technology is to divide the virtual space into many pages, and allocate the page to the mapping of physical memory only when it is needed, so that the physical memory can actually be regarded as the cache of virtual space addresses.

The mapping of virtual address space and physical address works through a place called mapping storage table. This place is generally called page table, which is stored in physical memory.

The CPU must be slower to read physical memory than to read registers. So the concept of TLB is introduced.

The translation lookaside buffer (TLB) is a page translation cache that holds the most recently used virtual to physical address translation.

TLB capacity is limited. If TLB miss occurs, the CPU needs to access the page table in memory, resulting in performance loss.

By increasing the size of memory pages, a single TLB entry stores a larger memory range. This will reduce the pressure on the TLB and may have better performance for memory intensive applications.

However, large pages may also have a negative impact on system performance. For example, when an application uses a lot of large page memory, it may lead to insufficient general memory, excessive paging in other applications, and slow down the whole system. Similarly, a long-running system may generate too much fragmentation, which may lead to failure to retain large enough page memory. When this happens, the OS or JVM reverts to using regular pages.

You can explore the large page configuration of each system by yourself.

JIT tuning

I have introduced JIT many times in previous articles. In order to improve the execution efficiency of Java programs, the JVM will compile some hot code into machine code using JIT.

Then JIT debugging parameters are also very important. Here are some common JIT debugging instructions:

-XX:+BackgroundCompilation

Use background compilation, that is, the compilation thread and foreground thread use different threads. Generally speaking, if we need to debug JIT logs, we need to turn this option off.

-XX:CICompilerCount=threads

Set the number of compilation threads.

-XX:CompileCommand=command,method[,option]

Customize the compilation method of specific methods.

For example:

-XX:CompileCommand=exclude,java/lang/String.indexOf

This means that the indexof exclude from compiled of string.

The commands here are as follows:

-XX:CompileOnly=methods

Specifies to compile some commands.

-XX:CompileThreshold=invocations

How many times does the command have to be interpreted and executed before it can be compiled. By default, the value is 10000 in - server mode and 1500 in - client mode.

If layered compilation is turned on, this value will be ignored.

-XX:+DoEscapeAnalysis

Turn on escape analysis.

-XX:+Inline

Turn on the inline feature.

-XX:+LogCompilation

Output compilation log.

-XX:+PrintAssembly

Output assembly code.

-XX:-TieredCompilation

Cancel hierarchical compilation.

Above:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>