首页 > 编程语言 > 详细

jmeter压测报错 — java.lang.OutOfMemoryError: Java heap space

时间:2020-05-20 23:39:19      阅读:626      评论:0      收藏:0      [点我收藏+]

在Linux服务器上使用JMeter进行压力测试时遇到报错

java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid21100.hprof ...
Heap dump file created [1165614889 bytes in 55.695 secs]

查询官方手册

To run JMeter, run the jmeter.bat (for Windows) or jmeter (for Unix) file

for windows:

jmeter.bat - run JMeter (in GUI mode by default)

jmeter-n.cmd - drop a JMX file on this to run a non-GUI test jmeter-n-r.cmd - drop a JMX file on this to run a non-GUI test remotely jmeter-t.cmd - drop a JMX file on this to load it in GUI mode jmeter-server.bat - start JMeter in server mode mirror-server.cmd - runs the JMeter Mirror Server in non-GUI mode shutdown.cmd - Run the Shutdown client to stop a non-GUI instance gracefully stoptest.cmd - Run the Shutdown client to stop a non-GUI instance abruptly
for linux:

jmeter - run JMeter (in GUI mode by default). Defines some JVM settings which may not work for all JVMs.

jmeter-server - start JMeter in server mode (calls jmeter script with appropriate parameters) jmeter.sh - very basic JMeter script with no JVM options specified. mirror-server.sh - runs the JMeter Mirror Server in non-GUI mode shutdown.sh - Run the Shutdown client to stop a non-GUI instance gracefully stoptest.sh - Run the Shutdown client to stop a non-GUI instance abruptly

修改:

windows编辑jmeter.bat,修改set HEAP的值

set JVM_ARGS="-Xms1024m -Xmx1024m "

解释一下各个参数:

-Xms1024M:初始化堆内存大小(注意,不加M的话单位是KB)

-Xmx1024M:最大堆内存大小

 

linux可以这样写:JVM_ARGS="-Xms1024m -Xmx1024m"  (JVM_ARGS代表启动JMeter时要使用的Java选项。这些将最后添加到java命令),以下是举例

JVM_ARGS="-Xms4g -Xmx4g -XX:MaxMetaspaceSize=1g"

-XX:MaxPermSize=256M:最大类加载内存池大小

重启jmeter生效

user guide原文地址:https://jmeter.apache.org/usermanual/get-started.html

 

jmeter压测报错 — java.lang.OutOfMemoryError: Java heap space

原文:https://www.cnblogs.com/mingfan/p/12927121.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!