How to get response size in JMeter?

Problem Statement

Developer need each response size for their analysis purpose. Though the feature is available in JMeter, but by default, it is not enabled. In this article we will see how to get response size in JMeter and write it to the CSV file.

Solution

Go to JMETER_FOLDER\bin, and open jmeter.properties file in your favorite editor. Now, search for below properties:

#sampleresult.getbytes.body_real_size=true

#sampleresult.getbytes.headers_size=true

Uncomment above two lines by removing the hash symbol (#), and save the properties file.

Launch JMeter and execute your test plan. Make sure that you have added Simple Data Writer sampler to your test plan and it should be configured as shown below. Save byte count should be checked.

Save Byte Count
Save Byte Count

Once the execution is successful, navigate to JMETER_FOLDER\bin, and open the file name which you had configured in Simple Data Writer in your favorite editor. You could see the size count of the response.

Also, in View Results Tree, you can see the below parameters as well.

Size in bytes: 10094

Headers size in bytes: 1071

Body size in bytes: 9023

Another way is by adding Save responses to a file, sampler. I do not prefer this method, the reason is, for larger load, it will cause memory issues, since JMeter will create a new file for each request and response. If the response size is larger, it will impact the performance of JMeter and the disk will get clogged.

Once a week we send a digest with the most popular articles.

About NaveenKumar Namachivayam

Hi there! is a passionate and experienced Performance Test Analyst based in Chicago, IL, USA with the skill sets in Manual Testing, Test Automation, Performance Testing, and Web Services. He loves to learn and experiment new trends and models in Software Testing. Please stop by at his personal blogs: NaveenKumarN.in, PerfTractor and Giftt

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.