Explanation of some parameters of jvm under Linux

Tomcat's catalina.sh file or start.sh parameter explanation

JAVA_OPTS=" -Xms6g -Xmx6g -Xmn2g -XX:PermSize=64m -XX:MaxPermSize=256m 

-Djava.rmi.server.hostname=120.77.38.110 

-Dcom.sun.management.jmxremote.port=18999 

-Dcom.sun.management.jmxremote.ssl=false 

-Dcom.sun.management.jmxremote.authenticate=false

-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8080

-XX:-PrintGC -XX:-PrintGCDetails -XX:-PrintGCTimeStamps -Xloggc:logs/gc.log

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/a.hprof"

 

-Xmx6g: Set the maximum available memory of the JVM, the default value: 1/64 of the physical memory, less than 1G.

-Xms6g: Set the JVM initial memory, this value can be set to be the same as -Xmx to avoid the JVM reallocating memory after each garbage collection is completed. Default value: 1/64 of physical memory, less than 1G. Generally, it is about half of the maximum memory of the machine.

-Xmn2g: Set the young generation size, the default value: 1/64 of the physical memory, less than 1G. The size of the entire heap = the size of the young generation + the size of the old generation. The size of the heap does not include the size of the persistent generation. If the young generation is increased, the old generation will decrease accordingly. The official default configuration is the old generation size/young generation. Generation size = about 2/1 (use -XX:NewRatio to set -XX:NewRatio=5, which means the old/young generation = 5/1); this value has a great impact on system performance, and Sun officially recommends configuring it as the entire 3/8 of the heap. Generally, the size of -Xmn is 1/3 of -Xms.

-Xss: generally does not need to be changed, the default value is sufficient.

-XX:PermSize: Set the persistent generation initial value. Default: 1/64 of physical memory.

-XX:MaxPermSize=256m: Set the maximum value of persistent generation. Default: 1/64 of physical memory.

 

1. -Djava.rmi.server.hostname: This is the IP that configures the server

2. -Dcom.sun.management.jmxremote.port: This is the port number for configuring the remote connection, make sure this port is not occupied

3. -Dcom.sun.management.jmxremote.ssl=false specifies whether JMX enables ssl

4. -Dcom.sun.management.jmxremote.authenticate=false specifies whether JMX authentication is enabled (username, password authentication is required)

Configuring these 4 purposes is to monitor the JVM remotely 

 

Xdebug tells the jvm to run in debug mode 

Xrunjdwp transport Specifies the connection method (including socket transmission and memory transmission, of which memory transmission only supports windows, and memory transmission does not support remote debugging) 
address Listening port to receive TCP connections initiated by the debug client. 
server =y means serve as a server in a remote debugging session 

 

XX:-PrintGC Print GC information

XX:HeapDumpPath print dump file

eclipse 在本地连接到远程服务器调试如下图所示:

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326384794&siteId=291194637