简体   繁体   English

使用ab进行网站基准测试

[英]Website Benchmarking using ab

I am trying my hand at various benchmarking tools for the website I am working on and have found Apache Bench (ab) to be an excellent tool for load testing. 我正在尝试使用我正在研究的网站的各种基准测试工具,并发现Apache Bench (ab)是负载测试的优秀工具。 It is a command line tool and is very easy to use, apparently. 它是一个命令行工具,显然非常容易使用。 However I have a doubt about two of its basic flags. 但是我怀疑它的两个基本标志。 The site I was reading says: 我正在阅读的网站上写道:

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/

and the explanation for the flags states: 并且标志的解释说明:

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

I guess I am just not able to wrap my head around number of requests to perform and number of multiple requests to make . 我想我只是无法解决number of requests to perform number of multiple requests to make What happens when I give them both together like in the example above? 当我像上面的例子一样将它们放在一起时会发生什么?

Can anyone give me a simpler explanation of what these two flags do together? 任何人都可以给我一个更简单的解释,这两个标志一起做什么?

In your example ab will create 10 connections to yahoo.com and request a page using each of them simultaneously. 在您的示例中,ab将创建与yahoo.com的10个连接,并同时使用每个连接请求页面。

If you omit -c 10 ab will create only one connection and create next only when the first completes(when we have the whole main page downloaded). 如果省略-c 10 ab将仅创建一个连接,并且仅在第一个完成时(当我们下载整个主页时)创建下一个连接。

If we pretend that server's response time does not depend on the number of requests it is simultaneously handling, your example will complete 10 times faster than without -c 10. 如果我们假装服务器的响应时间不依赖于它同时处理的请求数,那么您的示例将比没有-c 10的情况快10倍。

Also: What is concurrent request (-c) in Apache Benchmark? 另外: Apache Benchmark中的并发请求(-c)是什么?

-n 100 -c 10表示“发出100个请求,一次发出-n 100 -c 10个请求”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM