MQTT Broker service performance test method and device

By simulating the connection and message push between IoT devices and MQTT Broker, gradually increasing the number of devices for performance testing, solving the problem of difficulty in evaluating MQTT Broker performance in the existing technology, and achieving a rapid evaluation of MQTT Broker access capability and throughput and pressure measurement.

CN119094403APending Publication Date: 2024-12-06WUHAN FIBERHOME DIGITAL TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411342932.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

It is difficult to effectively conduct MQTT Broker service performance testing in the prior art, especially when the Internet of Things device connection is large, it is difficult to evaluate the performance and throughput of the platform.

Method used

Create simulated IoT devices through SQL scripts as MQTT publishing client, establish a connection with MQTT Broker, push messages on specific topics, and gradually increase the number of device connections until connection failure or message push failure occurs, record push rate, analyze the maximum concurrency number and Message sending throughput.

Benefits of technology

It realizes rapid evaluation of MQTT Broker's access capability and message throughput, helping the platform perform performance pressure measurement, ensuring stability and performance under limited resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094403A_ABST
    Figure CN119094403A_ABST
Patent Text Reader

Abstract

The invention discloses an MQTT Broker service performance testing method and device, and the method comprises the steps: 1, creating n * m pieces of simulation Internet of Things equipment for performance testing through an SQL script, and taking the simulation Internet of Things equipment as an MQTT publishing client; step 2, simulating m MQTT publishing clients to establish connection with the MQTT Broker, enabling all the MQTT publishing clients to push messages of specific themes to the MQTT Broker, and meanwhile, establishing connection with the MQTT Broker by the rule engine, and subscribing to and receiving messages of corresponding themes from the MQTT Broker; step 3, judging whether all the MQTT publishing clients can successfully establish connection with the MQTT Broker and normally push messages or not, if so, sequentially adding m MQTT publishing clients to establish connection with the MQTT Broker and repeatedly executing the operation of the step 2 until the MQTT publishing clients cannot be connected with the MQTT Broker or normally push messages; and step 4, recording the message pushing rate under the number of currently running MQTT publishing clients, analyzing test data, and evaluating the maximum concurrency number which can be borne by the MQTT under limited resources and the message sending throughput.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of service performance testing, and in particular to a MQTT Broker service performance testing method and device. Background Art

[0002] With the development of IoT technology, the scale of global IoT device connections is increasing day by day. The access and management of a large number of devices pose great challenges to network bandwidth, communication protocols, and platform service architecture. When selecting IoT architecture, it is particularly important to perform performance testing on the platform. Summary of the invention

[0003] In view of the technical defects and technical drawbacks in the prior art, the embodiment of the present invention provides a MQTT Broker service performance testing method and device that overcomes the above problems or at least partially solves the above problems. The specific scheme is as follows:

[0004] As a first aspect of the present invention, a method for testing the service performance of an MQTT Broker is provided, the method comprising:

[0005] Step 1: Use SQL scripts to create n*m ​​simulated IoT devices for performance testing as MQTT publishing clients.

[0006] Step 2: Simulate m MQTT publishing clients to establish connections with the MQTT Broker, so that all MQTT publishing clients push messages of specific topics to the MQTT Broker. At the same time, the rule engine also establishes a connection with the MQTT Broker, and subscribes to and receives messages of the corresponding topics from the MQTT Broker.

[0007] Step 3: Determine whether all MQTT publishing clients can successfully establish a connection with the MQTT Broker and push messages normally. If yes, add m MQTT publishing clients to establish a connection with the MQTT Broker in sequence and repeat step 2 until the MQTT publishing client fails to connect to the MQTT Broker or push messages normally.

[0008] Step 4: Record the message push rate under the number of currently running MQTT publishing clients, analyze the test data, and evaluate the maximum number of concurrent connections and message sending throughput that MQTT can withstand under limited resources.

[0009] Furthermore, the method further comprises:

[0010] Configure two servers, one as a test server and the other as the server where the IoT platform is located.

[0011] Furthermore, the method also includes: creating a MQTT protocol product on the Internet of Things platform, and defining the product's device type, object model, rule chain, and MQTT basic authentication user name and password. In step 1, a simulated Internet of Things device corresponding to the MQTT protocol product is created through an SQL script.

[0012] Furthermore, the method also includes: preparing in advance a test script for testing with the MQTTX test tool, wherein the test script is a test script for selecting a matching scenario according to the product object model, and uploading the MQTTX test tool and the test script to the same directory of the test server.

[0013] Further, in step 1, each of the MQTT publishing clients includes a unique client ID.

[0014] Furthermore, the judgment condition in step 3 also includes: observing various performance indicators of the server and whether the platform program where the MQTT Broker is located is stable.

[0015] As a second aspect of the present invention, a MQTT Broker service performance testing device is provided, the device comprising:

[0016] Create a module to create n*m ​​simulated IoT devices for performance testing through SQL scripts as MQTT publishing clients;

[0017] The simulation module is used to simulate m MQTT publishing clients to establish connections with the MQTT Broker, so that all MQTT publishing clients push messages of specific topics to the MQTT Broker. At the same time, the rule engine also establishes a connection with the MQTT Broker, and subscribes to and receives messages of the corresponding topics from the MQTT Broker.

[0018] The judgment module is used to judge whether all MQTT publishing clients can successfully establish a connection with the MQTT Broker and push messages normally. If yes, m MQTT publishing clients are added in sequence to establish a connection with the MQTT Broker and the operation of the simulation module is repeatedly performed until the MQTT publishing client fails to connect to the MQTT Broker or push messages normally.

[0019] The analysis module is used to record the message push rate under the number of MQTT publishing clients currently running, analyze the test data, and evaluate the maximum number of concurrency and message sending throughput that MQTT can withstand under limited resources.

[0020] Furthermore, the creation module is specifically used to: create a MQTT protocol product on the Internet of Things platform, and define the product's device type, object model, rule chain, and MQTT basic authentication username and password, and create a simulated Internet of Things device corresponding to the MQTT protocol product through an SQL script as an MQTT publishing client.

[0021] Furthermore, the creation module is also used to prepare in advance a test script for testing with the MQTTX test tool, wherein the test script is a test script for selecting a matching scenario according to the product object model, and uploading the MQTTX test tool and the test script to the same directory of the test server.

[0022] The present invention has the following beneficial effects:

[0023] The present invention provides a MQTT Broker service performance testing method, which simulates the MQTT workflow through the MQTTx tool, simulates the MQTT publishing client to establish a connection with the MQTT Broker, enables all MQTT publishing clients to push messages of specific topics to the MQTT Broker, and gradually increases the number of device connections until a connection failure or no message push failure occurs, thereby quickly performing a performance stress test on the platform's MQTT Broker access capability and message throughput. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 A flow chart of a method for testing the performance of an MQTT Broker service provided by an embodiment of the present invention;

[0025] Figure 2 A schematic diagram of the framework of an MQTT Broker service performance testing device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0027] like Figure 1 As shown, a MQTT Broker service performance testing method provided by an embodiment of the present invention includes:

[0028] Step 1: Use SQL scripts to create n*m ​​simulated IoT devices for performance testing as MQTT publishing clients.

[0029] Step 2: Simulate m MQTT publishing clients to establish connections with the MQTT Broker, so that all MQTT publishing clients push messages of specific topics to the MQTT Broker. At the same time, the rule engine also establishes a connection with the MQTT Broker, and subscribes to and receives messages of the corresponding topics from the MQTT Broker.

[0030] Step 3: Determine whether all MQTT publishing clients can successfully establish a connection with the MQTT Broker and push messages normally. If yes, add m MQTT publishing clients to establish a connection with the MQTT Broker in sequence and repeat step 2 until the MQTT publishing client fails to connect to the MQTT Broker or push messages normally.

[0031] Step 4: Record the message push rate under the number of currently running MQTT publishing clients, analyze the test data, and evaluate the maximum number of concurrent connections and message sending throughput that MQTT can withstand under limited resources.

[0032] The present invention provides a MQTT Broker service performance testing method, which simulates the MQTT workflow through the MQTTx tool, simulates the MQTT publishing client to establish a connection with the MQTT Broker, enables all MQTT publishing clients to push messages of specific topics to the MQTT Broker, and gradually increases the number of device connections until a connection failure or no message push failure occurs, thereby quickly performing a performance stress test on the platform's MQTT Broker access capability and message throughput.

[0033] In some implementations, the present invention also requires preparation of a test environment, including configuring two servers, one as a test server, whose IP is recorded as IP1; and the other as a server where the Internet of Things platform is located, whose IP is recorded as IP2.

[0034] In some implementations, the present invention also requires the creation of a product, including the creation of a MQTT protocol product on an IoT platform, including the definition of the product's device type, object model, rule chain, and MQTT basic authentication user name and password. In step 1, a simulated IoT device corresponding to the MQTT protocol product is created through a SQL script.

[0035] In this embodiment, 1 million simulated IoT devices for performance testing are added through SQL scripts, and the client ID of each device is imported. The client IDs of the 1 million devices are Client ID_1, Client ID_2, Client ID_3...Client ID_1000000;

[0036] In some embodiments, the present invention also requires the preparation of MQTTX script files, including the preparation of test scripts for testing by the MQTTX testing tool.

[0037] In this embodiment, a matching scenario test script is selected according to the product object model. Here, a scenario simulating industrial energy monitoring data is taken as an example, and the scenario script is IEM.

[0038] In some embodiments, the present invention also requires preparation of a test environment: including uploading the MQTTX test tool and the test script IEM to the test server host1.

[0039] In this embodiment, the MQTTX test tool and the test script IEM need to be uploaded to the same directory of the test server host1.

[0040] After the test environment is prepared, you can run the test script and execute the following process through the test script:

[0041] Simulate the workflow of MQTT. Use the MQTTX test tool to simulate 10,000 MQTT publishing clients to establish connections with the MQTT Broker and push messages of specific topics to the MQTT Broker (here, the topic is v1 / devices / me / telemetry as an example). At the same time, the rule engine also establishes a connection with the MQTT Broker, subscribes to and receives messages of the corresponding topic from the MQTT Broker, and disconnects after the test is completed.

[0042] Execute command: . / mqttx-cli-linux-x64 simulate-sc IEM -c 10000 -h'IP2' -p 1883 -u'admin' -P'123456' -I'test' -t'v1 / devices / me / telemetry'

[0043] Here, the number after -c indicates the number of device connections n;

[0044] Check whether all devices can successfully establish a connection and push messages normally, and observe whether the performance indicators of the server and the platform program where the MQTT Broker is located are stable; if the connection can be successfully established and messages can be pushed normally, and the performance indicators of the server and the platform program where the MQTT Broker is located are stable, increase the number of device connections by 10,000 and repeat the above operations, increasing the number of device connections in sequence until an error occurs. The test process is as follows Figure 1 shown.

[0045] After the test is completed, record the message push rate under the current number of running devices and analyze the test data. By analyzing the test data, you can evaluate the maximum number of concurrency and message sending throughput that MQTT can withstand under limited resources.

[0046] like Figure 2 As shown, an embodiment of the present invention further provides an MQTT Broker service performance testing device, the device comprising:

[0047] Create a module to create n*m ​​simulated IoT devices for performance testing through SQL scripts as MQTT publishing clients;

[0048] The simulation module is used to simulate m MQTT publishing clients to establish connections with the MQTT Broker, so that all MQTT publishing clients push messages of specific topics to the MQTT Broker. At the same time, the rule engine also establishes a connection with the MQTT Broker, and subscribes to and receives messages of the corresponding topics from the MQTT Broker.

[0049] The judgment module is used to judge whether all MQTT publishing clients can successfully establish a connection with the MQTT Broker and push messages normally. If yes, m MQTT publishing clients are added in sequence to establish a connection with the MQTT Broker and the operation of the simulation module is repeatedly performed until the MQTT publishing client fails to connect to the MQTT Broker or push messages normally.

[0050] The analysis module is used to record the message push rate under the number of MQTT publishing clients currently running, analyze the test data, and evaluate the maximum number of concurrency and message sending throughput that MQTT can withstand under limited resources.

[0051] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A MQTT Broker service performance test method, It is characterized in that The method comprises: Step 1: Use SQL scripts to create n*m ​​simulated IoT devices for performance testing as MQTT publishing clients. Step 2: Simulate m MQTT publishing clients to establish connections with the MQTT Broker, so that all MQTT publishing clients push messages of specific topics to the MQTT Broker. At the same time, the rule engine also establishes a connection with the MQTT Broker, and subscribes to and receives messages of the corresponding topics from the MQTT Broker. Step 3: Determine whether all MQTT publishing clients can successfully establish a connection with the MQTT Broker and push messages normally. If yes, add m MQTT publishing clients to establish a connection with the MQTT Broker in sequence and repeat step 2 until the MQTT publishing client fails to connect to the MQTT Broker or push messages normally. Step 4: Record the message push rate under the number of currently running MQTT publishing clients, analyze the test data, and evaluate the maximum number of concurrent connections and message sending throughput that MQTT can withstand under limited resources.

2. The MQTT Broker service performance testing method according to claim 1, It is characterized in that The method further comprises: Configure two servers, one as a test server and the other as the server where the IoT platform is located.

3. The MQTT Broker service performance testing method according to claim 1, It is characterized in that The method also includes: creating a MQTT protocol product on the IoT platform, and defining the device type, object model, rule chain, and MQTT basic authentication user name and password of the product. In step 1, a simulated IoT device corresponding to the MQTT protocol product is created through an SQL script.

4. The MQTT Broker service performance testing method according to claim 3, It is characterized in that The method also includes: preparing in advance a test script for testing with the MQTTX test tool, wherein the test script is a test script for selecting a matching scenario according to the product object model, and uploading the MQTTX test tool and the test script to the same directory of the test server.

5. The MQTT Broker service performance testing method according to claim 1, It is characterized in that In step 1, each of the MQTT publishing clients includes a unique client ID.

6. The MQTT Broker service performance testing method according to claim 1, It is characterized in that The judgment conditions in step 3 also include: observing the performance indicators of the server and whether the platform program where the MQTT Broker is located is stable.

7. A MQTT Broker service performance test device, It is characterized in that The device comprises: Create a module to create n*m ​​simulated IoT devices for performance testing through SQL scripts as MQTT publishing clients; The simulation module is used to simulate m MQTT publishing clients to establish connections with the MQTT Broker, so that all MQTT publishing clients push messages of specific topics to the MQTT Broker. At the same time, the rule engine also establishes a connection with the MQTT Broker, and subscribes to and receives messages of the corresponding topics from the MQTT Broker. The judgment module is used to judge whether all MQTT publishing clients can successfully establish a connection with the MQTT Broker and push messages normally. If yes, m MQTT publishing clients are added in sequence to establish a connection with the MQTT Broker and the operation of the simulation module is repeatedly performed until the MQTT publishing client fails to connect to the MQTT Broker or push messages normally. The analysis module is used to record the message push rate under the number of MQTT publishing clients currently running, analyze the test data, and evaluate the maximum number of concurrency and message sending throughput that MQTT can withstand under limited resources.

8. The MQTT Broker service performance testing device according to claim 7, It is characterized in that The creation module is specifically used to: create a MQTT protocol product on the Internet of Things platform, and define the product's device type, object model, rule chain, and MQTT basic authentication username and password, and create a simulated Internet of Things device corresponding to the MQTT protocol product through an SQL script as an MQTT publishing client.

9. The MQTT Broker service performance testing device according to claim 8, It is characterized in that The creation module is also used to prepare in advance a test script for testing with the MQTTX test tool, wherein the test script is a test script for selecting a matching scenario according to the product object model, and uploading the MQTTX test tool and the test script to the same directory of the test server.