Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use ab stress testing tool in apache

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to use the ab stress testing tool in apache. It is very detailed and has a certain reference value. Friends who are interested must read it!

I. script description

The script supports most of the commonly used parameters of ab, if you need more parameters, you can modify the script to add what you want.

The script supports:

1), batch testing. Note that it is not a simple batch test, you can determine the number of test wheels and the interval. 2), ladder concurrency growth custom testing, such as concurrency from 100 to 1000, 5 tests per round, etc. 3) postfile mode that supports ab, you just need to include your data file in the parameter-P |-- postfile. 4) the analysis of the index of pressure test shows that this shell can analyze the instructions commonly used in ab in real time.

2. Script content #! / bin/bashecho'* = = * 'echo' | this script tool is based on ab (Apache benchmark). Please install ab and awk first. | 'echo' | Note: | 'echo' | the default maximum number of shell clients is 1024 | 'echo' | if this limit is exceeded Execute the following command: | 'echo' | ulimit-n 655350 | 'echo' * = = * 'function usage () {echo' command format: 'echo' ab-test-tools.sh' echo'- N |-- Total number of count requests Default: 5w 'echo'-C |-- clients concurrency, default: 100 'echo'-R |-- number of rounds tests, default: 10 'echo'-S |-sleeptime interval, default: 10 seconds' echo'- I |-- min minimum concurrency, default: 0 'echo'-X |-- max maximum concurrency Default: 0 'echo'-J |-- step incremental concurrency 'echo'-T |-- overall runtime running time. When this item is set, the maximum number of requests is 5w 'echo'-P |-- postfile post data file path 'echo'-U |-- url test address' echo''echo' test output result * .out file 'exit } # define the default number of parameters # total number of requests count=50000# concurrency number of clients=100O# test wheels rounds=10# interval sleeptime=10# minimum number of concurrency min=0# maximum number of concurrency increment step=0# test address url=''# test limit time runtime=0# transfer data postfile=''ARGS= `getopt-a-o N:C:R:S:I:X:J:U:T:P:h-l count:,client:,round:,sleeptime:,min: Max:,step:,runtime:,postfile:,help-- "$@" `[$?-ne 0] & & usageeval set-- "${ARGS}" while true do case "$1" in-N |-- count) count= "$2" shift ;-C |-- client) clients= "$2" shift;;-R |-- round) rounds= "$2" shift;;-S |-- sleeptime) sleeptime= "$2" shift;-I |-- min) min= "$2" shift;;-X |-max) max= "$2" shift;;-J |-- step) step= "$2" shift;;-U |-- url) url= "$2" shift;-T |-runtime) runtime= "$2" shift;;-P |-postfile) postfile= "$2" shift -h |-- help) usage;;-- shift break;; esacshiftdone# parameter check if [x$url = x] then echo 'Please enter test url, non-file / end' exitfiflag=0if [$min! = 0-a $max! = 0] then if [$max-le $min] then echo 'maximum concurrency cannot be less than the minimum concurrency' exitfi if [$step-le 0] then echo 'concurrency increment cannot be allowed

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report