ApacheBench website stress test

ApacheBench (ab for short) is a command-line program that can be used for website stress testing and CC attacks. Please do not abuse it. ApacheBench (ab for short) is a command-line program that can be used for website stress testing. If Apache has already been installed, it will come with the ab tool. If you don’t want to install Apache and want to use the ab command, you can install ApacheBench separately through the following method

 

Install

#安装相关依赖
yum -y install apr-util
yum -y install yum-utils
#创建临时目录
mkdir abtmp && cd abtmp
#安装
yumdownloader httpd-tools*
rpm2cpio httpd-tools-*.rpm |cpio -idmv
#拷贝
cp usr/bin/ab /usr/bin

ab -VEnter the above command, one per line, and you can view the relevant information if you enter it without any accidents , as shown in the screenshot below.

Website stress testing

Enter the command to test. This sentence means to initiate 1000 requests to www.baidu.com, and the concurrent number is 50. The commonly used parameters are basically the following two:ab -n 1000 -c 50 百度一下,你就知道

  • -n: Specifies the number of requests used by the test session;
  • -c: Specify the number of requests sent to the server at one time;

If you need to view more parameter descriptions, please visit: ab command
Through log analysis, it is found that the ab command has just sent a large number of requests, as shown in the screenshot below, which means that the website is suffering from a small-scale CC attack.

Summarize

ApacheBench can be used for user website stress testing, and can also be used to launch CC attacks, please do not abuse it.

Part of this article refers to: install the ab command separately under centos
to defend against CC attacks, refer to: Install fail2ban + Firewalld on CentOS 7 to prevent blasting and CC attacks

Guess you like

Origin blog.csdn.net/weixin_43824829/article/details/130542656
Recommended