Performance Testing of Long-Connection Services: Identifying and Resolving Connection Limits in MQTT with JMeter
This article explains how to conduct performance testing for long‑connection services such as MQTT using JMeter, highlights common factors that restrict connection counts like system port limits and file descriptor caps, and provides step‑by‑step instructions to adjust sysctl and ulimit settings to obtain accurate results.
Performance testing of long‑connection services, such as MQTT, requires careful monitoring of server connection counts, which are a critical metric for evaluating scalability.
The article shows how to set up the MQTT test using JMeter 4.0 by placing mqtt-xmeter-jar-with-dependencies.jar into JMeter's lib/ext directory, after which the MQTT sampler becomes available.
During execution, common errors appear, notably messages indicating that the number of open files has been exceeded.
One of the first checks is the server’s current port usage; the port count often matches the system’s configured maximum number of connections.
To increase the allowable ports, the sysctl parameter is modified (e.g., editing /etc/sysctl.conf ) and the changes are applied with sysctl -p .
When the error shifts to “too many open files,” the file‑descriptor limit must be raised; this is done by setting ulimit -n 327680 for the testing session.
After adjusting both sysctl and ulimit, the test can be rerun, yielding higher connection counts and more reliable performance data. The article notes that additional factors influencing JMeter connection limits will be covered in future posts.
360 Quality & Efficiency
360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.