如何让 JMeter 请求压缩内容? [英] How to get JMeter to request gzipped content?
问题描述
我的网站提供压缩的内容.我用 Firebug 和 YSlow 进行了验证.但是,JMeter 不会请求 gzip 压缩的内容.因此,它获取所有未压缩的内容.因此,我的测试用例比实际花费的时间要长得多(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.
推荐答案
添加HTTP 标头管理器到线程组 在您的测试计划中.
添加名称-值对:
- 名称:
Accept-Encoding
- 值:
gzip,deflate,sdch
这将确保所有 JMeter 请求都使用 HTTP 压缩.
This will ensure that all JMeter requests use HTTP compression.
验证:
- 将此侦听器添加到线程组:
查看结果树
- 运行您的测试计划
- 查看其中一个网页的
Sampler result
标签.
你看到这些名称-值对了吗?
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
stats 中:
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屋!