0

My question is: There is a huge difference between the memory usage viewed through the Linux system command and the total usage of each area of the java memory, and which area is using the memory.

version:

java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

rocketMq version : 4.5.1

CentOS Linux release 7.4.1708 (Core)

ps aux|grep java :

root 1408 4.4 60.7 33395552 19596884 ? Sl Mar22 7734:05 /bin/java -server -Xms1g -Xmx2g -Xmn1g -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -verbose:gc -Xloggc:/dev/shm/mq_gc_%p.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=/jre/lib/ext:/data/mq/rocketmq-all-4.5.1-bin-release/bin/../lib -cp .:/data/mq/rocketmq-all-4.5.1-bin-release/bin/../conf: org.apache.rocketmq.broker.BrokerStartup autoCreateTopicEnable=true -c /data/mq/rocketmq-all-4.5.1-bin-release/conf/2m-noslave/broker-a.properties

Pid: 1408

top :

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

1408 root 20 0 31.848g 0.018t 1.399g S 10.0 60.8 7734:02 java

RES: 0.018t

cat /proc/1408/status |grep Vm :

VmPeak: 37749060 kB
VmSize: 33395552 kB
VmLck:         0 kB
VmPin:         0 kB
VmHWM:  22155452 kB
VmRSS:  19603060 kB
VmData: 27929052 kB
VmStk:       132 kB
VmExe:         4 kB
VmLib:     19900 kB
VmPTE:     43660 kB
VmSwap:        0 kB

VmRSS: 19603060 kB -> ~18G

I use the above system commands to determine that the broker process memory occupies about 18G

The actual heap space allocated to java is up to 2G -Xms1g -Xmx2g -Xmn1g

jstat -gc 1408 :

S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT

0.0 16384.0 0.0 16384.0 1097728.0 98304.0 442368.0 246238.9 79996.0 78497.1 10136.0 9709.5 111588 1343.763 0 0.000 1343.763

OC: 432M S0C + S1C: 32M EC: 1072M MC: 78M CCSC: 9.8M

Then through the arthas tool: View DirectMemory

enter image description here

Direct: 4M Mapped: 5154M

From the above, the memory occupied by java is roughly:

Javaheap + metaspace + thread count(217) * 256k + code cache + direct memory = 2 * 1024 + 78 + 217*256/1024 + 9.8 + 5 = 2194.8

Even if mapped 5154M is included, the java process is only 7348.8 M

There is a huge difference in the proportion of 18G.

What is the 10G+ gap here?

0 Answers0