尝试使用Apache Bench
Apache Bench是什么
Apache附带的性能测试工具被称为ab。
这个特性会根据指定的请求生成一系列的单一、相同请求。它通常用于对web服务器的性能进行测试。
希望您将应用程序测试以场景为基础的方式不适用。
我希望您只将其视为一种简单的性能测试工具。
安装Apache Bench。
可以通过安装Apache来使用Apache Bench。请安装其中一种。
- httpdのインストール
yum install httpd
- Apache Benchのみ
只需要安装这个,就可以使用ApacheBench,不需要安装httpd。
yum install apr-util
Apache Bench的用法
执行
- 実行コマンド
ab -n [リクエストの総数] -c [コネクション数(並列実行数)] [URL]
- 実際のコマンド
ab -n 500 -c 100 http://test.com/index.html
这是一个由100个用户产生500个访问的测试。
- 他のオプション
オプション詳細-tレスポンス待ち時間の指定(/s)-A [ユーザ名]:[パスワード]ベーシック認証の指定-P [ユーザ名]:[パスワード]認証の必要なプロキシ-X [プロキシのサーバ名]:[ポート番号]プロキシ経由でリクエストする場合の指定
确认执行结果
- 実行結果
$ ab -n 500 -c 100 http://test.com/index.html
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking test.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Finished 500 requests
Server Software: Apache/2.4.6
Server Hostname: test.com
Server Port: 80
Document Path: /index.html
Document Length: 12 bytes
Concurrency Level: 100
Time taken for tests: 0.265 seconds
Complete requests: 500
Failed requests: 0
Write errors: 0
Total transferred: 135500 bytes
HTML transferred: 6000 bytes
Requests per second: 1884.92 [#/sec] (mean)
Time per request: 53.053 [ms] (mean)
Time per request: 0.531 [ms] (mean, across all concurrent requests)
Transfer rate: 498.84 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 3 4.9 0 17
Processing: 12 45 13.9 49 71
Waiting: 1 45 13.9 49 71
Total: 15 48 12.2 50 71
Percentage of the requests served within a certain time (ms)
50% 50
66% 54
75% 56
80% 59
90% 62
95% 66
98% 70
99% 71
100% 71 (longest request)
-
- Concurrency Level : 送信リクエスト数
-
- Time taken for tests : リクエスト完了までの時間
-
- Complete requests : 総リクエスト数
-
- Failed requests : 取りこぼしたリクエスト数
-
- Write errors : 書き込みエラー数
-
- Requests per second : 1秒あたりに処理されたリクエスト数
-
- Time per request : 同時実行したリクエストの平均処理時間(mean)
-
- Time per request : リクエストの平均処理時間(mean, across all concurrent requests)
-
- Transfer rate : 1秒あたりに受信された容量
-
- Connection Times (ms) : 下記の最小値、平均、最大値、平均を記載
Connect : 接続
Processing : 処理
Waiting : 待ち時間
Total : 集計
Percentage of the requests served within a certain time (ms) : 処理時間の推移
请提供一个你要求改写的具体句子。
-
- Apache Benchでサクッと性能テスト
-
- 【初心者向け】ApacheBench入門
-
- Apache BenchのTime per requestを調べてみた
- httpのパフォーマンスをチェックしたい~ApacheBench編~