How to use apache ab

藏色散人
Release: 2019-08-07 10:59:30
Original
2626 people have browsed it

How to use apache ab

How to use apache ab

Basic use of Apache ab

ab introduction

ab is the abbreviation of Apache HTTP server benchmarking tool, which can be used to test the server performance of HTTP requests. It provides simple and easy-to-use performance testing tool command combinations through different parameters on the command line.

ab command principle

Apache's ab command simulates multi-threaded concurrent requests, tests server load pressure, and can also test the pressure of other web servers such as nginx, lighthttp, IIS, etc. .

The ab command has very low requirements on the computer that issues the load. It will not occupy a lot of CPU or memory, but it will cause a huge load to the target server, so it is a certain DDOS attack. A must-have medicine suitable for all ages. You must also be careful when using it yourself. Otherwise, too much load is applied at once, causing the target server to crash due to running out of memory and having to hard restart, which is not worth the loss.

In the case of insufficient bandwidth, it is best to test on the local machine. It is recommended to use another or multiple servers on the intranet to test through the intranet. The data obtained in this way will be much more accurate. . Remote stress testing of web servers often yields unsatisfactory results (due to excessive network latency or insufficient bandwidth)

I won’t go into details about the installation, as long as Apache is installed. You can refer to the previous article

Basic parameter usage method 1

Parameter description: -n number of requests, -c number of concurrency

ab -n1000 -c10 https://www.baidu.com/ 代表对百度首页请求1000次,并发10.
Copy after login

Result description

How to use apache ab

Version information description

This is ApacheBench, Version 2.3 <$Revision: 1430300 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Copy after login

Progress description

Benchmarking www.baidu.com (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
Copy after login

Server information

Server Software: BWS/1.1 Server Hostname: www.baidu.com Server Port: 443 SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128 Document Path: / Document Length: 227 bytes Concurrency Level: 10 Time taken for tests: 4.958 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 872000 bytes HTML transferred: 227000 bytes
Copy after login

Server's Throughput, request processing per second

Requests per second: 201.68 [#/sec] (mean)
Copy after login

Average user waiting time

Time per request: 49.584 [ms] (mean)
Copy after login

Processing time of a single request on the server side

Time per request: 4.958 [ms] (mean, across all concurrent requests)
Copy after login

received The average traffic on the network per second, can Helps troubleshoot whether there is a problem of prolonged response time caused by excessive network traffic

Transfer rate: 171.74 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 27 36 39.0 34 1246 Processing: 10 13 1.9 13 33 Waiting: 10 13 1.9 13 33 Total: 38 49 39.1 47 1258
Copy after login

Response status of all requests in the entire scenario.

Percentage of the requests served within a certain time (ms) 50% 47 66% 49 75% 50 80% 51 90% 53 95% 56 98% 58 99% 62 100% 1258 (longest request)
Copy after login

Usage summary

a.ab Judging success or failure only determines the response result of 2xx

b.Only suitable For a simple stress test of an interface or page

c.ab, you can also fill in the parameters for stress testing.

For more Apache related knowledge, please visit theApache usage tutorialcolumn!

The above is the detailed content of How to use apache ab. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!