Search code examples
jmeterout-of-memory

JMeter - handle large responses


I am testing REST API, each of which returns a 10 MB response body. Now during load test, JMeter gives Out of Memory exception at 20 threads.

Concluded that this is due to APIs have huge response body. When other APIs with fairly low size Response Body are tested I am able to scale up to 500 Threads

Have tried all options shared under hacks to avoid Out of Memory exception:

  1. Running in Non GUI mode
  2. All Listeners Off - generating JTL from command line
  3. Disabled all assertions, relying on application logs
  4. Groovy used as scripting language in JSR223, using to emulate Pacing between requests
  5. Heap Size increased to 12 GB
  6. JMeter 5.4.1 and JDK used

Going for distributed load testing from multiple JMeter host machines also seems to have problem, as when I reduced No. of Threads to 10 for same APIs, Out of Memory Exception still came up.

How to effectively handle huge response body to a request made from JMeter ?


Solution

  • If you don't need to read or assert the response then you can reduce disk space usage, check Save response as MD5 hash in your HTTP Request Advanced tab

    Save response as MD5 hash? If this is selected, then the response is not stored in the sample result. Instead, the 32 character MD5 hash of the data is calculated and stored instead. This is intended for testing large amounts of data.