Java进程占用内存过高,排查解决方法
最近收到邮件报警,说内存使作率达到84%。如下图:
解决方法:
A:可能是代码原因导致的问题:
1、使用命令:top 查看当前进程的状态
2、从上图可以看到PID:916的java进程占用内存较大。定位线程问题(通过命令查看PID 为25894 进程的线程情况),命令:# ps p 916 -L -o pcpu,pmem,pid,tid,time,tname,cmd
由此可以看到这PID:916的进程产生了很多线程。接下来就可以通过jstack查看内存使用的堆栈。
3、查看内存使用的堆栈:在这里我们挑选了TID=934的线程进行分析,首先需要将934这个id转换为16进制。需输入如下命令,
printf "%x\n" 9731
4、将PID为916的堆栈信息打印到jstack.log中,命令:jstack -l 916 > jstack.log
5、
查看堆栈信息文件,命令:vim jstack.log
在进行搜索TID为2603的相关信息。如图:
6、分析
可以看到这个线程状态为:RUNNABLE。是正在运行状态的
另外其它的大部分线程状态为:WAITING。通过查看文件分析 看到大量 Java Thread State。
说明它在等待另一个条件的发生,来把自己唤醒,或者干脆它是调用了 sleep(N)。
此时线程状态大致为以下几种:
java.lang.Thread.State: WAITING (parking):一直等那个条件发生;
java.lang.Thread.State: TIMED_WAITING (parking或sleeping):定时的,那个条件不到来,也将定时唤醒自己。
7.代码优化:将文件发送给开发。优化下线程
B:可能是其他原因导致的问题:
1、使用ps命令:ps -ef | grep java | grep -v grep
查看当前java进程列表
root 834 1 0 May13 ? 00:30:09 /usr/lib/jvm/java/bin/java -Djava.util.logging.config.file=/data/apache-tomcat-9.0.13/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= -classpath /data/apache-tomcat-9.0.13/bin/bootstrap.jar:/data/apache-tomcat-9.0.13/bin/tomcat-juli.jar -Dcatalina.base=/data/apache-tomcat-9.0.13 -Dcatalina.home=/data/apache-tomcat-9.0.13 -Djava.io.tmpdir=/data/apache-tomcat-9.0.13/temp org.apache.catalina.startup.Bootstrap start root 1294 1 3 May13 ? 14:41:25 /usr/lib/jvm/java/bin/java -Djava.util.logging.config.file=/data/apache-tomcat-9.0.13/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= -classpath /data/apache-tomcat-9.0.13/bin/bootstrap.jar:/data/apache-tomcat-9.0.13/bin/tomcat-juli.jar -Dcatalina.base=/data/apache-tomcat-9.0.13 -Dcatalina.home=/data/apache-tomcat-9.0.13 -Djava.io.tmpdir=/data/apache-tomcat-9.0.13/temp org.apache.catalina.startup.Bootstrap start root 2085 1 0 Mar05 ? 01:57:08 /usr/lib/jvm/java/bin/java -Djava.util.logging.config.file=/data/apache-tomcat-9.0.13/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= -classpath /data/apache-tomcat-9.0.13/bin/bootstrap.jar:/data/apache-tomcat-9.0.13/bin/tomcat-juli.jar -Dcatalina.base=/data/apache-tomcat-9.0.13 -Dcatalina.home=/data/apache-tomcat-9.0.13 -Djava.io.tmpdir=/data/apache-tomcat-9.0.13/temp org.apache.catalina.startup.Bootstrap start root 12808 1 0 Mar08 ? 01:16:03 /usr/lib/jvm/java/bin/java -Djava.util.logging.config.file=/data/apache-tomcat-9.0.13/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= -classpath /data/apache-tomcat-9.0.13/bin/bootstrap.jar:/data/apache-tomcat-9.0.13/bin/tomcat-juli.jar -Dcatalina.base=/data/apache-tomcat-9.0.13 -Dcatalina.home=/data/apache-tomcat-9.0.13 -Djava.io.tmpdir=/data/apache-tomcat-9.0.13/temp org.apache.catalina.startup.Bootstrap start root 19392 1 0 May09 ? 00:36:19 /usr/lib/jvm/java/bin/java -Djava.util.logging.config.file=/data/apache-tomcat-9.0.13/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= -classpath /data/apache-tomcat-9.0.13/bin/bootstrap.jar:/data/apache-tomcat-9.0.13/bin/tomcat-juli.jar -Dcatalina.base=/data/apache-tomcat-9.0.13 -Dcatalina.home=/data/apache-tomcat-9.0.13 -Djava.io.tmpdir=/data/apache-tomcat-9.0.13/temp org.apache.catalina.startup.Bootstrap start root 19838 1 1 May09 ? 05:32:17 /usr/lib/jvm/java/bin/java -Djava.util.logging.config.file=/data/apache-tomcat-9.0.13/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= -classpath /data/apache-tomcat-9.0.13/bin/bootstrap.jar:/data/apache-tomcat-9.0.13/bin/tomcat-juli.jar -Dcatalina.base=/data/apache-tomcat-9.0.13 -Dcatalina.home=/data/apache-tomcat-9.0.13 -Djava.io.tmpdir=/data/apache-tomcat-9.0.13/temp org.apache.catalina.startup.Bootstrap start root 21543 1 0 May27 ? 00:22:03 /usr/lib/jvm/java/bin/java -Djava.util.logging.config.file=/data/apache-tomcat-9.0.13/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= -classpath /data/apache-tomcat-9.0.13/bin/bootstrap.jar:/data/apache-tomcat-9.0.13/bin/tomcat-juli.jar -Dcatalina.base=/data/apache-tomcat-9.0.13 -Dcatalina.home=/data/apache-tomcat-9.0.13 -Djava.io.tmpdir=/data/apache-tomcat-9.0.13/temp org.apache.catalina.startup.Bootstrap start root 22750 1 5 May27 ? 02:28:41 /usr/lib/jvm/java/bin/java -Djava.util.logging.config.file=/data/apache-tomcat-9.0.13/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= -classpath /data/apache-tomcat-9.0.13/bin/bootstrap.jar:/data/apache-tomcat-9.0.13/bin/tomcat-juli.jar -Dcatalina.base=/data/apache-tomcat-9.0.13 -Dcatalina.home=/data/apache-tomcat-9.0.13 -Djava.io.tmpdir=/data/apache-tomcat-9.0.13/temp org.apache.catalina.startup.Bootstrap start
由上图所示,可以看到java进程是Tomcat的启动进程,开启多个Tomcat启动进程,并且是同一个端口。由此,可以判断,是因为关闭Tomcat服务时,java进程没有自动关闭,导致内存没有释放。
2、使用lsof命令:lsof | grep java |grep -v grep
查看当前进程的运行状态
java 834 root cwd DIR 252,1 4096 393217 /root java 834 root rtd DIR 252,1 4096 2 / java 834 root txt REG 252,1 5128 917742 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/bin/java java 834 root mem REG 252,1 262896 269147 /usr/lib64/libjpeg.so.62.0.0 java 834 root mem REG 252,1 41400 792676 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libjavajpeg.so java 834 root mem REG 252,1 644072 266782 /usr/lib64/libfreetype.so.6.3.22 java 834 root mem REG 252,1 349032 792667 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libfontmanager.so java 834 root mem REG 252,1 29072 792665 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt_headless.so java 834 root mem REG 252,1 715224 792664 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt.so java 834 root mem REG 252,1 99174448 269459 /usr/lib/locale/locale-archive java 834 root mem REG 252,1 111440 656920 /lib64/libresolv-2.12.so java 834 root mem REG 252,1 27896 655389 /lib64/libnss_dns-2.12.so .................... java 1294 root cwd DIR 252,1 4096 393217 /root java 1294 root rtd DIR 252,1 4096 2 / java 1294 root txt REG 252,1 5128 917742 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/bin/java java 1294 root mem REG 252,1 99174448 269459 /usr/lib/locale/locale-archive java 1294 root mem REG 252,1 262896 269147 /usr/lib64/libjpeg.so.62.0.0 java 1294 root mem REG 252,1 41400 792676 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libjavajpeg.so java 1294 root mem REG 252,1 644072 266782 /usr/lib64/libfreetype.so.6.3.22 java 1294 root mem REG 252,1 349032 792667 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libfontmanager.so java 1294 root mem REG 252,1 29072 792665 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt_headless.so java 1294 root mem REG 252,1 715224 792664 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt.so java 1294 root mem REG 252,1 111440 656920 /lib64/libresolv-2.12.so java 1294 root mem REG 252,1 27896 655389 /lib64/libnss_dns-2.12.so java 1294 root mem REG 252,1 11920 131997 /var/cache/fontconfig/beeeeb3dfe132a8a0633a017c99ce0c0-le64.cache-3 java 1294 root mem REG 252,1 3203275 792699 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/charsets.jar java 1294 root mem REG 252,1 3509512 792747 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/resources.jar java 1294 root mem REG 252,1 477712 655369 /lib64/libfreeblpriv3.so java 1294 root mem REG 252,1 248720 655363 /lib64/libnspr4.so java 1294 root mem REG 252,1 18720 655370 /lib64/libplc4.so java 1294 root mem REG 252,1 14528 655377 /lib64/libplds4.so java 1294 root mem REG 252,1 191928 266783 /usr/lib64/libnssutil3.so java 1294 root mem REG 252,1 1337168 268947 /usr/lib64/libnss3.so ............ java 2085 root cwd DIR 252,17 4096 2621998 /data/apache-tomcat-9.0.13/bin java 2085 root rtd DIR 252,1 4096 2 / java 2085 root txt REG 252,1 5128 917742 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/bin/java java 2085 root mem REG 252,1 99174448 269459 /usr/lib/locale/locale-archive java 2085 root mem REG 252,1 111440 656920 /lib64/libresolv-2.12.so java 2085 root mem REG 252,1 27896 655389 /lib64/libnss_dns-2.12.so java 2085 root mem REG 252,1 3203275 792699 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/charsets.jar java 2085 root mem REG 252,1 3509512 792747 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/resources.jar java 2085 root mem REG 252,1 477712 655369 /lib64/libfreeblpriv3.so java 2085 root mem REG 252,1 248720 655363 /lib64/libnspr4.so java 2085 root mem REG 252,1 18720 655370 /lib64/libplc4.so java 2085 root mem REG 252,1 14528 655377 /lib64/libplds4.so java 2085 root mem REG 252,1 191928 266783 /usr/lib64/libnssutil3.so java 2085 root mem REG 252,1 1337168 268947 /usr/lib64/libnss3.so java 2085 root mem REG 252,1 185368 266802 /usr/lib64/libsmime3.so java 2085 root mem REG 252,1 336472 269139 /usr/lib64/libssl3.so java 2085 root mem REG 252,1 45720 792689 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libsunec.so java 2085 root mem REG 252,1 36088 792682 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libmanagement.so java 2085 root mem REG 252,1 98280 792684 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libnet.so java 2085 root mem REG 252,1 73416 792685 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libnio.so java 2085 root mem REG 252,17 34918 2622001 /data/apache-tomcat-9.0.13/bin/bootstrap.jar java 2085 root mem REG 252,1 73280094 792748 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/rt.jar java 2085 root mem REG 252,1 298029 792717 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/ext/sunjce_provider.jar ............ java 12808 root cwd DIR 252,1 4096 393217 /root java 12808 root rtd DIR 252,1 4096 2 / java 12808 root txt REG 252,1 5128 917742 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/bin/java java 12808 root mem REG 252,1 99174448 269459 /usr/lib/locale/locale-archive java 12808 root mem REG 252,1 111440 656920 /lib64/libresolv-2.12.so java 12808 root mem REG 252,1 27896 655389 /lib64/libnss_dns-2.12.so java 12808 root mem REG 252,1 3509512 792747 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/resources.jar java 12808 root mem REG 252,1 477712 655369 /lib64/libfreeblpriv3.so java 12808 root mem REG 252,1 248720 655363 /lib64/libnspr4.so java 12808 root mem REG 252,1 18720 655370 /lib64/libplc4.so java 12808 root mem REG 252,1 3203275 792699 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/charsets.jar java 12808 root mem REG 252,1 14528 655377 /lib64/libplds4.so java 12808 root mem REG 252,1 191928 266783 /usr/lib64/libnssutil3.so java 12808 root mem REG 252,1 1337168 268947 /usr/lib64/libnss3.so java 12808 root mem REG 252,1 185368 266802 /usr/lib64/libsmime3.so java 12808 root mem REG 252,1 336472 269139 /usr/lib64/libssl3.so java 12808 root mem REG 252,1 45720 792689 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libsunec.so java 12808 root mem REG 252,1 36088 792682 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libmanagement.so java 12808 root mem REG 252,1 98280 792684 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libnet.so java 12808 root mem REG 252,1 73416 792685 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libnio.so .......... java 19392 root cwd DIR 252,1 4096 393217 /root java 19392 root rtd DIR 252,1 4096 2 / java 19392 root txt REG 252,1 5128 917742 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/bin/java java 19392 root mem REG 252,1 262896 269147 /usr/lib64/libjpeg.so.62.0.0 java 19392 root mem REG 252,1 41400 792676 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libjavajpeg.so java 19392 root mem REG 252,1 644072 266782 /usr/lib64/libfreetype.so.6.3.22 java 19392 root mem REG 252,1 349032 792667 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libfontmanager.so java 19392 root mem REG 252,1 29072 792665 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt_headless.so java 19392 root mem REG 252,1 715224 792664 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt.so java 19392 root mem REG 252,1 99174448 269459 /usr/lib/locale/locale-archive java 19392 root mem REG 252,1 111440 656920 /lib64/libresolv-2.12.so java 19392 root mem REG 252,1 27896 655389 /lib64/libnss_dns-2.12.so java 19392 root mem REG 252,1 11920 131997 /var/cache/fontconfig/beeeeb3dfe132a8a0633a017c99ce0c0-le64.cache-3 java 19392 root mem REG 252,1 3203275 792699 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/charsets.jar java 19392 root mem REG 252,1 3509512 792747 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/resources.jar java 19392 root mem REG 252,1 477712 655369 /lib64/libfreeblpriv3.so java 19392 root mem REG 252,1 248720 655363 /lib64/libnspr4.so java 19392 root mem REG 252,1 18720 655370 /lib64/libplc4.so java 19392 root mem REG 252,1 14528 655377 /lib64/libplds4.so java 19392 root mem REG 252,1 191928 266783 /usr/lib64/libnssutil3.so ........... java 19838 root cwd DIR 252,1 4096 393217 /root java 19838 root rtd DIR 252,1 4096 2 / java 19838 root txt REG 252,1 5128 917742 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/bin/java java 19838 root mem REG 252,1 99174448 269459 /usr/lib/locale/locale-archive java 19838 root mem REG 252,1 262896 269147 /usr/lib64/libjpeg.so.62.0.0 java 19838 root mem REG 252,1 41400 792676 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libjavajpeg.so java 19838 root mem REG 252,1 644072 266782 /usr/lib64/libfreetype.so.6.3.22 java 19838 root mem REG 252,1 349032 792667 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libfontmanager.so java 19838 root mem REG 252,1 29072 792665 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt_headless.so java 19838 root mem REG 252,1 715224 792664 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt.so java 19838 root mem REG 252,1 11920 131997 /var/cache/fontconfig/beeeeb3dfe132a8a0633a017c99ce0c0-le64.cache-3 java 19838 root mem REG 252,1 111440 656920 /lib64/libresolv-2.12.so java 19838 root mem REG 252,1 27896 655389 /lib64/libnss_dns-2.12.so java 19838 root mem REG 252,1 3203275 792699 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/charsets.jar java 19838 root mem REG 252,1 3509512 792747 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/resources.jar java 19838 root mem REG 252,1 477712 655369 /lib64/libfreeblpriv3.so java 19838 root mem REG 252,1 248720 655363 /lib64/libnspr4.so java 19838 root mem REG 252,1 18720 655370 /lib64/libplc4.so java 19838 root mem REG 252,1 14528 655377 /lib64/libplds4.so ......... java 21543 root cwd DIR 252,1 4096 393217 /root java 21543 root rtd DIR 252,1 4096 2 / java 21543 root txt REG 252,1 5128 917742 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/bin/java java 21543 root mem REG 252,1 262896 269147 /usr/lib64/libjpeg.so.62.0.0 java 21543 root mem REG 252,1 41400 792676 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libjavajpeg.so java 21543 root mem REG 252,1 644072 266782 /usr/lib64/libfreetype.so.6.3.22 java 21543 root mem REG 252,1 349032 792667 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libfontmanager.so java 21543 root mem REG 252,1 29072 792665 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt_headless.so java 21543 root mem REG 252,1 715224 792664 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt.so java 21543 root mem REG 252,1 111440 656920 /lib64/libresolv-2.12.so java 21543 root mem REG 252,1 27896 655389 /lib64/libnss_dns-2.12.so java 21543 root mem REG 252,1 3509512 792747 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/resources.jar java 21543 root mem REG 252,1 3203275 792699 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/charsets.jar java 21543 root mem REG 252,1 11920 131997 /var/cache/fontconfig/beeeeb3dfe132a8a0633a017c99ce0c0-le64.cache-3 java 21543 root mem REG 252,1 477712 655369 /lib64/libfreeblpriv3.so java 21543 root mem REG 252,1 248720 655363 /lib64/libnspr4.so java 21543 root mem REG 252,1 18720 655370 /lib64/libplc4.so java 21543 root mem REG 252,1 14528 655377 /lib64/libplds4.so java 21543 root mem REG 252,1 191928 266783 /usr/lib64/libnssutil3.so ........ java 22750 root cwd DIR 252,1 4096 393217 /root java 22750 root rtd DIR 252,1 4096 2 / java 22750 root txt REG 252,1 5128 917742 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/bin/java java 22750 root mem REG 252,1 262896 269147 /usr/lib64/libjpeg.so.62.0.0 java 22750 root mem REG 252,1 41400 792676 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libjavajpeg.so java 22750 root mem REG 252,1 644072 266782 /usr/lib64/libfreetype.so.6.3.22 java 22750 root mem REG 252,1 349032 792667 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libfontmanager.so java 22750 root mem REG 252,1 29072 792665 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt_headless.so java 22750 root mem REG 252,1 715224 792664 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt.so java 22750 root mem REG 252,1 111440 656920 /lib64/libresolv-2.12.so java 22750 root mem REG 252,1 27896 655389 /lib64/libnss_dns-2.12.so java 22750 root mem REG 252,1 11920 131997 /var/cache/fontconfig/beeeeb3dfe132a8a0633a017c99ce0c0-le64.cache-3 java 22750 root mem REG 252,1 3203275 792699 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/charsets.jar java 22750 root mem REG 252,1 3509512 792747 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/resources.jar java 22750 root mem REG 252,1 477712 655369 /lib64/libfreeblpriv3.so java 22750 root mem REG 252,1 248720 655363 /lib64/libnspr4.so ........ java 29458 root cwd DIR 252,1 4096 393217 /root java 29458 root rtd DIR 252,1 4096 2 / java 29458 root txt REG 252,1 5128 917742 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/bin/java java 29458 root mem REG 252,1 99174448 269459 /usr/lib/locale/locale-archive java 29458 root mem REG 252,1 262896 269147 /usr/lib64/libjpeg.so.62.0.0 java 29458 root mem REG 252,1 41400 792676 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libjavajpeg.so java 29458 root mem REG 252,1 644072 266782 /usr/lib64/libfreetype.so.6.3.22 java 29458 root mem REG 252,1 349032 792667 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libfontmanager.so java 29458 root mem REG 252,1 29072 792665 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt_headless.so java 29458 root mem REG 252,1 715224 792664 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre/lib/amd64/libawt.so java 29458 root mem REG 252,1 11920 131997 /var/cache/fontconfig/beeeeb3dfe132a8a0633a017c99ce0c0-le64.cache-3 ............ java 29458 root 235u IPv4 34489969 0t0 TCP localhost:57037->localhost:mysql (ESTABLISHED) java 29458 root 236u IPv4 34489971 0t0 TCP localhost:57036->localhost:mysql (ESTABLISHED) java 29458 root 237u IPv4 34489970 0t0 TCP localhost:57040->localhost:mysql (ESTABLISHED) java 29458 root 238u IPv4 34489982 0t0 TCP localhost:57042->localhost:mysql (ESTABLISHED) java 29458 root 239u IPv4 34489983 0t0 TCP localhost:57043->localhost:mysql (ESTABLISHED) java 29458 root 240u IPv4 34489984 0t0 TCP localhost:57046->localhost:mysql (ESTABLISHED)
通过上图所示:正常运行的Tomcat状态应为PID:29458的java进程
3、杀掉其他的java的进程
kill -9 PID
4、然后查看主机监控,果然内存使用率下降,网站运行正常