Dropping ResponseBody bytes

Using Gatling 3.4.0 (latest) and trying to test a concurrent HTTP GET retrieving part of a large binary file (via Range request headers). I want to test 500+ concurrent requests for 1/10/100MB segments, but tests over 1MB segment size fail with OutOfMemory / Netty cannot allocate direct memory errors.

Looking through the Gatling code it appears to be caused by the way Gatling builds up the Response and ResponseBody objects, and even though I never want to introspect the response body bytes they are kept for the life of the request/response pair (and thrown away after checks etc by GC). It seems like ‘transformResponse’ exists to help customise the Response and ResponseBody and could help, but in this case that is too late as the tests run out of memory just building up the Response itself before ‘transform…’ is called.

I’m looking for an options/configuration to disable this behaviour, effectively tell Gatling “throw away the response body bytes when received for this request”, does such an option exist? Without it it seems like i’m stuck having to use some other framework for tests that result in large binary responses vs tests that receive smaller payloads.

No, Gatling only buffers the change chunks in memory if necessary:

https://github.com/gatling/gatling/blob/master/gatling-http/src/main/scala/io/gatling/http/engine/GatlingHttpListener.scala#L140

• if resources inferring is enabled and content-type is HTML
• if you’re explicitly doing something with the response body (checks, tranformers, debug): https://github.com/gatling/gatling/blob/738c10621833f23b43ce6030df54566134a8ac94/gatling-http/src/main/scala/io/gatling/http/request/builder/HttpRequestBuilder.scala#L170

Ok thats good news, must be something in my particular setup then. I did have http debugging on but turned it off I thought.

I’ll step through with the debugger and triple check those flags. Thanks!

Ah ok i’m bumping into this - https://github.com/gatling/gatling/issues/3783

Can’t make parallel resources without using .resources() and using .resources() causes http response body processing it seems.

Sorry, I don’t see how this is related to the title/topic of this thread.

I’ve been trying to find why gatling is keeping the response body chunks, and I thought it was because of .resources() and thus the issue, but apparently not… i’ll keep digging