Monitoring Tomcat's JVM memory through JConsoler 1. How to monitor Tomcat
Custom monitoring: anything that can be obtained by command can be monitored Monitoring java through jmx
Monitoring hardware via ipmi Monitor network devices through snmp, as long as they support snmp 2. Java's own monitoring commands
[root@localhost ~]# jps -lvm 7457 org.apache.catalina.startup.Bootstrap start start -Djava.util.logging.config.file=/application/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -Dcatalina.base=/application/tomcat -Dcatalina.home=/application/tomcat -Djava.io.tmpdir=/application/tomcat/temp 7525 org.apache.catalina.startup.Bootstrap start start -Djava.util.logging.config.file=/application/tomcat_8082/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -Dcatalina.base=/application/tomcat_8082 -Dcatalina.home=/application/tomcat_8082 -Djava.io.tmpdir=/application/tomcat_8082/temp 9144 sun.tools.jps.Jps -lvm -Denv.class.path=.:/application/jdk/lib:/application/jdk/jre/lib:/application/jdk/lib/tools.jar -Dapplication.home=/application/jdk1.8.0_60 -Xms8m 7482 org.apache.catalina.startup.Bootstrap start start -Djava.util.logging.config.file=/application/tomcat_8081/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -Dcatalina.base=/application/tomcat_8081 -Dcatalina.home=/application/tomcat_8081 -Djava.io.tmpdir=/application/tomcat_8081/temp
[root@localhost ~]# jmap -heap 7457 Attaching to process ID 7457, please wait... Debugger attached successfully. Server compiler detected. JVM version is 25.60-b23 using thread-local object allocation. Mark Sweep Compact GC Heap Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 255852544 (244.0MB) NewSize = 5570560 (5.3125MB) MaxNewSize = 85262336 (81.3125MB) OldSize = 11206656 (10.6875MB) NewRatio = 2 SurvivorRatio = 8 MetaspaceSize = 21807104 (20.796875MB) CompressedClassSpaceSize = 1073741824 (1024.0MB) MaxMetaspaceSize = 17592186044415 MB G1HeapRegionSize = 0 (0.0MB) Heap Usage: #For monitoring, pay attention to this column New Generation (Eden + 1 Survivor Space): capacity = 12779520 (12.1875MB) used = 11689352 (11.147834777832031MB) free = 1090168 (1.0396652221679688MB) 91.46941356169872% used Eden Space: #For monitoring, please pay attention to this column capacity = 11403264 (10.875MB) used = 11059616 (10.547271728515625MB) free = 343648 (0.327728271484375MB) 96.98640669899426% used From Space: #For monitoring, please pay attention to this column capacity = 1376256 (1.3125MB) used = 629736 (0.6005630493164062MB) free = 746520 (0.7119369506835938MB) 45.75718470982143% used To Space: #For monitoring, please pay attention to this column capacity = 1376256 (1.3125MB) used = 0 (0.0MB) free = 1376256 (1.3125MB) 0.0% used tenured generation: #For monitoring, please pay attention to this column capacity = 28164096 (26.859375MB) used = 18313224 (17.46485137939453MB) free = 9850872 (9.394523620605469MB) 65.02329774760035% used 21146 interned Strings occupying 1882520 bytes.
3. Tomcat troubleshooting caseThe system load is high and Tomcat occupies a high CPU
4. Configure Tomcat JMX monitoring
#Modify bin/catalina.sh [root@localhost tomcat]# vim bin/catalina.sh #Note that you cannot write it in separate lines, otherwise you will get an error message saying that the command cannot be found. Write it on one line CATALINA_OPTS="$CATALINA_OPTS" -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jxmremote.ssl=false -Djava.rmi.server.hostname="192.168.81.210" #Correct way to write CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jxmremote.ssl=false -Djava.rmi.server.hostname=192.168.81.210" #DescriptionCATALINA_OPTS="$CATALINA_OPTS" #Modify the tomcat startup parameters -Dcom.sun.management.jmxremote #Enable the tomcat remote management function -Dcom.sun.management.jmxremote.port=12345 #In addition to port 12345, the remote management function will also generate 2 random ports. We can open all ports Dcom.sun.management.jmxremote.authenticat=false #Is authentication required during monitoring? -Dcom.sun.management.jmxremote.ssl=false #Is SSL connection enabled? -Djava.rmi.server.hostname="192.168.81.210" #Set the ip of the server where tomcat is located After the configuration is complete, restart tomcat and you can use the ps command to see that the output information has a few more lines we wrote [root@localhost tomcat]# ps aux | grep java root 17786 5.7 10.6 2306592 105860 pts/1 Sl 15:52 0:08 /application/jdk/bin/java -Djava.util.logging.config.file=/application/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jxmremote.ssl=false -Djava.rmi.server.hostname=192.168.81.210 -Dignore.endorsed.dirs= -classpath /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/application/tomcat -Dcatalina.home=/application/tomcat -Djava.io.tmpdir=/application/tomcat/temp org.apache.catalina.startup.Bootstrap start Use the ss/netstat command to see the three additional ports [root@localhost tomcat]# ss -lnptu | grep java tcp LISTEN 0 100 :::8080 :::* users:(("java",pid=17786,fd=56)) #Our set tcp LISTEN 0 50 :::12345 :::* users:(("java",pid=17786,fd=22)) #Random 1 tcp LISTEN 0 50 :::46272 :::* users:(("java",pid=17786,fd=21)) # Random 2 tcp LISTEN 0 50 :::46081 :::* users:(("java",pid=17786,fd=24)) tcp LISTEN 0 1 ::ffff:127.0.0.1:8005 :::* users:(("java",pid=17786,fd=65)) 5. Use Jsconsole to connect to JMX to view monitoring dataThis is the end of this article on how to monitor Tomcat's JVM memory through JConsoler. For more information about JConsoler monitoring Tomcat JVM memory, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Convert psd cut image to div+css format
>>: Sample code for implementing markdown automatic numbering with pure CSS
1. Download https://dev.mysql.com/downloads/mysql...
Table of contents Browser Same Origin Policy 1. V...
Official documentation: JSON Functions Name Descr...
Table of contents 1. Front-end routing implementa...
The test environment is set up with a mariadb 5.7...
CSS plays a very important role in a web page. Wi...
Table of contents Preface JS Magic Number Storing...
cellspacing is the distance between cells in the t...
1. Use floating method Effect picture: The code i...
Table of contents 1. Browser local storage techno...
Copy code The code is as follows: <div content...
This error is often encountered by novices. This ...
Error description When we install Docker Desktop,...
Written in front In today's Internet field, N...
MYSQL version: MySQL Community Server 5.7.17, ins...