当前位置:网站首页>How to implement Apache's built-in AB stress testing tool
How to implement Apache's built-in AB stress testing tool
2022-07-22 17:18:00 【Yisu cloud】
Apache Self contained ab How to implement stress testing tools
This article mainly explains “Apache Self contained ab How to implement stress testing tools ”, Interested friends might as well come and have a look . The method introduced in this paper is simple and fast , Practical . Now let Xiaobian take you to learn “Apache Self contained ab How to implement stress testing tools ” Well !
Apache Bench brief introduction
Apache Bench yes Apache The server Bring one with you web Pressure test tools , abbreviation ab .
ab Very practical , It's not just about apache The server carries on the website visit stress test , You can also stress test other types of servers . such as nginx、tomcat、IIS etc.
ab Principle
ab Principle :ab The command creates Multiple concurrent Access thread , simulation Multiple visitors At the same time URL Address Visit .
Its test objectives are based on URL Of , therefore , It can be used to test apache Load pressure , You can also test nginx、lighthttp、tomcat、IIS Others, such as Web Server pressure .
ab Is a command line tool , ab Commands require very little of the computer issuing the load , It doesn't take up too much CPU, It doesn't take up a lot of memory . But it can put a huge load on the target server , The principle is similar CC attack . You should also pay attention to the use of your own test , Otherwise, too much load is put on at once . The target server may run out of resources , It can even crash in severe cases .
in general ab The tools are small and simple , It's faster to learn , It can provide the required basic performance indicators , But there is no graphical result , Can't monitor .
For students who want to take a stress test quickly ,apache ab It is a simple and easy-to-use tool , Here is a brief introduction to its use .
ab Installation
# install #yum -y install httpd-toolsapt-get install apache2-utils# Check for success ab -v
Parameter Introduction
Format :ab [options] [http://]hostname[:port]/path
Here are the parameters
-n requests Number of requests to perform // The total number of requests initiated by this test
-c concurrency Number of multiple requests to make // Number of requests generated at one time ( Or concurrent number )
-t timelimit Seconds to max. wait for responses // The maximum number of seconds a test is performed , There is no time limit by default .
-r Don't exit on socket receive errors. // Throw an exception to continue the test task
-p postfile File containing data to POST // Contains the need POST Data files for , File format such as “p1=1&p2=2”. How to use it -p 111.txt-T content-type Content-type header for POSTing
// POST Data used Content-type Header information , Such as -T “application/x-www-form-urlencoded” . ( coordination -p)-v verbosity How much troubleshooting info to print
// Set the detail level of the displayed information – 4 Or higher will display header information , 3 Or higher to display the response code (404, 200 etc. ), 2 Or higher to display warnings and other information . -V Show version number and exit .-C attribute Add cookie, eg. -C “c1=1234,c2=2,c3=3” (repeatable)
//-C cookie-name=value Attach a... To the request Cookie: That's ok . Its typical form is name=value One of the parameters of . This parameter can be repeated , Split with a comma .
Tips : Can use session Implement the principle transfer JSESSIONID Parameters , Realize the function of keeping conversation , Such as -C ” c1=1234,c2=2,c3=3, JSESSIONID=FF056CD16DA9D71CB131C1D56F0319F8″ .-w Print out results in HTML tables // With HTML Format output result of table . by default , It's a table with two columns of width on a white background .
-i Use HEAD instead of GET
ab Test cases
ab -n 5000 -c 200 http://localhost/index.phpab -n 1000 -c 100 -w http://localhost/index.php >>d:miss.htmlab -n 1000 -c 100 -p request_json.txt -T 'application/json' 'http://192.168.0.101:8088/api/event/annotationEvent'
Example 2
Many parameters , Usually we use -n and -c Parameters are OK . for example :
abs.exe -n 100 -c 20 Test website
-n hinder 100, Indicates a total of 100 A request ;
-c hinder 20 , Said the 20 concurrent ( simulation 20 Personal simultaneous access ),
The following URL indicates the goal of the test URL.
Carry out a simple stress test on Baidu : abs.exe -n 100 -c 20 https://www.baidu.com/
Running results :
Document Path: The test page
Document Length: Page size
Concurrency Level: The number of concurrent tests
Time taken for tests: Duration of the whole test
Complete requests: Number of requests completed
Failed requests: Number of failed requests
Total transferred: Network traffic throughout the process
HTML transferred: In the whole process HTML Content delivery
Requests per second: One of the most important indicators , amount to LR Transactions per second in , In the back bracket mean That means that this is an average
Time per request: Two of the most important indicators , amount to LR The average transaction response time in , In the back bracket mean That means that this is an average
Time per request: The average of the actual run time of each connection request
Transfer rate: Average traffic on the network per second , It can help to eliminate the problem of extended response time caused by excessive network traffic
Here we are , I'm sure you're right “Apache Self contained ab How to implement stress testing tools ” Have a deeper understanding of , You might as well put it into practice ! This is the Yisu cloud website , For more relevant contents, you can enter the relevant channels for inquiry , Pay attention to our , Continue to learn !
边栏推荐
- numpy.around
- UE4 set night (update skysphere according to directionallight direction)
- Hiam fine-grained unified authorization management helps enterprises achieve refined management and control of system permissions
- Hande enterprise PAAS platform hzero will soon be heavily open source!
- Add asynchronous task processing model task to flask framework
- 2022/7/19-日报
- LVS load balancing cluster
- final、finally、finalize的区别
- Win11闪白屏无法控制如何解决?
- Abaqus实现二自由度振动系统模态计算
猜你喜欢
tf.reduce_ sum()
Pytoch deep learning practice lesson 11 (CNN)
JWT learning
Shell (I) (updating)
MySQL中的日志“binlog”的三种格式这么好玩
Hande integrated platform Jixing otter version 1.4.0 was officially released!
UE4 use of vegetation tools
MATLAB函数:filtfilt——零相位数字滤波
MVC模式和三层架构
[Topic sharing] open source topic of hande enterprise PAAS platform hzero
随机推荐
Overview of basic principles of network
Activity recommendation | Apache pulsar's exploration and practice in vivo will be broadcast soon
Application of tensorflow optimizers in iris classification task
Enthusiasm and expertise fly together | Microsoft's most valuable expert project, attracting Microsoft technology contributors!
Use OpenCV to achieve the halo effect
2022/7/19-日报
5 minutes to talk about the enterprise PAAS platform hzero!
Polygon chain matic concept and underlying mechanism
JSON_ Incorrect problem returned by extract
UE4 level blueprint realizes door opening and closing
Server network performance tuning cases
Server network performance tuning tool
[reprint] UE4 interview Basics (II)
NFS网络文件系统
Tutorial update 20220719
[web page performance optimization] - about lazy image loading
Win11闪白屏无法控制如何解决?
UE4 use of vegetation tools
IO流的分类和方法
Pytoch deep learning practice lesson 11 (CNN)