码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2020-05-21 00:29:18      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:mpi   lin   meta   lan   EAP   option   cal   perm   rop   

在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

标签:mpi   lin   meta   lan   EAP   option   cal   perm   rop   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!