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 ab stress Test tool on linux Server

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to use the ab stress test tool on the linux server". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use the ab stress test tool on the linux server".

What is 1.ab?

Ab is a pressure testing tool that comes with apache. Its principle is that the ab command creates multiple concurrent access threads to simulate multiple visitors accessing a URL address at the same time. Its testing goal is based on URL, so it can be used not only to test the load pressure of apache, but also to test the pressure of other Web servers such as nginx, lighthttp, tomcat, IIS and so on.

two。 Why use ab?

What I do is a game payment platform, which must be stable and cannot be hung up when it is big, so I should use the pressure test tool before going online to see the peak value of the interface.

Install ab on 3.linux

Installing ab on linux is very easy, and the steps are as follows:

1. I installed it under / usr/local, create a new folder mkdir ab

two。 Start installing yum-y install httpd-tools

3. Test whether ab-V is installed successfully

Introduction of parameters commonly used in 4.ab

-n: total number of requests executed. Default is 1.

-c: number of concurrency. Default is 1.

-t: the total time of the test, in seconds. Default is 5000s.

-data file for p:POST

-T: used with _ p, the information of the request header in the main post request

5. Start testing.

I am testing the performance of nginx this time. Because I am a post request, I need to have the information of the request body and request header. @ RequestBody is used in the backend, so the content of the request body must be in json format.

Let's start with the usage of post request when using ab stress test:

1. First, create a new file post.txt under the installation path with the following command:

two。 Then open the post.txt file and put the information of your request body in it:

3. Here comes the most important order, pay attention:

Ab-n 100-c 10-p post.txt-T 'application/json' server address: Port number / test.json

This means that 10 requests are processed simultaneously and the test.json is run 100 times.

Explain that-n refers to a total of 100 requests-c refers to the number of concurrency 10-p refers to the content of the post request body-T refers to the request address followed by the request body information

4. Execution result

The more important parameters are explained in detail:

/ / one of the metrics you are most concerned about is equivalent to the number of transactions per second in LR. The mean in parentheses indicates that this is an average.

Requests per second: 122.12 [# / sec] (mean)

/ / the second indicator you are most concerned about is equivalent to the average transaction response time in LR. The mean in parentheses indicates that this is an average.

Time per request: 8188.731 [ms] (mean)

/ / average of the actual elapsed time of each request

Time per request: 8.189 [ms] (mean, across all concurrent requests)

Thank you for reading, the above is the content of "how to use the ab stress testing tool on the linux server". After the study of this article, I believe you have a deeper understanding of how to use the ab stress testing tool on the linux server, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Internet Technology

Wechat

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

12
Report