How to use JMeter to support HTTP(S) Protobuf binary request body

Updated at: 2024-12-24 06:09

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

  • PTS is activated.

  • 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

  1. Configure the properties of the HTTP request, including the server name or IP, port number, and HTTP request (such as POST). image.png

    Description of configuration items on the Basic tab:

    • Protocol: Select http or https.

    • 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.

  2. Upload the binary pb file. image.png

    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.

  3. Add an HTTP Header Manager to the request.

    Specify Content-Type as application/x-protobuf. image.png

  4. Run the test plan and view the results in the View Results Tree. image

  5. After successful debugging, export the test plan file, named test.jmx here.

Step 2: Create and start JMeter performance testing

  1. Log on to the PTS console, choose Performance Test > Create Scenario, and then click JMeter.

  2. Configure a scenario.

    1. Enter the scenario name.

    2. On the Scenario Settings page, upload the test.jmx file and binary pb file exported in Step 1. image

    3. 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.image

  3. 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. image

  4. Debug and start the performance testing task.

    1. You can check whether the configurations are reasonable through Debug a stress testing scenario. To avoid performance testing failures, we recommend debugging scenarios first.

    2. 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.

  • On this page (1, T)
  • Prerequisites
  • Step 1: Use the Apache JMeter client to construct an upload script
  • Step 2: Create and start JMeter performance testing
  • Analyze the performance testing result
Feedback
phone Contact Us

Chat now with Alibaba Cloud Customer Service to assist you in finding the right products and services to meet your needs.

alicare alicarealicarealicare