AB负载测试 [英] ab load testing

查看:156
本文介绍了AB负载测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人请走在我通过我如何可以加载使用阿帕奇板凳工具来测试我的网站<过程/ A>( AB )?

Can someone please walk me through the process of how I can load test my website using apache bench tool (ab)?

我想了解以下内容:

如何每分钟多少人能够现场处理?

请走我走过我应该运行摸不着头脑的命令。

Please walk me through the commands I should run to figure this out.

我想尽教程,他们是令人困惑的。

I tried every tutorial, and they are confusing.

推荐答案

在apache的基准测试工具是很基本的,虽然它会给你一些性能了坚实的思想,这是一个坏主意,仅仅依靠它,如果你打算让你的网站受到严重的压力在生产中。

The apache benchmark tool is very basic, and while it will give you a solid idea of some performance, it is a bad idea to only depend on it if you plan to have your site exposed to serious stress in production.

话虽如此,这里的最常见和最简单的参数:

Having said that, here's the most common and simplest parameters:

-c (并发)。表示有多少客户端(人/用户)将被打,同时该网站。而 AB 运行时,会出现 -c 击中站点的客户端。这究竟是什么决定的压力您的网站将基准期间遭受的金额。

-c: ("Concurrency"). Indicates how many clients (people/users) will be hitting the site at the same time. While ab runs, there will be -c clients hitting the site. This is what actually decides the amount of stress your site will suffer during the benchmark.

-n :表示多次请求将如何进行。这恰恰决定了基准的长度。与您的服务器可以支持 -c 价值高 -n 值是一个好主意,以确保事情不要T打破持续的胁迫下:这是不一样的,支持的压力,持续5秒超过5小时

-n: Indicates how many requests are going to be made. This just decides the length of the benchmark. A high -n value with a -c value that your server can support is a good idea to ensure that things don't break under sustained stress: it's not the same to support stress for 5 seconds than for 5 hours.

-k :这确实了的KeepAlive的funcionality浏览器本性行。你并不需要通过对 -k 的值,因为它是布尔(意为:它表明你希望你的测试使用的Keep Alive头从HTTP并维持连接)。因为浏览器做到这一点,你可能要模拟的压力和流量,你的网站将有来自浏览器的,建议你做一个标杆与此有关。

-k: This does the "KeepAlive" funcionality browsers do by nature. You don't need to pass a value for -k as it it "boolean" (meaning: it indicates that you desire for your test to use the Keep Alive header from HTTP and sustain the connection). Since browsers do this and you're likely to want to simulate the stress and flow that your site will have from browsers, it is recommended you do a benchmark with this.

最后一个参数是简单的主机。默认情况下它会打的http://协议,如果你不指定它

The final argument is simply the host. By default it will hit http:// protocol if you don't specify it.

ab -k -c 350 -n 20000 example.com/

通过发出上面的命令中,你会被击中 http://example.com/ 与350同时连接至20000的要求得到满足。它将使用永葆头完成。

By issuing the command above, you will be hitting http://example.com/ with 350 simultaneous connections until 20 thousand requests are met. It will be done using the keep alive header.

在这个过程完成了20000请求,您将收到的统计反馈。这将告诉你如何在压力下进行的网站,你使用上面的参数时所说的那样。

After the process finishes the 20 thousand requests, you will receive feedback on stats. This will tell you how well the site performed under the stress you put it when using the parameters above.

有关找出有多少人该网站可以在同一时间处理,只是看响应时间(平均值,最小值和最大值的响应时间,失败的请求等)都是数字你的网站可以接受(不同的网站可能希望不同速度)。直到你打,你说:如果我增加它,它开始变得失败的请求和它打破了点,你可以运行不同的-c值的工具。

For finding out how many people the site can handle at the same time, just see if the response times (means, min and max response times, failed requests, etc) are numbers your site can accept (different sites might desire different speeds). You can run the tool with different -c values until you hit the spot where you say "If I increase it, it starts to get failed requests and it breaks".

根据你的网站,你会期待每分钟的请求的平均数。这种变化这么多,你将无法与AB来模拟这一点。但是,想想这样说:如果你的用户平均会被打每分钟5请求,你找到有效的是2秒的平均响应时间,这意味着有10秒一分钟1用户将在需求,才有意义的时间的1/6将被击中部位。这也意味着,如果你有6个用户同时击中AB的网站,你可能在模拟用户36,即使你的并发级别(-c)只有6。

Depending on your website, you will expect an average number of requests per minute. This varies so much, you won't be able to simulate this with ab. However, think about it this way: If your average user will be hitting 5 requests per minute and the average response time that you find valid is 2 seconds, that means that 10 seconds out of a minute 1 user will be on requests, meaning only 1/6 of the time it will be hitting the site. This also means that if you have 6 users hitting the site with ab simultaneously, you are likely to have 36 users in simulation, even though your concurrency level (-c) is only 6.

这取决于您使用该网站用户期望的行为,但你可以从我希望我的用户打每分钟点¯x请求,我认为,平均响应时间有效的,如果它是2秒。然后,只需修改-c水平,直到你打2秒的平均响应时间(但要确保最大响应时间和STDDEV仍然是有效的),看看你能有多大使-c。

This depends on the behavior you expect from your users using the site, but you can get it from "I expect my user to hit X requests per minute and I consider an average response time valid if it is 2 seconds". Then just modify your -c level until you are hitting 2 seconds of average response time (but make sure the max response time and stddev is still valid) and see how big you can make -c.

我希望我解释这个明确的:)祝你好运。

I hope I explained this clear :) Good luck

这篇关于AB负载测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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