This topic describes how to use Apache JMeter-based performance testing feature of Performance Testing (PTS) to support HTTP(S) Protobuf binary request body.
Prerequisites
This example uses
Apache JMeter 5.6.3
to create scripts. PTS supports JMeter 5.0 and 5.6.3.
Step 1: Use the Apache JMeter client to construct an upload script
Configure the properties of the HTTP request, including the server name or IP, port number, and HTTP request (such as POST).
Description of configuration items on the Basic tab:
Protocol: Select
http
orhttps
.Server name or IP: specifies the API domain name, for example,
localhost
.Port Number: specifies the service port number, for example,
9889
.Method: Select
GET
.
Upload the binary pb file.
Description of configuration items on the Files Upload tab:
File Path: specifies the name of the file to be uploaded to the JMeter scenario, excluding the local path. For example,
test.pb
.MIME Type: specifies the MIME type of the file, for example,
application/octet-stream
.
Add an HTTP Header Manager to the request.
Specify Content-Type as application/x-protobuf.
Run the test plan and view the results in the View Results Tree.
After successful debugging, export the test plan file, named
test.jmx
here.
Step 2: Create and start JMeter performance testing
Log on to the PTS console, choose , and then click JMeter.
Configure a scenario.
Enter the scenario name.
On the Scenario Settings page, upload the
test.jmx
file and binary pb file exported in Step 1.Select the Jmeter Version. Here, select
5.6.3
. Note that the version should be consistent with the local JMeter version used to create the script. Otherwise, an error may be reported.
Configure a performance testing task.
In this example, the performance testing is initiated from the Alibaba Cloud VPC. You are charged for performance testing. You can select stress sources and stress parameters based on your needs. For more information, see Configure the stress testing model and level and Billing overview.
Debug and start the performance testing task.
You can check whether the configurations are reasonable through Debug a stress testing scenario. To avoid performance testing failures, we recommend debugging scenarios first.
After successful scenario debugging, click Save and Test. On the Tips page, select Trigger Now and Make sure that the test is approved and complies with local laws, and then click Start Testing.
Analyze the performance testing result
After the performance testing is finished, the system automatically obtains the performance testing data and generates a performance testing report. The performance testing data includes the performance testing scenario metrics, business details, monitoring details, and API sampling logs. For more information, see View a JMeter performance testing report.