My website serves gzipped content. I verified with Firebug and YSlow. However, JMeter does not request the gzipped content. Therefore, it gets all uncompressed content. As a result, my test cases take much longer (6-10x longer) than they do in reality.
How can I make JMeter request gzipped content from a website?
FYI, I am using the latest stable build: JMeter 2.3.4 r785646.
You can tell using Developer Tools (F12). Go to the Network tab, select the file you want to examine and then look at the Headers tab on the right. If you are gzipped, then you will see that in the Content-Encoding.
Content encoding This is the character encoding to be used, and is not related to the Content-Encoding HTTP header. So the blank value is normal given you are recording HTTP GET requests.
Gzip (GNU zip) is a free and open source algorithm for file compression. The software is overseen by the GNU project. In this context, compression is the deliberate reduction in size of data to save storage space or increase the data transfer rate.
Add an HTTP Header Manager to the Thread Group in your Test Plan.
Add the name-value pair:
Accept-Encoding
gzip,deflate,sdch
This will ensure that all JMeter requests use HTTP compression.
To verify:
View the Results Tree
Sampler result
tab for one of the webpages.Do you see these name-value pairs?
Content-Encoding: gzip Vary: Accept-Encoding Transfer-Encoding: chunked
If yes, then you've successfully setup gzip requests in JMeter. Congrats.
Another way to verify is in the Summary Report
stats:
You'll see that the Avg Bytes
values are the uncompressed sizes. That's OK. For whatever reason, that's how JMeter works. Pay attention to the KB/sec
column. That will show an improvement of 6-10x with gzip enabled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With