如何让JMeter请求压缩后的内容? [英] How to get JMeter to request gzipped content?
问题描述
我的网站提供压缩的内容.我使用Firebug和YSlow进行了验证.但是,JMeter不请求压缩的内容.因此,它将获取所有未压缩的内容.结果,我的测试用例比实际花费的时间要长得多(6-10倍).
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.
如何使JMeter从网站请求压缩的内容?
How can I make JMeter request gzipped content from a website?
仅供参考,我使用的是最新的稳定版:JMeter 2.3.4 r785646.
FYI, I am using the latest stable build: JMeter 2.3.4 r785646.
推荐答案
添加名称/值对:
- 名称:
Accept-Encoding
- 值:
gzip,deflate,sdch
- Name:
Accept-Encoding
- Value:
gzip,deflate,sdch
这将确保所有JMeter请求都使用HTTP压缩.
This will ensure that all JMeter requests use HTTP compression.
要验证:
- 将此侦听器添加到线程组:
View the Results Tree
- 运行测试计划
- 查看其中一个网页的
Sampler result
标签.
- Add this Listener to the Thread Group:
View the Results Tree
- Run your test plan
- 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
如果是,那么您已经在JMeter中成功设置了gzip请求.恭喜你!
If yes, then you've successfully setup gzip requests in JMeter. Congrats.
另一种验证方法是在Summary Report
统计信息中:
Another way to verify is in the Summary Report
stats:
您将看到Avg Bytes
值是未压缩的大小.没关系.无论出于何种原因,JMeter都是这样工作的.请注意KB/sec
列.启用gzip后,显示效果将提高6-10倍.
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.
这篇关于如何让JMeter请求压缩后的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!