访问日志重放以进行负载测试? Jmeter 的陷阱和竞争对手
上下文
我们希望使用“重放”Web 服务器访问日志来生成负载测试。 JMeter 出现在我的脑海中,因为我最近阅读了有关在云中使用 jmeter 的博客文章(例如,启动多个 Amazon EC2 实例来生成负载)。
多年来,我一直听说 JMeter 能够重播访问日志,但在回顾时这个功能我发现如下。
作用:
- 重新创建会话,即处理
jsessionId
令牌(认为它尝试通过 IP 地址来近似会话);
- 重新创建会话,即处理
不:
- 处理 POST 数据(即使您可以配置 apache/tomcat 将 post 数据写入访问日志,jmeter 访问日志采样器也仅处理“常见”日志格式)。
发布数据对于重建实际负载大有帮助。
此外,文档将访问日志采样器描述为“alpha 代码”,尽管它已经有 8 年历史了。它似乎没有积极维护。 (这比 Gmail 的测试版还要长。)
HttpPerf
另一篇博客文章向我介绍了 httpperf 工具。我已经开始阅读它:
- 博客:http://www .igvita.com/2008/09/30/load-testing-with-log-replay/
- httpperf:http: //code.google.com/p/httperf/
摘要
- 从真实用户数据生成负载测试“脚本”的最佳方法是什么?
- 什么对你最有效?
- 各种工具的优缺点?
Context
We wish to use "replay" web server access logs to generate load tests. JMeter had come to mind as I'd recently read blog posts about using jmeter in the cloud (e.g. firing up a number of Amazon EC2 instances to generate the load)
For years I had heard of JMeter's ability to replay access logs, but in reviewing this feature I found the following.
DOES:
- recreate sessions, i.e. handle the
jsessionId
token (thought it tries to approximate sessions by IP address);
- recreate sessions, i.e. handle the
DOES NOT:
- handle POST data (even if you could configure apache/tomcat to write out post data to the access log, jmeter access log sampler only handles 'common' log format).
Post data would go a long way toward recreating actual load.
Additionally, the documentation describes the Access Log Sampler as "alpha code" even though it's 8 years old. It doesn't seem actively maintained. (That's longer than Gmail's beta.)
HttpPerf
Another blog post pointed me to the httpperf tool. I've started to read up on it:
- blog: http://www.igvita.com/2008/09/30/load-testing-with-log-replay/
- httpperf: http://code.google.com/p/httperf/
Summary
- What's the best way to generate load testing 'scripts' from real user data?
- What has worked best for you?
- Pros and cons of various tools?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
JMeter + HTTP 原始请求 + 原始数据源对我来说效果很好
JMeter + HTTP Raw Request + Raw Data Source for me works well
我将描述如何使用我们自己的 LT 工具 Yandex Tank 来解决这个问题
它可以处理简单的 access.log,但也只能处理“GET”请求。当需要发出其他类型的请求时,我们使用其他弹药格式(弹药是包含我们要发送到服务器的所有请求的文件)。示例:
第一行的数字(“342”)是后续请求的大小。请求采用原始格式。您可以用您最喜欢的语言编写一个简单的脚本,从 access.log 生成此类弹药文件,然后将其用于负载测试。
这种弹药格式使其非常灵活。例如,此代码从 FCGI 日志生成弹药(POST 主体以 Base64 编码)。但另一方面,您需要手动处理会话。
I will describe how do we solve this problem using our own LT tool called Yandex Tank
It can handle simple access.log but only 'GET' requests, too. When there's a need to make other types of requests, we use other ammo formats (ammo is a file containing all the requests that we gonna send to our server). Example:
A number ('342') on the first line is the size of a following request. Request is in it's raw format. You could write a simple script in your favourite language that generates such ammo files from your access.log and then use it for load testing.
Such ammo format makes it really flexible. For example, this code generates ammo from FCGI logs (POST bodies are encoded in Base64). But on the other hand you will need to handle sessions manually.
您可以使用 ZebraTester 轻松重播访问日志和 POST 数据。它有许多类似于 JMeter 的插件,并且还能够添加内联脚本,使用这些脚本您可以轻松地从访问日志中定位 POST 有效负载、URL、时间戳等。您可以直接从本地工具运行负载测试,或将录制的脚本复制到 SaaS 门户 运行海量百万虚拟用户负载测试
You can easily replay access logs with POST data using ZebraTester. It has many plugins similar to JMeter and also ability to add inline scripts using which you can easily target POST payload, URLs, timestamps, etc. from the access logs. You can run load tests directly from the tool locally or copy the recorded script to the SaaS portal to run massive million virtual user load tests