ab

Ab is apache’s own pressure test tool, it is very convenient to use.

The installation

If apache is installed, ab is already installed. If you do not want to install Apache, you can install AB as follows

支那

# ubuntu
sudo apt-get install apache2-utils

# centos
yum -y install httpd-tools 
Copy the code

Pressure test

There are a few options you need to focus on before manometry, which can be viewed through ab-help

支那

Options are: -n requests Number of requests to execute -c concurrency number -s timeout Response timeCopy the code

perform

支那

Ab - 1 n 1000-100 - c s http://127.0.0.1:1080/event? Config_name =mysql_config # execute 1000 requests concurrently, timeout duration is 1sCopy the code

Results analysis

After the above test command is executed, the following results are obtained, focusing on the following indicators:

  • Failed requests: Failed requests
  • Requests per second is the average number of Requests per second
  • Time per request: The Time taken to complete a request
  • Transfer rate: Network Transfer rate. To determine whether this value is a bottleneck, you need to know the network information between the client and the server under test, including network bandwidth and network adapter speed.

支那

Server Software: Server Hostname: 127.0.0.1 Server Port: 1080 Document Path: /event? config_name=mysql_config Document Length: 0 bytes Concurrency Level: 100 Time taken for tests: 0.137 seconds Complete requests: 1000 Failed requests: 0 Total transferred: 75000 bytes HTML transferred: 0 bytes Requests per second: 7275.11 [#/ SEC] (mean) Time per request: 13.745 [ms] (mean) Time per request: [MS] (mean, across all concurrent requests) Transfer rate: 532.84 [Kbytes/ SEC] Received Connection Times (ms) min mean[+/-sd] Median Max Connect: 0 1 1.0 1 5 Processing: 1 12 5.9 11 30 Waiting: 1 11 5.9 11 29 Total: 30 Percentage of the requests served within a certain time (MS) 50% 13 66% 15 75% 17 80% 18 90% 22 95% 25 98% 28 99% 29 100% 30 (longest request)Copy the code

wrk

WRK is a c language developed by the modern HTTP performance benchmark tool, simple to use, powerful.

The installation

Installation can be downloaded from github source compiler installation WRK Github address

Pressure test

WRK commands have few options and are easy to use

支那

Usage: wrk <options> <url> Options: -c, --connections <N> establish connections -d, --duration <T> Execute test time -t, -- Threads <N> number of threads -s, --script < s > Use lua script (very powerful, -h, --header <H> Add latency to each HTTP request. Print delay statistics --timeout <T> Timeout time -v, --version Print version details Numeric arguments may include a SI unit (1k, 1M, 1G) Time arguments may include a time unit (2s, 2m, 2h)Copy the code

支那

WRK - c100 - t10 - d30s http://127.0.0.1:1080/event? Config_name =mysql_config # 10 threads 100 connections test 30sCopy the code

Results analysis

The results report generated by WRK is concise and focuses on the same points as AB

  • Requests/sec: QPS
  • Transfer/ SEC: Network transmission speed

支那

Test Running 30 s @ http://127.0.0.1:1080/event? Config_name =mysql_config 10 threads and 100 connections Thread Stats Avg Stdev Max +/- Stdev Latency 21.02ms 92.04ms 1.05s 97.79% Req/Sec 1.22K 229.72 2.38K 75.47% 365483 requests in 30.07s, 26.14MB read requests /Sec: 12152.63 Transfer/SEC: 0.87 MBCopy the code

jmeter

Jmeter is a GUI test tool written in Java with powerful and varied results

The installation

The installation can be downloaded from Apache JMeter

use

Set up the Plan

image

Establish the Thread Group

After the Plan is established, Thread Group can be established

After Plan is selected, Edit > Add > Threads > Thread Group

image

Threads Group Specifies the Number of Threads(Users) and Loop Count

Add the Listener

The Listener generates result reports and is added in the following ways

Select The Thread Group and Edit > Add > Listener

image

You can see that there are many result reports, I usually use the following result reports

  • View Results Tree
  • Aggregate Report
  • Graph Results
  • View Results Table

View Results Tree

This report generates a tree of requests, which you can click to view for each request

image

Aggregate Report

This report generates aggregate statistics for the request, with key parameters such as QPS, transmission speed, and so on

image

Graph Results

Powerful graphical reporting of results

image

Some illustration of the graph results

  • No of Samples: Represents the number of requests sent to the server
  • Deviation: The distribution of data that represents the corresponding time changes of the server
  • Latest Sample: Indicates the time of the last request from the server
  • Throughtput: This is how much data the server processes per minute
  • Average: Represents the total elapsed time divided by the number of requests sent to the server
  • Median(Median): Indicates that half of the server times are below this value and the other half are above it

Some analysis based on the graph results

  1. Throughput starts out low, then increases and decreases as the number of requests increases
  2. It’s not a bad deviation, it’s a pretty steady state and if the number of deviations gets bigger and bigger as the number of requests gets bigger and bigger, the server is getting more and more unstable

支那

13 people liked **

支那

** Performance optimization

支那

Author: algebra2k links: www.jianshu.com/p/8c622e304… The copyright of the book belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please indicate the source.