jvisualvm and PermGen configuration (JAVA_OPTS) when Windows service starts Tomcat

When the tomcat is started in the service mode, the general Java parameter configuration mode will change. The reason is that catalina.bat or startup.bat is no longer valid when starting tomcat. At this time, if JAVA_OPTS is configured into bat, the configuration will be invalid.

For example, the tomcat path where the Windows service runs is like this

D:\..\apache-tomcat-7.0.55\bin\tomcat7.exe //RS//Tomcat7

 

1. Configure jvisualvm monitoring

Open the registry (regedit.exe), search for Options; find the following path

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\Tomcat7\Parameters\Java\Options

 The path of the tomcat configuration in the registry of the respective servers may not be the same as mine.

Double-click Options and add the following after the original data value

-Dcom.sun.management.jmxremote.port=8999
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

Open the bin folder in the jdk directory, open jvisualvm.exe to run, right-click on 'local' and click 'add jmx link. '

In the link box in the pop-up box, fill in: localhost:8999 (the port number assigned above) Click OK to start viewing tomcat's usage of cpu, memory, stack, and permgen.

 

2. PermGen space configuration

 

Solve the problem: java.lang.OutOfMemoryError: PermGen space is reported when starting tomcat

 

The general solution on the Internet is to go to catalina.bat or startup.bat and add the following code,

JAVA_OPTS="-server -Xms800m -Xmx800m  -XX:PermSize=64M -XX:MaxNewSize=256m -XX:MaxPermSize=128m -Djava.awt.headless=true "  

 

If it is a service mode to start tomcat, the configuration is invalid, and the above configuration information is not loaded when tomcat is started.

 

 

 java.lang.OutOfMemoryError: Please refer to Baidu for the cause of PermGen space.

The solution is to increase the memory allocation

Operation method, find Options in the registry according to the above step 1 and add the following code

-XX:PermSize=512M
-XX:MaxPermSize=1024M

 Finished, restart tomcat, restart jvisualvm; check the size of PermGen in jvisualvm, has it been changed!

 

3.  These two items -Xms800m -Xmx800m cannot be added directly in Options. The JvMMs and JvMMx values ​​under the registry java folder are the items corresponding to these two values.

 

 

Screenshot of registry for reference (attached

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326774691&siteId=291194637