天天看點

jmeter壓測學習10-linux上執行遇到的問題 There is insufficient memory for the Java Runtime Environment to continue.

前言

在 linux 上執行jmeter 代碼的時候遇到一個問題:There is insufficient memory for the Java Runtime Environment to continue.

報錯内容

在 windows 先執行過 get_info.jmx,正常運作,傳到 linux 上運作時遇到以下問題

[root@VM_0_2_centos ~]# jmeter -n -t get_info.jmx -l get.jtl
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /root/hs_err_pid25736.log      

從報錯可以應該是記憶體不夠用了,free -m 檢視記憶體

[root@VM_0_2_centos ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           3789        3295         152          12         341         179
Swap:          2047        2047           0      

解決辦法

[root@VM_0_2_centos easymock]# free -m
              total        used        free      shared  buff/cache   available
Mem:           3789        2390         875          12         524        1084
Swap:          2047        1478         569      
[root@VM_0_2_centos ~]# jmeter -n -t get_info.jmx -l get.jtl
Creating summariserCreated the tree successfully using get_info.jmx
Starting the test @ Sat May 30 17:01:31 CST 2020 (1590829291939)
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
summary +      1 in 00:00:00 =    2.8/s Avg:   107 Min:   107 Max:   107 Err:     0 (0.00%) Active: 1 Started: 1 Finished: 0
summary +    299 in 00:00:03 =   86.8/s Avg:    29 Min:    10 Max:   224 Err:     0 (0.00%) Active: 0 Started: 3 Finished: 3
summary =    300 in 00:00:04 =   79.0/s Avg:    30 Min:    10 Max:   224 Err:     0 (0.00%)
Tidying up ...    @ Sat May 30 17:01:36 CST 2020 (1590829296290)
... end of run      

繼續閱讀