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.
Result description
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/
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
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
Server's Throughput, request processing per second
Requests per second: 201.68 [#/sec] (mean)
Average user waiting time
Time per request: 49.584 [ms] (mean)
Processing time of a single request on the server side
Time per request: 4.958 [ms] (mean, across all concurrent requests)
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
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)
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!

ApacheHTTPServer has become a leader in the field of web servers for its modular design, high scalability, security and performance optimization. 1. Modular design supports various protocols and functions by loading different modules. 2. Highly scalable to adapt to the needs of small to large applications. 3. Security protects the website through mod_security and multiple authentication mechanisms. 4. Performance optimization improves loading speed through data compression and caching.

ApacheHTTPServer remains important in modern web environments because of its stability, scalability and rich ecosystem. 1) Stability and reliability make it suitable for high availability environments. 2) A wide ecosystem provides rich modules and extensions. 3) Easy to configure and manage, and can be quickly started even for beginners.

The reasons for Apache's success include: 1) strong open source community support, 2) flexibility and scalability, 3) stability and reliability, and 4) a wide range of application scenarios. Through community technical support and sharing, Apache provides flexible modular design and configuration options, ensuring its adaptability and stability under a variety of needs, and is widely used in different scenarios from personal blogs to large corporate websites.

Apachebecamefamousduetoitsopen-sourcenature,modulardesign,andstrongcommunitysupport.1)Itsopen-sourcemodelandpermissiveApacheLicenseencouragedwidespreadadoption.2)Themodulararchitectureallowedforextensivecustomizationandadaptability.3)Avibrantcommunit

Apache's performance and flexibility make it stand out in a web server. 1) Performance advantages are reflected in efficient processing and scalability, which are implemented through multi-process and multi-threaded models. 2) Flexibility stems from the flexibility of modular design and configuration, allowing modules to be loaded and server behavior adjusted according to requirements.

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.

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.

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.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

Notepad++7.3.1
Easy-to-use and free code editor

Atom editor mac version download
The most popular open source editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.