简体   繁体   中英

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. 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 . 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.

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).

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.

Also: What is concurrent request (-c) in Apache Benchmark?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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