Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to realize web stress Test through Apache Bench

Shulou Source: shulou.com Published: 2022-05-31 16:11:56 10月02日 Update

This article focuses on "how to achieve web stress testing through Apache Bench", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to achieve web stress testing through Apache Bench.

A brief introduction to Apache Bench

ApacheBench is a web stress testing tool that comes with Apache server, referred to as ab. Ab is also a command line tool, which has very low native requirements for initiating load. According to the ab command, many concurrent access threads can be created to simulate multiple visitors to access a URL address at the same time, so it can be used to test the load pressure of the target server. Generally speaking, ab tools are compact and easy to learn, and can provide the required basic performance indicators, but there are no graphical results and can not be monitored.

II. Apache Bench installation

First of all, you need to install the Apache server, download address: https://www.apachelounge.com/download/ focus 64-bit operating system choose the above compression package.

Installation

Ubuntu

1: install online using apt: sudo apt install apache2-utils 2: check whether the installation is successful: ab-V

Use common parameter description

Interpretation of test report

Examples

(1) simulate 100 requests from a client:

Ab-n 100 http://www.example.com/

(2) simulate 10000 requests from 100 clients:

Ab-n 10000-c 100 http://www.example.com/

(3) call the API of POST method 10 times, and the transmitted data format is JSON:

Ab-n 10-p json-file http://www.example.com/

(4) call the API of OPTIONS method 10 times:

Ab-n 10-m OPTIONS http://www.example.com/

(5) output the return information of each request:

Ab-n 10-v 2 http://www.example.com/

Matters needing attention

You cannot specify a Content-Type header with-H Content-Type instead of-T Content-Type

If you prompt ab: invalid URL, it may be that / is missing on the far right of URL, for example, http://www.example.com needs to be changed to http://www.example.com/.

It should be noted that if the HTTP API of the stress test determines whether it is successful by returning the result (200 status code will be returned as long as the response is available), you need to find a way to identify the failed request.

At this point, I believe you have a deeper understanding of "how to achieve web stress testing through Apache Bench". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Testing stress tools interfaces methods servers learning services success content commands addresses clients clients results practical compact deeper operating systems matters Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei OPPO Reno Shulou Technology Docker NVidia