test2

Time:2021-4-3

Test2 new to fwq

1. Setting – XMS = – Xmx goes without saying

2. The initial heap memory allocated by the JVM is specified by – XMS, which is 1 / 64 of the physical memory by default; the maximum heap memory allocated by the JVM is specified by – Xmx, which is 1 / 4 of the physical memory by default. When the default free heap memory is less than 40%, the JVM will increase the heap to the maximum limit of – Xmx;

When the free heap memory is greater than 70%, the JVM reduces the heap to the minimum limit of – XMS. Therefore, the server generally sets -Xms and -Xmx equal so as to avoid adjusting the heap size after each GC.

Note: if – Xmx is not specified or specified too small, the application may cause java.lang.OutOfMemory Error, this error is from the JVM, not throwable and cannot be caught with try… Catch.

3. JVM memory limit (maximum)

First of all, the memory of the JVM is limited to the actual maximum physical memory. Assuming that the physical memory is infinite, the maximum memory of the JVM has a lot to do with the operating system. In short, although the controllable memory space of 32-bit processor is 4GB, the specific operating system will give a limit, which is generally 2gb-3gb (generally speaking, it is 1.5G-2G under Windows system and 2g-3g under Linux system), and there will be no limit for processors with more than 64bit.

Verification: use the Java – xmx512m – version command to test, and then gradually increase the value of 512. If the execution is normal, it means that the specified memory size is available, otherwise the error message will be printed,

No matter the real memory is 2G or 32g, jdk1.8.0 is used on 64 bit platform_ 101 and jdk1.8.0_ 141, the available values tested with the above commands are all over 700g. !
! [computer generated alternative text:
[[email protected]#java-Xmx7ßßG-version
javaversion·1.8.6141·
Java (TM) serentine environment (build1.8.e141-b15)
Javahotspot() 64 bitserver (build25 彐 41. Blmixedmode)
Youhavemaitin / var / spot / MAIT / root
[[email protected]#《]
##Specific operation examples:

Take an RPC service of our company as an example.

BTW: for the new service just launched, if you don’t know how much memory to set, you can set more memory first, and then analyze it according to the situation after GC.

The initial JVM memory parameter setting is: Xmx = 2G, XMS = 2G, XMN = 1g

Use jstat to view the current GC situation. As shown in the figure below:test2

Recommended Today

The use of springboot Ajax

Ajax overview What is Ajax? data Ajax application scenarios? project Commodity system. Evaluation system. Map system. ….. Ajax can only send and retrieve the necessary data to the server, and use JavaScript to process the response from the server on the client side. data But Ajax technology also has disadvantages, the biggest disadvantage is that […]