Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
650 views
in Technique[技术] by (71.8m points)

gzip - How to get JMeter to request gzipped content?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...