apache ab工具壓力測試

apache自己自帶了一個測試工具ab,在apache的安裝目錄bin目錄下php

ab的使用方法:apache

Usage: ab [options] [http[s]://]hostname[:port]/path工具

-n 測試會話中所執行的請求個數,默認時,僅執行一個請求
-c 一次產生的請求個數。默認是一次一個
-t 測試所進行的最大秒數
-v 設置顯示信息的詳細程度 - 4或更大值會顯示頭信息, 3或更大值能夠顯示響應代碼(404, 200等), 2或更大值能夠顯示警告和其餘信息。 -V 顯示版本號zui測試

最經常使用的參數是 -n 和 -c 例如:ui

root@:localhost:/usr/local/apache/bin> ./ab -n1000 -c10 http://localhost/index.php
This is ApacheBench, Version 2.3 <$Revision: 1528965 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 192.168.90.222 (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests Server Software: Boa/0.94.13 Server Hostname: 192.168.90.222 Server Port: 80 Document Path: / Document Length: 41 bytes Concurrency Level: 10 Time taken for tests: 0.173 seconds Complete requests: 1000 Failed requests: 0 Total transferred: 228000 bytes HTML transferred: 41000 bytes Requests per second: 5780.51 [#/sec] (mean) Time per request: 1.730 [ms] (mean) Time per request: 0.173 [ms] (mean, across all concurrent requests) Transfer rate: 1287.07 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.2 0 1 Processing: 0 1 7.8 1 80 Waiting: 0 1 7.3 0 76 Total: 0 2 7.7 1 80 Percentage of the requests served within a certain time (ms) 50% 1 66% 1 75% 1 80% 1 90% 1 95% 1 98% 2 99% 76 100% 80 (longest request)
相關文章
相關標籤/搜索