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
果然 free 内存只有 152 了
解决办法
先清理掉一些不用的进程,释放一些内存出来,再次查看,大于1G,基本上没啥问题了
[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 summariser <summary>
Created 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