Using Apache ab to perform http performance testing

Using Apache ab to perform http performance testing

Mac comes with Apache environment

Open Terminal and enter sudo apachectl -v (you may need to enter your machine secret). The Apache version is shown below

Then enter sudo apachectl start and Apache will start. Open the Safari browser and enter "http://localhost" in the address bar. You should see a page with the content "It works!". It is located in "/Library/WebServer/Documents/", which is the default root directory of Apache.

Apache's installation directory is: /etc/apache2/, etc is hidden by default. There are three ways to view:

1. Right-click Finder in the dock, select "Go to Folder", and enter "/etc"
2. In finder -> Go -> Go to folder, then enter /etc
3. You can enter "open /etc" in the terminal

Windows can go to http://httpd.apache.org/download.cgi to download, or install from the command line

1. Install Apache

sudo port install apache2

Start Apache: sudo apachectl start

2. brew install pcre

3. wget http://ftp.yz.yamagata-u.ac.jp/pub/network/apache//httpd/httpd-2.4.4.tar.bz2

(1) Decompression
(2) ./configure
(3) make && make install
(4) sudo cp support/ab /usr/sbin

4. ab -n 1000 -c 10 http://localhost:3000/ The last slash is essential

For this ab -n1000 -c10 http://localhost:3000/ command, under the Windows system, you need to first use the cd command to locate the bin folder of your Apache installation directory. . .

Parameter description of ab

-n The number of requests to execute

-c The number of concurrent

-t Maximum time to wait for return

-b TCP send and receive buffer size, unit (byte)

-p uses post (also needs to define -T parameter)

-u Use put (also need to define -T parameter)

-T content-type, for example application/x-www-form-urlencoded, default is text/plain

-w prints the results in an HTML table

-x table attributes

-y tr line attributes

-z td column attributes

-C Set cookie, for example, Apache=1234

-H header line, for example Accept-Encoding:gzip

-k Whether to mark HTTP Keep Alive

Test results:

This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (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 Software:  
Server Hostname: localhost
Server Port: 3000

Document Path: /
Document Length: 14 bytes

Concurrency Level: 10
Time taken for tests: 0.323 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 115000 bytes
HTML transferred: 14000 bytes
Requests per second: 3097.37 [#/sec] (mean)
Time per request: 3.229 [ms] (mean)
Time per request: 0.323 [ms] (mean, across all concurrent requests)
Transfer rate: 347.85 [Kbytes/sec] received

Connection Times (ms)
    min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 1 3 2.2 2 16
Waiting: 1 3 2.2 2 16
Total: 1 3 2.2 2 16

Percentage of the requests served within a certain time (ms)
 50% 2
 66% 3
 75% 3
 80% 4
 90% 5
 95% 7
 98% 13
 99% 15
 100% 16 (longest request)

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of the use of Apache performance testing tool ab
  • Apache AB performance testing tool usage tutorial
  • Analyzing ab performance test results under Apache

<<:  Next.js Getting Started Tutorial

>>:  A brief introduction to the command line tool mycli for operating MySQL database

Recommend

Detailed explanation of primary keys and transactions in MySQL

Table of contents 1. Comments on MySQL primary ke...

Introduction to Javascript DOM, nodes and element acquisition

Table of contents DOM node Element node: Text nod...

Explanation of the problem that JavaScript strict mode does not support octal

Regarding the issue that JavaScript strict mode d...

Detailed description of the function of new in JS

Table of contents 1. Example 2. Create 100 soldie...

Why MySQL should avoid large transactions and how to solve them

What is a big deal? Transactions that run for a l...

Detailed explanation of as, question mark and exclamation mark in Typescript

1. The as keyword indicates an assertion In Types...

4 ways to implement routing transition effects in Vue

Vue router transitions are a quick and easy way t...

The core process of nodejs processing tcp connection

A few days ago, I exchanged some knowledge about ...

How to install Nginx and configure multiple domain names

Nginx Installation CentOS 6.x yum does not have n...

JavaScript implements single linked list process analysis

Preface: To store multiple elements, arrays are t...

Using vue3 to imitate the side message prompt effect of Apple system

Table of contents Animation Preview Other UI Libr...

The most convenient way to build a Zookeeper server in history (recommended)

What is ZooKeeper ZooKeeper is a top-level projec...

A brief talk about React Router's history

If you want to understand React Router, you shoul...