activemq 在cpu查看时,能达到三千多;说明它目前cpu占用高
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6054 linux 20 0 10.5g 1.2g 16m S 3355 0.9 17679:05 java
62078 linux 20 0 39.9g 1.4g 13m S 8 1.1 2766:12 java
6286 mysql 20 0 2864m 220m 6772 S 6 0.2 1744:28 mysqld
按内存占用排序,前面的基本都是java程序
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
21580 linux 20 0 39.6g 9.6g 939m S 4 7.6 390:14.47 java
43396 linux 20 0 47.8g 7.3g 13m S 1 5.8 39:23.59 java
3536 root 20 0 47.6g 7.3g 21m S 0 5.8 159:21.07 java
8059 linux 20 0 43.9g 5.6g 13m S 2 4.4 335:45.68 java
60855 linux 20 0 48.1g 5.4g 13m S 5 4.3 776:22.93 java
49363 linux 20 0 44.0g 5.3g 13m S 3 4.2 363:15.97 java
33709 linux 20 0 44.6g 5.2g 14m S 3 4.1 146:14.72 java
40731 linux 20 0 39.1g 4.8g 13m S 2 3.8 115:03.77 java
10350 linux 20 0 43.7g 4.5g 13m S 4 3.6 541:26.19 java
31541 linux 20 0 40.0g 4.3g 13m S 0 3.4 391:47.35 java
49881 linux 20 0 43.7g 4.3g 13m S 3 3.4 364:21.04 java
62446 gitlab-r 20 0 5177m 3.4g 19m S 1 2.7 81382:38 mongod
13132 linux 20 0 39.9g 3.1g 13m S 0 2.5 85:37.12 java
58230 linux 20 0 39.2g 2.8g 13m S 0 2.2 9:28.36 java
23611 linux 20 0 49.0g 2.0g 13m S 1 1.6 117:55.32 java
5856 root 20 0 26.6g 1.8g 21m S 1 1.5 850:12.61 java
65292 linux 20 0 9156m 1.8g 14m S 0 1.4 19:28.69 java
62078 linux 20 0 39.9g 1.4g 13m S 0 1.1 2766:13 java
51216 linux 20 0 37.6g 1.4g 13m S 0 1.1 18:42.22 java
6054 linux 20 0 10.5g 1.2g 16m S 3311 0.9 17708:07 java
jps -lv
43396 iot-service-1.0.1-SNAPSHOT.jar -Dloader.path=lib,resources
6054 /home/linux/server/apache-activemq-5.15.9//bin/activemq.jar -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/home/linux/server/apache-activemq-5.15.9//conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/home/linux/server/apache-activemq-5.15.9//tmp -Dactivemq.classpath=/home/linux/server/apache-activemq-5.15.9//conf:/home/linux/server/apache-activemq-5.15.9//../lib/: -Dactivemq.home=/home/linux/server/apache-activemq-5.15.9/ -Dactivemq.base=/home/linux/server/apache-activemq-5.15.9/ -Dactivemq.conf=/home/linux/server/apache-activemq-5.15.9//conf -Dactivemq.data=/home/linux/server/apache-activemq-5.15.9//data
27049 /home/linux/server/broker/nacos/target/nacos-server.jar -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Djava.ext.dirs=/usr/local/jdk1.8.0_131/jre/lib/ext:/usr/local/jdk1.8.0_131/lib/ext:/home/linux/server/broker/nacos/plugins/cmdb:/home/linux/server/broker/nacos/plugins/mysql -Xloggc:/home/linux/server/broker/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dnacos.home=/home/linux/server/broker/nacos -Dloader.path=/home/linux/server/broker/nacos/plugins/health
13132 nb-service.jar -Dloader.path=/home/linux/server/iot/sa/nb/lib,resources
65292 org.apache.rocketmq.namesrv.NamesrvStartup -Xms4g -Xmx4g -Xmn2g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC -verbose:gc -Xloggc:/dev/shm/rmq_srv_gc_%p_%t.log -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m -XX:-OmitStackTraceInFastThrow -XX:-UseLargePages -Djava.ext.dirs=/usr/local/jdk1.8.0_131/jre/lib/ext:/home/linux/server/broker/rocketmq-all-4.7.1-bin-release/bin/../lib:/usr/local/jdk1.8.0_131/lib/ext
21580 org.apache.rocketmq.broker.BrokerStartup -Xms8g -Xmx8g -Xmn4g -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -verbose:gc -Xloggc:/dev/shm/rmq_broker_gc_%p_%t.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch -XX:MaxDirectMemorySize=15g -XX:-UseLargePages -XX:-UseBiasedLocking -Djava.ext.dirs=/usr/local/jdk1.8.0_131/jre/lib/ext:/home/linux/server/broker/rocketmq-all-4.7.1-bin-release/bin/../lib:/usr/local/jdk1.8.0_131/lib/ext
33709 nb-service.jar -Dloader.path=/home/linux/server/iot/sa/nb/lib,resources
10350 iot-service-1.0.1-SNAPSHOT.jar -Dloader.path=lib,resources
51216 mqtt-iot-events-1.0.0-SNAPSHOT.jar -Dloader.path=lib,resources
49363 iot-service-1.0.1-SNAPSHOT.jar -Dloader.path=lib,resources
31541 org.apache.catalina.startup.Bootstrap -Djava.util.logging.config.file=/home/linux/server/apache-tomcat-8.0.46/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Djava.endorsed.dirs=/home/linux/server/apache-tomcat-8.0.46/endorsed -Dcatalina.base=/home/linux/server/apache-tomcat-8.0.46 -Dcatalina.home=/home/linux/server/apache-tomcat-8.0.46 -Djava.io.tmpdir=/home/linux/server/apache-tomcat-8.0.46/temp
58230 web-app-1.0.0-SNAPSHOT.jar -Dloader.path=lib,resources
60855 iot-service-1.0.1-SNAPSHOT.jar -Dloader.path=lib,resources
49881 iot-service-1.0.1-SNAPSHOT.jar -Dloader.path=lib,resources
23611 mqtt-iot-events-1.0.0-SNAPSHOT.jar -Dloader.path=lib,resources
40731 iot-data-api-1.0.0-SNAPSHOT.jar -Dloader.path=lib,resources
8059 iot-service-1.0.1-SNAPSHOT.jar -Dloader.path=lib,resources
56221 sun.tools.jps.Jps -Dapplication.home=/usr/local/jdk1.8.0_131 -Xms8m
62078 course-service-1.0.0-SNAPSHOT.jar -Dloader.path=lib,resources
放到一块对比
按内存占用排序,前面的基本都是java程序
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
21580 linux 20 0 39.6g 9.6g 939m S 4 7.6 390:14.47 java rocketmq broker
43396 linux 20 0 47.8g 7.3g 13m S 1 5.8 39:23.59 java iot-service
3536 root 20 0 47.6g 7.3g 21m S 0 5.8 159:21.07 java
8059 linux 20 0 43.9g 5.6g 13m S 2 4.4 335:45.68 java iot-service
60855 linux 20 0 48.1g 5.4g 13m S 5 4.3 776:22.93 java iot-service
49363 linux 20 0 44.0g 5.3g 13m S 3 4.2 363:15.97 java iot-service
33709 linux 20 0 44.6g 5.2g 14m S 3 4.1 146:14.72 java nb-service
40731 linux 20 0 39.1g 4.8g 13m S 2 3.8 115:03.77 java iot-data-api
10350 linux 20 0 43.7g 4.5g 13m S 4 3.6 541:26.19 java iot-service
31541 linux 20 0 40.0g 4.3g 13m S 0 3.4 391:47.35 java
49881 linux 20 0 43.7g 4.3g 13m S 3 3.4 364:21.04 java iot-service
62446 gitlab-r 20 0 5177m 3.4g 19m S 1 2.7 81382:38 mongod
13132 linux 20 0 39.9g 3.1g 13m S 0 2.5 85:37.12 java nb-service
58230 linux 20 0 39.2g 2.8g 13m S 0 2.2 9:28.36 java
23611 linux 20 0 49.0g 2.0g 13m S 1 1.6 117:55.32 java
5856 root 20 0 26.6g 1.8g 21m S 1 1.5 850:12.61 java
65292 linux 20 0 9156m 1.8g 14m S 0 1.4 19:28.69 java rocketmq.namesrv.NamesrvStartup
62078 linux 20 0 39.9g 1.4g 13m S 0 1.1 2766:13 java
51216 linux 20 0 37.6g 1.4g 13m S 0 1.1 18:42.22 java
6054 linux 20 0 10.5g 1.2g 16m S 3311 0.9 17708:07 java
iot-service我只启动了一个实例,为什么会有这么多进程呢?有43396、8059、60855、49363、10350、49881多个进程id,并且每个都有占用较大内存。
脚本问题?也不太可能。重启脚本是根据端口占用将当前端口占用的进程关了,然后再用当前端口配置启动当前程序;如果端口占用的进程没有被关掉,那么就会提示端口占用。
现在应该是端口释放了,但是进程不知道怎么还在
准备关闭一个进程,对比关闭之前和关闭之后的内存对比情况
linux@server02:~$ free -m
total used free shared buffers cached
Mem: 128914 128105 808 0 1705 32882
-/+ buffers/cache: 93518 35396
Swap: 131043 133 130910
linux@server02:~$ kill -9 8059
linux@server02:~$ free -m
total used free shared buffers cached
Mem: 128914 122439 6475 0 1705 32882
-/+ buffers/cache: 87851 41062
Swap: 131043 133 130910
发现,这个进程关了,内存释放了几个gb。当前服务接口可以正常访问。