DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Data Engineering
  3. IoT
  4. Test an IoT Platform With Open-Source Tools

Test an IoT Platform With Open-Source Tools

This demo of JMeter using EMQX shows how to introduce performance test tools to verify and test platform-related quality indicators.

Chongyuan Yin user avatar by
Chongyuan Yin
·
Dec. 09, 22 · Tutorial
Like (1)
Save
Tweet
Share
4.45K Views

Join the DZone community and get the full member experience.

Join For Free

Introduction

The IoT industry is developing explosively. As the scale of endpoints continues to grow and business logic becomes more complex, it is necessary to verify the availability and reliability of the platform when a large number of devices are connected before the IoT platform is officially launched so as to ensure system quality. Therefore, the value and necessity of IoT performance tests are gradually highlighted. If you're delivering services, then testing your IoT system can help you find bottlenecks in performance and help you plan ahead for scalability.

IoT can consist of any number of different devices using diverse protocols strung together with complex integration architecture. This can make it challenging to design effective and meaningful tests for it. This series of articles will take the IoT platform based on EMQX as an example to introduce how to use performance test tools to verify and test platform-related quality indicators.

EMQX is a scalable messaging (MQTT) broker used to connect IoT devices. It's open source, but because it's a broker, you must have a working node to manage all the messaging traffic. You can accept its business source license (BSL) and gain 10 licenses to use the official EMQX cloud installation. Alternatively, you can install and run EMQX on your own server.

Introduction to JMeter

JMeter is an open-source software of the Apache Foundation. It mainly implements performance tests by simulating concurrent loads, which is currently the mainstream performance test tool in the open-source community. It mainly has the following advantages:

  • Built-in support for multiple protocols, including TCP, HTTP, HTTPS, and more.
  • Provides a flexible plug-in extension mechanism and supports third-party extensions of other protocols.
  • Great community support.

Install JMeter

JMeter is written in Java, so you must install Java if it's not already installed. For Linux, macOS, and Windows, you can use Adoptium.net. On Linux, you may alternatively use SDKMan.

After installing Java, download JMeter, decompress it, and enter the bin subdirectory of the archive directory. Depending on your operating system, run jmeter (Linux and macOS) or jmeter.bat (Windows).

$ wget https://dlcdn.apache.org//jmeter/binaries/apache-jmeter-X.Y.tgz
$ tar xvf apache-jmeter*tgz
$ cd apache-jmeter-X.Y/bin
$ ./jmeter


JMeter's script editing interface is presented here:

JMeter


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

1. Add a virtual user group (Thread Group): Right-click on the test plan > Add > Threads (Users) > Thread Group

JMeter Add Thread Group


JMeter uses a single thread to simulate a user, and a Thread Group refers to a group of users as a virtual user group simulating access to the system under test.

「Number of Threads」 in 「Thread Properties」 can be used to configure the number of concurrent users in a virtual user group. The higher the value, the greater the amount of concurrency; 「Loop Count」 can be used to configure how many tests each virtual user performs.

JMeter Thread Properties


2. Add the HTTP page under test: Right-click on the Thread Group > Add > Sampler > HTTP Request

JMeter Add the HTTP page


In the sample test script, use the default HTTP request settings to initiate an HTTP request to a website.

JMeter HTTP request


3. Add a result listener: Right-click on the thread group > Add > Listener > View Results Tree

The listener is not necessary for the actual performance test, but it can help you see the test results intuitively and facilitate debugging in the process of writing scripts. In this sample script, we will use 「view result tree」 to help view the response information of the request.

JMeter Add a result listener


4. Time to run the test

After saving the test script, click「Start」button in the operation bar to run the test script. It is recommended that the number of threads and the loop count in the thread group be set smaller (such as within 10) to avoid being banned.

Now, we have completed a simple HTTP test script. You can draw inferences from this case and try other protocols. In the next article, I'll introduce other test components of JMeter in more detail, which you can use together to build complex test scenarios. For now, explore JMeter to see what you can test.

Open source Apache JMeter Java (programming language) MQTT

Published at DZone with permission of Chongyuan Yin. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Introduction to NoSQL Database
  • Best Practices for Writing Clean and Maintainable Code
  • Beyond Coding: The 5 Must-Have Skills to Have If You Want to Become a Senior Programmer
  • Specification by Example Is Not a Test Framework

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: