preface

The Internet of Things is exploding. With the increasing scale of devices and the increasingly complex business logic, the Internet of Things platform needs to verify the availability and reliability when a large number of devices are connected to the platform to ensure system quality before it is officially launched. Therefore, the value and necessity of Internet of Things performance testing are gradually highlighted.

On the one hand, performance testing provides a basis for evaluating iot systems and verifies them from multiple dimensions of design indicators, scalability and reliability. On the other hand, performance testing also contributes to the optimization of iot systems, helping to find system performance bottlenecks early and providing tuning suggestions. In addition, performance testing can assist capacity planning and provide reference for future capacity expansion plans.

The characteristics of the Internet of Things system, such as large number of access devices, diversified protocols, complex integration architecture and frequent cross-department development collaboration, also make the Performance test of the Internet of Things face numerous challenges. This series of articles will take the Internet of Things platform based on EMQ X as an example to introduce how to use performance testing tools to verify and test platform-related quality indicators.

Choice of test tool – Introduction to JMeter

We chose JMeter as the test tool.

JMeter is an open source software developed by the Apache Foundation. It simulates concurrent loads to perform performance testing. JMeter is a mainstream performance testing tool in the open source community. It has the following advantages:

  • Built-in test support for multiple protocols, such as TCP, HTTP/HTTPS, etc.
  • Provides a flexible plug-in extension mechanism to support third-party extension of other protocols. For a wide variety of protocols in the Internet of Things system, the required protocol business logic needs to be customized according to the requirements of JMeter framework, which can be easily put into JMeter plug-in library, and the existing functions of JMeter can be used to test the performance of the protocol.
  • Good community support.

The installation of the JMeter

The latest stable release of JMeter is 5.4.1. Since JMeter is Java-based, the 5.4.1 release of JMeter requires Java 8 or higher support (available at: www.oracle.com/java/techno,…). .

After installing Java, downloaded from the website JMeter:jmeter.apache.org/download_jm… .

Decompress the file and go to the bin subdirectory in the decompressed directory. Depending on your operating system, run jmeter.bat (Windows) or Jmeter (Unix). If all goes well, JMeter’s script editing interface should be right in front of you:

Next, let’s use HTTP as an example to see how to build and run a simple test case using JMeter.

  1. To add a virtual User Group, right-click test Plan > Add > Thread (User) > Thread Group

    JMeter uses a single Thread to simulate a user. A Thread Group is a virtual Group of users that simulate access to the system under test.

    The number of threads in Thread Property can be used to configure the number of concurrent users of the virtual user group. A higher value indicates a larger number of concurrent users. Cycles can be used to configure how many tests are performed per virtual user.

  2. To add an HTTP page under test, right-click thread Group > Add > Sampler > HTTP Request

    In the sample test script, only the default HTTP request Settings are used to send HTTP requests to the Bing website. You can configure the Settings as required.

  3. Add a result listener: right – click thread Group > Add > Listener > view the result tree

    Listeners are not necessary to actually run performance tests, but they can help you visualize test results during scripting and facilitate debugging. In this sample script we will use the View Result tree to help view the response information for the request.

  4. Run the tests.

    After saving the test script, click the “Start” button in the action bar to start running the test script. It is recommended that the number of threads and loops in a thread group be set to a smaller number (e.g., less than 10) to avoid ban.

That completes a simple HTTP test script. You can try other protocols. In the next article, we’ll take a closer look at JMeter’s various test components, which can be used together to build more complex test scenarios.

Copyright: EMQ

Original link: www.emqx.com/zh/blog/int…

Technical support: If you have any questions about this article or EMQ related products, please visit askemq.com to ask questions. We will respond to you in time.

More technical dry goods, welcome to our official account [EMQ Chinese community].