[JAVA] Download large files with Apache JMeter

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.

https://java.com/ja/download/faq/java_win64bit.xml

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.

before


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

after


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. https://docs.microsoft.com/ja-jp/azure/virtual-machines/ev3-esv3-series

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.

Summary

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.

Recommended Posts

Download large files with Apache JMeter
Convert large XLSX files to CSV with Apache POI
[Java] Handle Excel files with Apache POI
Comfortable download with JAVA
Handle files with NIO.2.
Download Java with Ansible
Load test with JMeter
Download with Spring Boot
[Rails] Create API to download files with Active Storage [S3]
Avoid Zip bomb errors when reading large files with POI
Talk about uploading files using slack API with Apache HttpPost
Repeated sample with Apache Freemarker
Start Apache Solr with Embedded.
Access Apache Kafka with Micronaut
Manipulate Excel with Apache POI
I want to avoid OutOfMemory when outputting large files with POI