shaharnakash
shaharnakash

Reputation: 675

jmeter download 1.5g file out of memory exception

I'M running jmx from command line

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

but on some point I got out of memory error , after going to jmeter.log I found this error

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%)

what I"M doing wrong here ? I cant solve it:(

Upvotes: 2

Views: 1899

Answers (2)

Dmitri T
Dmitri T

Reputation: 168002

Well, given you have 1.5 GB file you will be able to have not more than 3 virtual users which doesn't look like a "load test" to me.

If you are not interested in downloaded file's content and just want to stress your server you can consider switching to JSR223 Sampler which will send request and discard the response data using underlying Apache HttpComponents libraries methods, the relevant Groovy code would be something like:

import org.apache.http.client.methods.HttpGet
import org.apache.http.impl.client.HttpClientBuilder
import org.apache.http.util.EntityUtils

def client = HttpClientBuilder.create().build()
def get = new HttpGet('http://example.com')
def response = client.execute(get)
EntityUtils.consume(response.getEntity())

References:

Upvotes: 0

UBIK LOAD PACK
UBIK LOAD PACK

Reputation: 34526

Your JVM arguments are wrong, just keep:

-Xms2048m -Xmx4096m

You don't tell with how much threads this occurs nor if you're running in GUI or NON GUI mode, so:

  1. Don't run in GUI mode, it's an anti-pattern
  2. Ensure you have enough memory for your threads

Finally you can reduce the memory impact of big response by adapting this in user.properties:

httpsampler.max_bytes_to_store_per_request

And another option is to only compute HASH from your response by setting this in http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request:

HTTP Request Advanced panel

Upvotes: 1

Related Questions