网站基准测试使用ab
•浏览 1
Website Benchmarking using ab
我正在为我正在开发的网站尝试各种基准测试工具,并发现 Apache Bench (ab) 是负载测试的绝佳工具。它是一个命令行工具,显然非常易于使用。但是我对它的两个基本标志有疑问。我正在阅读的网站说:
Suppose we want to see how fast Yahoo can handle 100 requests, with a maximum of 10 requests running concurrently:
ab -n 100 -c 10 http://www.yahoo.com/Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
-n requests Number of requests to perform
-c concurrency Number of multiple requests to make
以及对标志状态的解释:
Suppose we want to see how fast Yahoo can handle 100 requests, with a maximum of 10 requests running concurrently:
ab -n 100 -c 10 http://www.yahoo.com/Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
-n requests Number of requests to perform
-c concurrency Number of multiple requests to make
我想我只是无法理解number of requests to perform 和number of multiple requests to make。当我像上面的例子一样把它们放在一起时会发生什么?
谁能给我一个更简单的解释这两个标志一起做什么?
在您的示例中,ab 将创建 10 个到 yahoo.com 的连接,并同时使用每个连接请求一个页面。
如果你省略 -c 10 ab 将只创建一个连接,并且仅在第一个连接完成时创建下一个连接(当我们下载了整个主页时)。
如果我们假设服务器的响应时间不取决于它同时处理的请求数量,那么您的示例将比没有 -c 10 的情况快 10 倍。
还有:Apache Benchmark 中的并发请求 (-c) 是什么?
-n 100 -c 10 表示"发出 100 个请求,一次 10 个。"