new*_*Bee 5 memory ubuntu jmeter
我正在尝试为应用程序运行负载测试.为此,我在Ubuntu Vm上使用JMeter(v.2.13),具有60GB Ram和足够的CPU功率.目标是通过WebSocket连接10k用户.
但是在测试运行期间,我在ssh-console上遇到以下错误(大约1.5k到2.5k模拟用户)
OpenJDK 64-Bit Server VM warning: Attempt to protect stack guard pages failed.
OpenJDK 64-Bit Server VM warning: Attempt to deallocate stack guard pages failed.
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f20ee653000, 12288, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 12288 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /jmetertests/jm/bin/hs_err_pid1833.log
OpenJDK 64-Bit Server VM warning: Attempt to deallocate stack guard pages failed.
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f2218de8000, 12288, 0) failed; error='Cannot allocate memory' (errno=12)
Run Code Online (Sandbox Code Playgroud)
提到的错误报告文件如下所示
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 12288 bytes for committing reserved memory.
# Possible reasons:
# The system is out of physical RAM or swap space
# In 32 bit mode, the process size limit was hit
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Use 64 bit Java on a 64 bit OS
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
# Out of Memory Error (os_linux.cpp:2798), pid=1833, tid=140472285792000
#
# JRE version: OpenJDK Runtime Environment (7.0_75-b13) (build 1.7.0_75-b13)
# Java VM: OpenJDK 64-Bit Server VM (24.75-b04 mixed mode linux-amd64 )
# Derivative: IcedTea 2.5.4
# Distribution: Ubuntu 14.04 LTS, package 7u75-2.5.4-1~trusty1
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
Run Code Online (Sandbox Code Playgroud)
我尝试通过在.sh文件中发出java命令之前添加以下行来修改jmeter.sh来分配更多内存:
JVM_ARGS="-Xms5g -Xmx20g -Xss300k"
Run Code Online (Sandbox Code Playgroud)
我还尝试_JAVA_OPTIONS使用以下命令设置环境变量
export _JAVA_OPTIONS="-Xms5g -Xmx20g"
Run Code Online (Sandbox Code Playgroud)
最后我发现这个命令是一些SO线程
sysctl -w vm.max_map_count=500000
Run Code Online (Sandbox Code Playgroud)
该top-Command让我记忆以下信息
KiB Mem: 61836576 total, 15163400 used, 46673176 free, 10636 buffers
KiB Swap: 0 total, 0 used, 0 free. 94492 cached Mem
Run Code Online (Sandbox Code Playgroud)
仅供参考:除了简单的数据编写器,我不会在JMeter中使用任何监听器.但是,即使禁用最后一个侦听器,也会抛出错误.
java -Xms40g -version
Run Code Online (Sandbox Code Playgroud)
是成功的 - 所以我真的可以分配这么多的记忆
我通过使用减少了堆栈大小
-Xss300k
Run Code Online (Sandbox Code Playgroud)
这有助于至少改变一些东西,因为我现在得到了一个
Uncaught Exception java.lang.OutOfMemoryError:
unable to create new native thread. See log file for details.
Run Code Online (Sandbox Code Playgroud)
错误.似乎系统上的线程数已经耗尽?
根据某些用户的要求,结果为uf ulimit -a
core file size (blocks, -c) 0
scheduling priority (-e) 0
pending signals (-i) 491456
max locked memory (kbytes, -l) 64
open files (-n) 500000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
max user processes (-u) 491456
... all other entries are set to 'unlimited'
Run Code Online (Sandbox Code Playgroud)
limits.conf包含以下条目
* hard nofile 900000
* soft nofile 900000
root hard nofile 900000
root soft nofile 900000
Run Code Online (Sandbox Code Playgroud)
Additonally我有设定threads-max下proc/sys/kernel的东西荒谬高,也增加的价值proc/sys/vm/max_map_count
我错过了什么或者我做错了什么吗?谢谢您的帮助.
好的,同时我想通了:
limits.conf(见下文)/etc/security/limits.conf
* hard nofile 900000
* soft nofile 900000
root hard nofile 900000
root soft nofile 900000
Run Code Online (Sandbox Code Playgroud)
/etc/sysctl.conf
kernel.pid_max=999999
kernel.thread-max=999999
vm.max_map_count=999999
fs.file-max=999999
Run Code Online (Sandbox Code Playgroud)
注意:pid _ max 和 thread-max
您将在/bin/jmeter 安装的文件夹中找到它们。
在linux下添加行
JVM_ARGS="-Xmx15g -Xss250k"
Run Code Online (Sandbox Code Playgroud)
在最后一行实际 java 调用之前的某个地方。这将减少为每个线程分配的堆栈大小。
在windows下你必须编辑jmeter.bat。我没有在 Windows 下配置它,但至少关于堆应该有一行以set HEAP. 我不知道-Xss在windows下把参数放在哪里。
| 归档时间: |
|
| 查看次数: |
8104 次 |
| 最近记录: |