[Java] Download large files with Apache JMeter

2 minute read

Thing you want to do

I want to do a load test like downloading a large file with JMeter.
(This is the content of the survey because there was a request to perform a load test of file download using Azure CDN)

Things to prepare

It is important to meet the following conditions

–Install the 64-bit version of Java
–Increase heap size with JVM runtime options
–Equipped with real memory that can sufficiently expand the heap size
–Use the 64-bit version of the JVM
–Run in CUI mode

What to do for each

Install the 64-bit version of Java

Download and install the 64-bit version of the Java installer from the official Java website.
The procedure is manual installation, referring to the document on the following site.


Use the & 64bit version of the JVM to increase the heap size with JVM runtime options

Open jmeter.bat in the JMeter installation directory with a text editor and change the following parts as appropriate.
In the settings below, the heap size is expanded to 16GB and a 64-bit JVM is used.


set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m


set HEAP=-Xms1g -Xmx16g -XX:MaxMetaspaceSize=256m -d64

Equipped with real memory that can sufficiently expand the heap size

If it’s a physical machine, it’s up to you, and if it’s a virtual machine, it’s better to choose one with memory larger than the heap size.

For example, if it is an Azure VM, I think that the E series etc. will have a large amount of installed memory and will be a size that is easy to use.

Run in CUI mode

When you start JMeter, you should get the following message when you start it with GUI.

Don't use GUI mode for load testing !, only for Test creation and Test debugging.
For load testing, use CLI Mode (was NON GUI):
   jmeter -n -t [jmx file] -l [results file] -e -o [Path to web report folder]

After generating the jmx file with the GUI, let’s start JMeter from the console again.


If the above conditions are met, I think it will be easier for JMeter to perform load tests such as downloading large files. (However, it depends on the amount of memory that can be allocated to the heap, so I’m sorry if it doesn’t work.)

Errors that occur when the conditions are not met (for search)

Insufficient JVM heap size

java.lang.OutOfMemoryError: Java heap space

64-bit Java is not set up

Error: This Java instance does not support a 64-bit JVM.
Please install the desired version.