Search code examples
jmeterperformance-testing

Does JMeter support sharing memory between threads?


I have a HTTP Request in a Test Plan. I am sending a POST Request with a very large body (10 MB).

I am reading the body data from a file using ${__FileToString(data.json)} and testing it with 300 threads

Running it is giving out of memory error

Each thread is storing the same (10 MB) file in RAM, which is causing the error.

Is it possible to make all the threads access the same copy instead of creating duplicates?


Solution

    1. As of JMeter 5.5 default maximum Java Heap size is 1 GB
    2. You would need 10 * 300 == 3 GB at least so you will need to increase the Java Heap space accordingly. See 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure article for more details.
    3. As of now there is no way to re-use the pointer to the large object between threads, you can consider using HTTP Raw Request sampler instead, it has nice feature of direct streaming of the request body to the backend without loading it into memory first