当前位置:网站首页>JMeter piezometric interface programming North
JMeter piezometric interface programming North
2022-06-11 03:41:00 【PostTruth】
In the field of e-commerce , Every time we go to various activities , what 618, A double tenth , 12-12 , All kinds of preferential activities come in a stream , A huge challenge for marketing tools , therefore , The pressure test of marketing related systems is to ensure the stable operation of the system , Necessary means to deal with sudden traffic .
Coupon system is a big killer in marketing tools , Its stability guarantee is essential .
The following mainly introduces the pressure measurement process of the coupon system I am responsible for in response to the sudden flow of the double 11 :
1. Preparation before pressure test
download Pressure measuring tool : Jmeter
Count the data of each pressure test interface in advance : daily QPS, 99 Line , Double 11 estimated QPS
Pressure measurement thread count calculation : 1000/ Interface 99 Line x Number of threads = The goal is QPS
daily QPS: When the system is inactive QPS, Go to the system monitoring market to check , Such as cat
99 Line : 99% Request time for (ms)
Double 11 estimated QPS: Each company has different regulations , Our company is daily QPS Of 50-100 times , Select according to the interface business scenario
Number of threads : During pressure measurement Jmeter Number of threads filled in
start-up jmeter
$ jmeter [10:17:24]
WARNING: package sun.awt.X11 not in java.desktop
================================================================================
Don't use GUI mode for load testing !, only for Test creation and Test debugging.
For load testing, use CLI Mode (was NON GUI):
jmeter -n -t [jmx file] -l [results file] -e -o [Path to web report folder]
& increase Java Heap to meet your test requirements:
Modify current env variable HEAP="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m" in the jmeter batch file
Check : https://jmeter.apache.org/usermanual/best-practices.html
================================================================================
from jmeter The startup information shows that , We should use GUI Write pressure test script , Using the command line jmeter -n -t [jmx file] -l [results file] -e -o [Path to web report folder] Carry out pressure test
Jmeter Go to find a place in the evening demo Case study , You can operate it yourself , Let me mainly introduce the production level Jmeter scripting
Jmeter scripting
Create a new folder : testplan
open jmeter ,
Adjust the language style to Chinese , options -> choose Language -> chinese
establish testplan:

Save to We Created testplan Folder

Right click to add HTTP Request defaults

Fill in your pressure test environment , Common script tests use test Environmental Science

add to JSON Assertion : When the response code by 10000 When it comes to success

According to your system request parameters , add to Corresponding request header : HTTP Header Manager

add to : Aggregation report : You can see Interface pressure measurement information

Complete the general steps above , Next, start the real interface pressure test :
testplan Right click , add to Thread group , The concept of thread group can be understood as a specific pressure measuring interface , Include request address , Parameters , Number of threads , They are all set up here

Number of threads : According to the above formula , Calculate for yourself
Ramp_Up: stay 10 Step by step within seconds 100 Threads
The duration of the : Prevent the pressure measuring interface from always executing , Make a decision The duration of the
add to HTTP request

Focus on : ${calcReceivedPromotionForProductList} This is our request parameter set , Because we want to simulate the real user request as much as possible , One way is From the online log , Pull out a batch of requests , Save in file , Let the pressure measuring interface read , and ${calcReceivedPromotionForProductList} It is the request parameters that we pull from the line . Here's how , How to add this request parameter set
add to : CSV Data file settings

In our testplan Create in folder Folder : requests, Then build : calcReceivedPromotionForProductList-test.txt file , Inside is the request parameters , I use newline splitting here

Request parameters are written , Add another Observe the fruit tree , It is used to view the response of each interface during pressure measurement , Including in and out parameters :

thus , A pressure measuring interface is written , We click Jmeter Start button on the menu bar , Test and view the aggregation report

I wrote two thread groups here , That is, two interfaces , You can follow the above steps , Add the pressure test interface you need
On line pressure test
according to Jmeter The advice of , On line pressure test , We can't use GUI, You need to use the command line .
Let's take the pressure measurement interface above for example , We Jmeter The command is executed as follows :
jmeter -n -t ./ Coupon -lzg.jmx -l ./result/result.txt -e -o ./webreport
Coupon -lzg.jmx Plan file path for test
/result/result.txt Path to test results file
/webreport by web Report save path .
Pay attention to our folders : testplan Execute this command under , It's used in We all use Relative file location , The advantage of this is , We can put testplan The folder is packed as a compressed package , Upload it to our springboard to execute the pressure test request

Command line access testplan Under the folder , perform

You can see testplan There is one more under the folder Test report

Double click to open and view the pressure test results in the browser

thus , The compilation of an on-line pressure measuring interface has been introduced , Jmeter There are some more advanced features , If you are interested, you can go to the official website to see its introduction .
边栏推荐
- Oppo K9 tests "bundling sales" and consumers "earn" or "lose"?
- JS the most commonly used sorting - hand tearing JS series
- J. Balanced Tree
- OpenGL第八章 材质material
- The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received
- postgresql 语句
- OpenGl第九章 光照贴图
- UML series articles (28) architecture modeling - collaboration
- Canvas+svg line particle animation web page background
- 1_ Attribute management function
猜你喜欢

基于SSM框架的连锁超市购物零售后台管理系统

基于SSM框架的学生在线教育教学课程管理系统

OpenGL error Guide

给孩子的国学经典

OpenGL错误指南

svg实现纸飞机自由的飞翔动画

Understand single chip microcomputer drive 8080lcd

Azure Kubernates Service 更新|提升开发体验和效率

Lecturer paging query_ Instructor condition query with page

The tide play power is really firepower! The first big screen cinema for young people? Cool open TV Max 86 "sudden attack
随机推荐
右键 powershell here 功能添加
Lianyirong (passed)
Makefile |
UML系列文章(28)体系结构建模---协作
JS top icon menu click to switch background color JS special effect
SQL查询连续三天登录的用户
基于SSM的考试项目管理系统
openssl enc 加解密
2022 年 5 月产品大事记
用Fragment实现图片简易浏览
对象存储Minio使用教程
OpenGL Chapter 7 basic lighting
Canvas+svg line particle animation web page background
Le tri le plus couramment utilisé de JS - - série JS déchiquetée à la main
{dataSource-1} closing ... {dataSource-1} closed
Understand single chip microcomputer drive 8080lcd
PostgreSQL catch exception in function
Xu Li 618, how can Suning fight this hard battle?
Canvas interactive star animation background JS special effect
【CNN】|How much position information do convolutional neural networks encode?