如何让JMeter请求压缩后的内容? [英] How to get JMeter to request gzipped content?

查看:545
本文介绍了如何让JMeter请求压缩后的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站提供压缩的内容.我使用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.

要验证:

  1. 将此侦听器添加到线程组:View the Results Tree
  2. 运行测试计划
  3. 查看其中一个网页的Sampler result标签.
  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

如果是,那么您已经在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆