gpt4 book ai didi

java - jmeter下载1.5g文件内存不足异常

转载 作者:行者123 更新时间:2023-11-30 10:19:48 24 4
gpt4 key购买 nike

我正在从命令行运行 jmx

JVM_ARGS="-Xms2048m -Xmx4096m -XX:4096ize=4096m -XX:MaxNewSize=4096m"  && export JVM_ARGS && ./jmeter.sh -n -t ./jmeter-ec2.jmx -l ./scriptresults.jtl 

但在某些时候,在转到 jmeter.log 之后,我遇到了内存不足的错误我发现了这个错误

ERROR o.a.j.JMeter: Uncaught exception: java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:3236) ~[?:1.8.0_91] at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118) ~[?:1.8.0_91] at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93) ~[?:1.8.0_91] at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153) ~[?:1.8.0_91] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.readResponse(HTTPSamplerBase.java:1833) ~[ApacheJMeter_http.jar:3.3 r1808647] at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.readResponse(HTTPAbstractImpl.java:440) ~[ApacheJMeter_http.jar:3.3 r1808647] at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:474) ~[ApacheJMeter_http.jar:3.3 r1808647] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74) ~[ApacheJMeter_http.jar:3.3 r1808647] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1189) ~[ApacheJMeter_http.jar:3.3 r1808647] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1178) ~[ApacheJMeter_http.jar:3.3 r1808647] at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:498) ~[ApacheJMeter_core.jar:3.3 r1808647] at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:424) ~[ApacheJMeter_core.jar:3.3 r1808647] at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:255) ~[ApacheJMeter_core.jar:3.3 r1808647] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91] 2018-01-26 02:03:55,731 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test 2018-01-26 02:03:55,732 INFO o.a.j.r.Summariser: summary = 0 in 00:00:00 = ******/s Avg: 0 Min: 9223372036854775807 Max: -9223372036854775808 Err: 0 (0.00%)

我在这里做错了什么?我无法解决它:(

最佳答案

您的 JVM 参数是错误的,只需保留:

-Xms2048m -Xmx4096m

您不知道发生了多少线程,也不知道您是在 GUI 还是非 GUI 模式下运行,所以:

  1. 不要在 GUI 模式下运行,这是一种反模式
  2. 确保您有足够的内存用于您的线程

最后,您可以通过在 user.properties 中进行调整来减少大响应对内存的影响:

httpsampler.max_bytes_to_store_per_request

另一种选择是通过在 http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request 中设置它来仅根据您的响应计算 HASH :

HTTP Request Advanced panel

关于java - jmeter下载1.5g文件内存不足异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48454182/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com