34

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.

Bill Paetzke
  • 13,332
  • 6
  • 44
  • 46

1 Answers1

61

Add an HTTP Header Manager to the Thread Group in your Test Plan.

Add the name-value pair:

  • Name: Accept-Encoding
  • Value: gzip,deflate,sdch

This will ensure that all JMeter requests use HTTP compression.

To verify:

  1. Add this Listener to the Thread Group: View the Results Tree
  2. Run your test plan
  3. View the 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.

Bill Paetzke
  • 13,332
  • 6
  • 44
  • 46
  • 12
    @Cody, yeah. I asked the question four hours ago, and didn't know the answer. Then figured it out three hours later. Regardless, there is no shame in answering your own question. The answer is a benefit to the community. – Bill Paetzke May 25 '10 at 02:27
  • 1
    @Cody -- the problem with Apache software (like JMeter) is that they rely on mailing lists for Q&A. Hence, I wasn't surprised that no one answered my question on StackOverflow--they're not looking here. – Bill Paetzke May 25 '10 at 02:31
  • @Cody -- I also had the same problem with Lucene search (another Apache software). I [asked a good question](http://stackoverflow.com/questions/2707055/how-to-setup-lucene-solr-for-a-b2b-web-app) and one person responded on SO. I ended up mailing their list, and directed ppl to my SO question. But they refused to answer on SO. I copied the best answer from the list to my question (and cited the person). – Bill Paetzke May 25 '10 at 02:34
  • 1
    @Cody -- I mean, I don't know what to do about those Apache user mailing lists. I wish they would use StackOverflow for user Q&A. – Bill Paetzke May 25 '10 at 02:34