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 apache stress testing tool

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to use apache stress testing tool". Friends who are interested 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 use apache stress testing tools.

Write at the front

Before we learn the ab tool, we need to know a few concepts about stress testing

Throughput (Requests per second)

Concept: a quantitative description of the concurrent processing capacity of a server, in reqs/s, which refers to the number of requests processed per unit time under a certain number of concurrent users. The maximum number of requests that can be processed per unit time under a certain number of concurrent users is called maximum throughput.

Calculation formula: total number of requests / time it takes to process these requests, that is

Request per second = Complete requests / Time taken for tests

Concurrent connections (The number of concurrent connections)

Concept: the number of requests accepted by the server at a time is, in short, a session.

Number of concurrent users (The number of concurrent users,Concurrency Level)

Concept: pay attention to the difference between this concept and the number of concurrent connections. A user may have multiple sessions at the same time, that is, the number of connections.

Average request waiting time for users (Time per request)

Calculation formula: the time it takes to process all requests / (total requests / concurrent users), that is

Time per request = Time taken for tests / (Complete requests / Concurrency Level)

Average request wait time on the server (Time per request: across all concurrent requests)

Calculation formula: the time / total number of requests taken to process all requests completed, that is,

Time taken for / testsComplete requests

As you can see, it is the reciprocal of throughput.

At the same time, it also = the average user request waiting time / the number of concurrent users, that is

Time per request / Concurrency Level

Brief introduction of ab tool

Ab full name is: apache bench

The explanation on the official website is as follows:

Ab is a performance testing tool for Apache Hypertext transfer Protocol (HTTP). It is designed to describe the execution performance of the currently installed Apache, mainly to show how many requests your installed Apache can handle per second.

Other websites explain:

Ab is a stress testing tool that comes with apache. Ab is very practical. It can be used not only for website access stress testing of apache servers, but also for other types of servers. Such as nginx, tomcat, IIS and so on.

Download the ab tool

Just go to apache website http://httpd.apache.org/ to download apache.

Start the ab tool

Take the installation path of apache in windows environment as C:\ apache\ Apache24\ as an example

Open the terminal and enter the command

Cd C:\ apache\ Apache24\ bin

You can start ab.

Start testing.

Enter a command

Ab-n 100-c 10 http://test.com/

Where-n represents the number of requests and-c represents the number of concurrency

For the remaining commands, see http://apache.jz123.cn/programs/ab.html.

Analysis of test results

After the above command is run, it comes out to test the report.

Complete test report

This section shows the information of the web server. You can see that the server uses nginx, the domain name is wan.bigertech.com, and the port is 80.

Server information

This is the information about the requested document, the location "/", and the size of the document is 338436 bytes (this is the body length of the http response)

Document information

This section shows several important indicators of stress testing.

Important index

Concurrency Level: 100Universe / concurrent requests Time taken for tests: 50.872 seconds// duration of the entire test Complete requests: 1000gamma / number of requests completed Failed requests: 13701482 bytes// Network traffic in the entire scenario HTML transferred: 13197000 bytes// HTML content transmission in the entire scenario Requests per second: 19.66 [# / sec] (mean) / / throughput, one of the indicators that people are most concerned about This is equivalent to the number of transactions per second in LR. The mean in parentheses indicates that this is an average Time per request: 5087.180 [ms] (mean) / / the average request waiting time of users. The second indicator that people are most concerned about is the average transaction response time in LR. The mean in parentheses indicates that this is an average of Time per request: 50.872 [ms] (mean, across all concurrent requests) / / average request processing time of the server. The third indicator that people are most concerned about is Transfer rate: 263.02 [Kbytes/sec] received// average network traffic per second, which can help eliminate the problem of excessive network traffic leading to longer response time.

This represents the decomposition of the time spent on the network.

Network consumption time

This is the distribution of processing time for each request. 50% of the processing time is within 4930ms, 66% of the processing time is within 5008ms. It is important to look at 90% of the processing time.

Response situation

About the login problem

Sometimes a user is required to log in to perform a stress test. What should I do?

Please refer to the following steps:

After logging in with your account and password, use the developer's tool to find the cookie value (Session ID) that identifies the session and write it down.

If only one Cookie is used, simply type the command:

Ab-n 100-C key=value http://test.com/

If you need more than one Cookie, set Header directly:

Ab-n 100-H "Cookie: Key1=Value1; Key2=Value2" http://test.com/

At this point, I believe you have a deeper understanding of "how to use the apache stress testing tool". 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!

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

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report