Home Operation and Maintenance Apache How to use apache ab

How to use apache ab

Aug 07, 2019 am 10:59 AM
apache

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 the Apache usage tutorial column!

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1657
14
PHP Tutorial
1257
29
C# Tutorial
1229
24
How to connect to the database of apache How to connect to the database of apache Apr 13, 2025 pm 01:03 PM

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

How to set the cgi directory in apache How to set the cgi directory in apache Apr 13, 2025 pm 01:18 PM

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

How to view your apache version How to view your apache version Apr 13, 2025 pm 01:15 PM

There are 3 ways to view the version on the Apache server: via the command line (apachectl -v or apache2ctl -v), check the server status page (http://&lt;server IP or domain name&gt;/server-status), or view the Apache configuration file (ServerVersion: Apache/&lt;version number&gt;).

What to do if the apache80 port is occupied What to do if the apache80 port is occupied Apr 13, 2025 pm 01:24 PM

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

How to view the apache version How to view the apache version Apr 13, 2025 pm 01:00 PM

How to view the Apache version? Start the Apache server: Use sudo service apache2 start to start the server. View version number: Use one of the following methods to view version: Command line: Run the apache2 -v command. Server Status Page: Access the default port of the Apache server (usually 80) in a web browser, and the version information is displayed at the bottom of the page.

How to solve the problem that apache cannot be started How to solve the problem that apache cannot be started Apr 13, 2025 pm 01:21 PM

Apache cannot start because the following reasons may be: Configuration file syntax error. Conflict with other application ports. Permissions issue. Out of memory. Process deadlock. Daemon failure. SELinux permissions issues. Firewall problem. Software conflict.

How to configure zend for apache How to configure zend for apache Apr 13, 2025 pm 12:57 PM

How to configure Zend in Apache? The steps to configure Zend Framework in an Apache Web Server are as follows: Install Zend Framework and extract it into the Web Server directory. Create a .htaccess file. Create the Zend application directory and add the index.php file. Configure the Zend application (application.ini). Restart the Apache Web server.

How to delete more than server names of apache How to delete more than server names of apache Apr 13, 2025 pm 01:09 PM

To delete an extra ServerName directive from Apache, you can take the following steps: Identify and delete the extra ServerName directive. Restart Apache to make the changes take effect. Check the configuration file to verify changes. Test the server to make sure the problem is resolved.

See all articles