Apache Bench Stress Test


I tried stress test with Apache Bench for Web API server.

Environment

The environment of the client machine I used for the test this time.

  • OS: Ubuntu 16.04

Apache Bench

Apache Bench is the tool which makes stress test easy. It has not many functions for stress test, but it is easy to use.

What we can do

  • POST / GET Request

What we cannot do

  • DELETE Request
  • Change parameter for each request
  • Use scenario

Install Apache Bench

Install it with the following command.

Test POST request

POST リクエスト でテストをする今回のテストでは次のようにしました。

To send JSON data, create sample.json and write JSON.

To execute test, write the command as ab [options] [http[s]://]hostname[:port]/path.

Option

ab -h shows help. Here I introduce help descriptions of options I used this time.

-n
The number of requests.
-c
The number of requests to be sent at once.
-p
The file including sending data in POST request. When we use PUT request, add -u option.
-T
Content Type

Output

The following aoutput appears. The number of requests in one second is also shown.