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 the common command ab in Linux

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

Share

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

This article is to share with you about how to use the common command ab in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Linux common commands ab command is a performance testing tool for Apache's Web server. It can test and install Web server to process HTTP requests per second.

Syntax ab (options) (parameters) option-A: specify the basic authentication credentials to connect to the server;-c: specify the number of requests sent to the server at a time;-C: add cookie;-g: output the test results to a "gnuolot" file;-h: display help information;-H: append an extra header to the request;-I: use the "head" request method -k: activate the "keepAlive" feature in HTTP;-n: specify the number of requests to be used by the test session;-p: specify the file containing data;-Q: do not display the percentage of progress;-T: set the content type header when using POST data;-v: set the level of detail mode;-w: print the results as a HTML table;-x: set the properties of the table when outputting as a table -X: sends the request using the specified proxy server;-y: sets the table properties when outputting as a table. Parameter host: the host under test.

The test session generated a total of 1000 requests, once generated, stress test

[root@youxi2] # ab-n 1000-c 1000 http://192.168.5.102/index.html This is ApacheBench, Version 2.3 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation Http://www.apache.org/ Benchmarking 192.168.5.102 (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: Apache/2.4.6 / / httpd server version Server Hostname: 192.168.5.102 / / server hostname Server Port: 80 / / Server port Document Path: / index.html / / Page document for test Document Length: 7 bytes / / document size for test Concurrency Level: 1000 / / number of concurrency Time taken for tests: 0.983 seconds / / whole test time Complete requests: 1000 / / number of completed requests Failed requests: 0 / / failed request Number of Write errors: 0 Total transferred: 265000 bytes / / Total transmission bytes during the test HTML transferred: 7000 bytes / / number of HTML transmission bytes during the test Requests per second: 1017.58 [# / sec] (mean) / / number of requests processed per second Mean says this is an average Time per request: 982.726 [ms] (mean) / / average request time, and mean says this is an average Time per request: 0.983 [ms] (mean, across all concurrent requests) / / average of the actual running time of each request Mean says this is an average Transfer rate: 263.34 [Kbytes/sec] received / / transfer rate Connection Times (ms) min mean [+ /-sd] median max Connect: 0 4050.5 0127 Processing: 8178 257.1 45839 Waiting: 8178 257.2 45839 Total: 34218 294.6 47 934 Percentage of the requests served within a certain time (ms) 50% 47 66% 112 75% 349 80% 541 90% 919 95% 928 98% 931 99% 933 100% 934 (longest request) Note: the test limit is generally determined by the number of files opened This value can be viewed through the ulimit-an or ulimit-n commands, and the default size is 1024. The solution is ulimit-n [numeric] to increase the limit on the number of files that can be opened, both the test and the one being tested.

Thank you for reading! This is the end of the article on "how to use ab in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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