jmeter note 2: pressure test

Brief description

Regarding stress testing, the more intuitive role of jmeter is to write stress testing scripts [requests and stress testing strategies], and then execute them on the Linux server or locally. The stress testing execution script will print when starting the jmeter service. Issue the command to perform a stress test

1. Pressure test steps
  • step1: Write jmeter script and stress test strategy

    a. If there are many interfaces you want to press and they all have the same domain name, you can create an http default request:
    在jmeter线程组右键,add -> config Element -> HTTP Request Defaults
    mainly used to fill in the domain name and transmission protocol.
    Benefit: You don’t need to write these two items for other interface requests.
    b. Create request and assertion in jmeter thread group.
    Create request: 右击add ->Sampler -> HTTP Request
    add response assertion: Add ->. Assertions -> Response Assertion
    c. Add result tree and aggregation report in jmeter thread group.
    Result tree: 右击add -> Listener ->View Result Tree
    aggregation report: 右击add -> Listener ->Summary Report
    d. Save and save as xx.jmx

  • step2: Execute the script

    a. Upload xx.jmx to the server [in the bin directory of the jmeter installation directory]
    b. Keep jmeter in the startup state
    c. Execute the script
    jmeter -n -t test.jmx -r -l test.jtl -e -o /software/jmeter安装目录/bin/datestr/resultReport
    The meaning of the key contents of the script:
    test.jmx :jmeterthe edited script, including requests and stress test scripts.
    test.jtl :The text file containing the test running results
    resultReport:finally outputs a highly readable stress test report here. The path to store the stress test report can be defined by yourself.
    During the stress test process, interpret some basic situations of the stress test that Linux will print:
    Insert image description here
    Roughly Interpretation: summary, 11502: both request number
    11502 requests, consumption 14s, qps: 802.3/s, average: 334, minimum value 64, maximum value: 3163, error rate 0 (0%), number of active threads 300 [The basic meaning is to set the stress test to 300 concurrency], end: 0
    Points to pay attention to: Generally, you will have a stress test indicator, eg: control the average response time of the interface within 500ms, conduct stress test, and stress test the number of concurrency Refer to the online qps traffic settings, such as 100 online, then you can press 3 times or 10 times the qps of the official environment. Then observe the printed results. If the average response time is more than 500ms, there is no need to wait for the pressure to be completed. You can stop the jmeter pressure test process and reduce the number of concurrencies until the average response time is close to 500ms.

  • Step 3. After the stress test is completed, a stress test report will be output.
    The stress test report will record the errors reported during the stress test, throughput rate, qps, etc. There are mainly three parts:
    Insert image description here
    Dashboard (a rough look), Charts (a detailed look), and Customs Graphs (a rough look).
    Sorry, time is limited. I will add details later.

2. Observe the CPU and memory usage

During the pressure test, it is necessary to observe

查看cpu 里应用占用情况:top 
命令来显示所有用户的所有进程。该命令将显示进程ID(PID)、CPU使用率、内存使用率等信息:ps aux
直观易读的格式打印分区类型和分区大小。此命令将显示每个部分的总可用空间、已用空间和可用空间: df -TH
3. Check disk usage

If the above parameter values ​​are normal and the operation is still very slow, you can check the disk usage.

查看磁盘占用情况:du -sh /*|grep G 
查到的占用磁盘比较大的路径,可以 将/* 替换指定的路径 eg:/xxfile/*

Guess you like

Origin blog.csdn.net/qq_17033579/article/details/131877810
Recommended