In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
What is ab?
Ab, whose full name is ApacheBench, is a gadget that comes with Apache and is specifically used for HTTP Server's benchmark testing to simulate multiple concurrent requests at the same time.
The usage of ab
The usage of ab is: ab [options] [http://]hostname[:port]/path]
For example:
Ab-n 1000-c 200 http://xqtesting.blog.51cto.com/
The above example shows that the script visited Xiaoqiang's blog 1000 times and executed concurrently.
Ab-n 1000-c 1000-w http://xqtesting.blog.51cto.com/ > > / root/xiaoqiang.html
The above test case indicates that in the case of 100 concurrency, the test accesses the index.php script 1000 times and saves the test results to the xiaoqiang.html file.
Introduction of common parameters of ab:
-n: total number of requests executed. Default is 1.
-c: number of concurrency. Default is 1.
-t: the total time of the test, in seconds. Default is 5000s.
Ab result analysis
Are there too many results after running the above command? I don't understand? I don't know which one to look at? What does each mean? You have another hundred thousand reasons in your heart! Stop, we just need to focus on the following indicators:
Requests per second (mean) equals transactions per second in LR
Time per request (mean) is equivalent to the average transaction response time in LR
Percentage of the requests served within a certain time (ms)
How do I pass parameters?
Ab-n 1-c 1 "http://localhost/xiaoqiangshop/goods.php?id=20"
There must be double quotation marks
Can ab complete the post operation?
Ab-n 10-c 10-k-p "login.ab"-T "application/x-www-form-urlencoded"http://localhost/xiaoqiangshop/user.php"
-p file is the content of post (can be json format, can be & format)
-T specifies how post files are encoded using urlencode
-k keepalive connection
The content in login.ab is the combination of information required for login, as follows:
Username=xiaoqiang&password=123123&act=act_login
Matters needing attention
You can use ab to complete non-complex performance testing, or create data, which is more suitable for testing a single URL.
Whether ab is successful or not is only based on the status code of 2xx, and does not receive the return value of the server, but lr receives the complete return of the server. Therefore, under the same response time, the number of concurrency supported by the ab test will be greater than lr,tps and greater than lr.
The concurrency of ab is related to the number of cpu on the running machine, the more concurrency, the greater concurrency. So the concurrency supported under linux is greater than that under Windows.
Data inaccuracy in large concurrency depends more on the performance of ab itself than on the performance of the server
Extended reading
Use the ab command included with Apache to test the performance of the website: http://xqtesting.blog.51cto.com/4626073/1845431
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.