# Pressure measuring tool
In order to facilitate the business to do Mini programs before the official launch or marketing activities before the launch of the real full-link pressure test, timely detection of service bottlenecks, WeChat Mini Program team launched in the security gatewayPressure measuring toolUse WeChat real account to request Mini Program business interface & WeChat open interface to carry out full-link pressure test. Real restore the massive high concurrency and other complex scenarios of the business, to help developers evaluate the performance and stability of the Mini Program in the case of high concurrency, in order to find and solve potential performance problems in time. We can test the response time, throughput and concurrency of Mini Program under different load, and then determine the maximum load carrying capacity and bottleneck of Mini Program.
<a href="https://developers.weixin.qq.com/community/business/doc/0002c8c110c23810b5f1bf61b61c0d target="_blank" data-ctabtn>
The added value capability of the pressure measuring tool as a security gateway, the security gatewayStandard EditionAnd the above package version is supported, the starter version and the basic version need to be upgraded toStandard EditionAfter use.
# Pressure measuring task
Go toSecurity Gateway - Extended Capabilities - Pressure Measuring ToolsNew pressure measurement taskPressure test task is pure pressure test logic part, if you need to perform pressure test, you need to make an appointment for pressure test.
# Pressure Test Task Editor
The editor interface consists of two parts: the request list and the request settings. At the same time, the editor supports setting the name of the pressure test task and selecting the pressure test Mini Program.
- Pressure Test Task Name: The task name can be used to distinguish different pressure test tasks, such asActive pressure measurement, not more than 32 A character.
- Pressure test Mini Program: the task is to press the Mini Program dimension, in order to determine the identity of the Mini Program used by the pressure test task, including the identity of the WeChat interface, will affect the wx.login,wx.getUserProfile Such interface call results, and the gateway request, the server received x-wx-appid The value of.
- Request List: The request list shows the requests used in this pressure test, and supports dragging to change the order of requests. Click a request to switch the request editor to the request.
- New Request: Supported pressure test requests are as follows:
- Business request, gateway.call,That is, the URL of the Mini Program configured in the gateway access layer for the pressure measurement Mini Program (the unconfigured Mini Program does not support the pressure measurement)
- WeChat Request, i.e. wx Object in the form of a callback API, currently supports WeChat login and Weixin Pay 8 Support more other WeChat open interfaces
- Cloud function request, that is, the cloud function request in WeChat cloud development, only the cloud function created by the Mini Program in WeChat cloud development
- Wx.request (not currently supported)
# Request settings
- Request Name: A custom request name is supported for each test request.
- Request gateway domain name: Select the gateway domain name corresponding to the configuration of the gateway access layer in the pressure test Mini Program.
- Request interface: fill in the request interface content that needs to be pressed.
# WeChat Request
When using WeChat to request, you need to refer to the official WeChat document to fill in the parameters required for pressure measurement. Some interfaces do not require parameters, such as wx.login)。
# Business request
- The business interface supports setting the requested HTTP Method, the requested Header, URL (Path), Request Body。
- The default request Header for Content-Type: application/JSON, which can be flexibly adjusted as needed.
- Requests for support Body The format is text, the rest is not supported.
# Extraction settings
Request support for setting parameter extraction, you can use the JSONPath The form is extracted. The extracted parameters can be referenced in subsequent interface parameters in the form of ${extract_name}。
# WeChat interface
The extraction of WeChat interface is set to fixed extraction, and the default parameters supported for extraction are as follows:
- wx.request
- Code
- wx.requestPayment
- qrcode _img
- Data
# Business interface
Business interface is used to request the business interface, which can simulate gateway.call Of the request.
- Data structure and parameter extraction
- The gateway interface supports the use of JSONPath To perform parameter extraction in the form of $.data.x.y.z。 The structure of the gateway return packet is as follows:
{
data: {}, // The packet contents returned
http_code: 200, // Status code returned
status: 1, // Pressure measurement status, see the table below
headers: [], // Returned Header List, structured as {"k": "key", "v": "value"}
}
- When you need to reference the contents of the gateway's return for extraction, you can do so by JSONPath In the form of extraction:
- Ordinary object extraction: $.data.x.y.z
- Extraction of Array Subscripts: $.data.arr.0.x.y.z
- Extracts in other formats, can be referred to JSONPath The documentation of the
- Differentiated gateway request The gateway request carries a special Header, the server can use the Header Determine if a request comes from a pressure measuring tool
- x-wx-source: wx-pressure-test
- Pressure Test Status List
{
0: "Normal,"
10001: 'Ininitialization configuration failed ',
10002: 'transfer configuration list empty ',
10003: 'JSON parsing failed ',
10004: 'JSLogin failed ',
10005: 'gateway call failed ',
10006: 'Get return result error ',
10007: 'JSON to PB parsing error ',
10008: 'setting cache error ',
10009: 'Get result empty ',
10010: Failed to get the serial number,
10011: 'failed to create API ',
10012: 'parsing content error ',
10013: 'Get UUID failed ',
10014: 'failed to get the stored UUID ',
10015: 'Update Payment UUID Storage Error ',
10016: 'JSON parsing failed ',
10017: 'DOC parsing failed ',
10018: 'BASE64 encoding failed ',
10019: 'Checking conditional statement error ',
10020: 'HTTPCode Error ',
10021: 'parsing data error ',
}
# Pressure measuring condition
Request support to set pressure test conditions, pressure test conditions do not pass, automatically stop the next request pressure test.
Pressure test conditions support expression conditions (custom) and request conditions, expression support include, do not include, equal, not equal.
# Expression condition
The expression condition uses the JSONPath Make a judgment, consistent with the parameter extraction, using the $.data.x.y.z
The left value of an expression is defined in the form of a. The right value is a character string.
# Request condition
Request conditional support determines the following conditions:
- Request return status code: HTTP Status code
- Pressure Measurement Status: Same as abovePressure Test Status ListConsistent with the status codes defined in
The left and right sides of the expression are converted to a character string for comparison.
# Pressure testing and debugging
In the pressure measurement task, clickdebuggingButton to enter the pressure test debugging, will show the current pressure test task, the implementation of each interface, the implementation of the results, and the corresponding return value/Header Wait for information. If there is an error in the middle of the pressure test interface, or the condition judgment is not passed, the pressure test task will automatically stop.
# Appointment pressure measurement
To book a pressure test, click on the top right corner of the target pressure test task cardAppointment pressure measurementCan be, after the appointment is successful, can be found inAppointment ListFor specific appointment information.
<a href="https://developers.weixin.qq.com/community/business/doc/0008eedea80970c0b5f1eca696d00d target="_blank" data-ctabtn>
- Appointment Name: used to identify the current pressure test appointment task, support arbitrary naming
- target QPS: That is, the QPS quota that is required for the appointment to perform the pressure measurement taskAs the desired pressure test target QPS Greater than the current gateway package QPS Amount, you need to purchase an additional security gateway resource pack for pressure measurement
- Pressure measurement duration: currently supports 5 min, 10 min, 15 min, 20 min, 25 min, 30 min
- Pressure test time: Please arrange the appointment time reasonably, do not exceed the effective time range of the purchased gateway resource pack, only one pressure test task can be booked per unit time.
- Appointment task valid time: that is, the appointment pressure test task can be executed valid time, a pressure test appointment task valid time is 30 minutesIf you have an appointment for the pressure test at 00: 00 on July 11, you will support clicking before 00: 30.Perform pressure measurementStart pressure test
Dxplaination:
- After the appointment is completed, the specific appointment information will be displayed in the appointment list, and the pressure test can be carried out on time. If the pressure test is not carried out after the appointment period, the appointment task will expire and you need to make a new appointment.
- After performing the appointment pressure measurement task, the platform will carry out real-time on-line pressure measurement in accordance with the appointment pressure measurement QPS.In case of problems, you can terminate the pressure test at any time, the pressure test is the end of the pressure test, do not support to restart.
- The pressure test is a real user request for the Mini Program, in order to ensure the normal operation of the business backend, please prepare the resources before the appointment pressure test task begins.
- Because a pressure test reservation task is valid for 30 minutes, only one pressure test task is supported in 30 minutes.If you have booked the pressure test at 000000 on July 11, the next appointment task needs to start at 000031 on July 11, because the effective time is 30 minutes.
# Buy Gateway Resources
As a supplement to the security gateway package, after purchasing the gateway resource package, you can increase the QPS amount of pressure measurement on the basis of the original gateway package. After the purchase is successful, it will beAppointment ListShow in.
- Pressure measurement QPS: Purchase according to business pressure measurement needs, the purchased resources QPS need to be 100 multiples, maximum support 10wQPS
- Pressure test time: only support to buy by day, the default valid time is 00: 00-23: 59If the pressure test time is selected on July 12, the gateway resource pack is valid from 00: 00-23: 59 on July 12.
- Pressure measurement QPS billing unit price: 99.9 yuan/100(QPS*2Mbps)/Days, if any discount will be reflected in the price calculation
Dxplaination:
- After the gateway resource purchase, within the validity period of the gateway resource limit, support any appointment and perform pressure measurement tasks
- The QPS quota that can support pressure measurement is the sum of the QPS quota of the security gateway package and the QPS quota of the gateway resource packageIf the security gateway package QPS is 1000, and the additional 9000 QPS pressure measurement gateway resource package is purchased, the maximum pressure measurement QPS can be supported is 1000 + 9000 = 10000 QPS.
# Pressure measurement report
After you execute a scheduled stress test task, you can generate a stress test report and click the scheduled stress test taskPresentationYou can view the pressure test report.
<a href="https://developers.weixin.qq.com/community/business/doc/000e6c271648e0a0b6f1010ad6b00d target="_blank" data-ctabtn>
# Common problem
- Is the pressure measuring tool directly online?
- A: Here we distinguish between WeChat interface and business interface:
- a. WeChat interface, is carried out online Yes, the pressure test is carried out with a real WeChat account on the target mini program's WeChat interface for the actual online pressure test. Here is a premise risk please know, WeChat interface pressure test for online pressure test, please pay attention to the WeChat interface frequency limit, pressure test beyond the WeChat interface frequency limits, the WeChat interface request will fail.
- b. Business interface, according to the business interface domain name is a test environment domain name or a formal environment domain name, if the business interface domain name is filled in the online environment domain name, it is carried out online.In addition, please evaluate by yourself whether the back-end resources of the target Mini Program are sufficient and how much pressure can be supported to prevent the situation that the pressure measurement is too large and the back-end service crashes.
- How to determine whether the Mini Program business request is from the pressure test task?
- A: Pressure measured HTTPS Request, header Will bring x-wx-source: wx_gw _load_testing
- Add a business request debugging not available, prompt not in the white list?
- Answer: Currently, the service interface supported by pressure testing tools is to read the URLs of Mini programs configured by Mini programs on the gateway access layer. Pressure testing is not supported for those not configuredYou can go firstAccess layer - Target access domain name - ModifyChoose to add the corresponding Mini Program URL. If you are worried that configuring the Mini Program URL will affect the online business, you can directly select the version configurationNo accessIt does not affect online business at all.