Today we will talk about the JVM GC tuning parameters in jdk10. There are 1957 JVM parameters in jdk10, including 658 formal parameters.
In fact, jdk10 is not much different from jdk9. One change we can feel is the introduction of the local variable var.
In order to facilitate your reference, we specially summarize the GC parameters in jdk10 into a PDF, which has been added, modified and modified on the basis of the previous jdk9. You are welcome to download.
Java parameter types
In fact, Java parameter types can be divided into three categories.
The first is called standard Java parameters.
This kind of parameter is supported by all JVM implementations and is a very common JVM parameter.
We can see it by executing Java commands directly.
The second type is called extra Java parameters. These parameters are specially prepared for 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 see it through Java – X.
The third type is called advanced parameters. These parameters are developer options, and their main function is to tune the JVM. Like the second kind 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, which can be viewed through Java – XX: + printflagsfinal.
The amazing thing is that the parameters that we do JVM tuning are often the third kind of parameters. So, if an interviewer asks you about JVM tuning next time, you can directly connect them back: these parameters are not recommended by the official ordinary users, and may change at any time. No need to master! Then this offer must belong to you.
In fact, there is no big change between jdk10 and jdk9. Here is a feature called large pages.
Large pages is not a new feature of jdk10. It has a long history.
Before we talk about large pages, let’s talk about memory paging.
CPU accesses memory space by addressing. Generally speaking, the addressing ability of CPU is limited. The actual physical memory address will be much larger than the CPU address range.
In order to solve this problem, modern CPU introduces the concept 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, the concept of virtual address space is introduced into modern computer systems. Simply speaking, it can be seen as the mapping with the actual physical address. By using segmentation or paging technology, the actual physical address can be mapped to the virtual address space.
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. Only when it is needed can the page be mapped to the physical memory. In this way, the physical memory can actually be regarded as the cache of the virtual space address.
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’s speed of reading physical memory will certainly be slower than that of reading 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 translations.
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 paging, a single TLB entry stores a larger memory range. This will reduce the pressure on TLBs 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 large amount of large page memory, it may lead to insufficient general memory, excessive paging in other applications, and slow down the entire system. Similarly, a long-running system may generate too much fragmentation, which may result in insufficient page memory. When this happens, either the OS or the JVM will revert to using regular pages.
Oracle, Solaris, Linux, and Windows Server 2003 all support large pages.
You can explore the configuration of large page for each system.
I have introduced JIT many times in previous articles. In order to improve the execution efficiency of Java programs, the JVM will use JIT to compile some hot code into machine code.
The debugging parameters of JIT are also very important. Here are some common JIT debugging instructions:
Use background compilation, that is to say, compilation thread and foreground thread use different threads. In general, if we need to debug JIT logs, we need to turn off this option.
Set the number of compilation threads.
Customize the compilation method of specific methods.
It means to put the indexof exclude from compiled of string.
There are several kinds of commands here:
- Break – sets a breakpoint for compilation
- Compileonly – exclude all methods except the specified method
- Dontinline – the specified method is not inline
- Exclude – exclude the specified method at compile time
- Inline – the method specified by inline
- Log – exclude all method logs except the specified method
- Option – pass a JIT compiled parameter
- Print – output the generated assembly code
- Quiet – do not print compile command
Specifies that certain commands are compiled.
How many times the command is interpreted and executed before it is compiled. By default, the value is 10000 in – server mode and 1500 in – client mode.
If layered compilation is enabled, this value will be ignored.
Turn on escape analysis.
Turn on the inline feature.
Output compilation log.
Output assembly code.
Cancel hierarchical compilation.
Similarly, a PDF is specially prepared for jdk10. The download link is as follows:
Link to this article: http://www.flydean.com/jdk10-gc-cheatsheet/
The most popular interpretation, the most profound dry goods, the most concise tutorial, many tips you don’t know are waiting for you to discover!
Welcome to my official account: “those things in procedure”, understand technology, know you better!