Resolving Port and File Descriptor Limits in MQTT Performance Testing with JMeter
This article explains how to identify and resolve two common factors—port number limits and file descriptor limits—that restrict server connection counts during MQTT performance testing with JMeter, providing step‑by‑step guidance and command‑line adjustments such as updating the ulimit value.
When conducting performance testing for long‑living connections, the number of server connections is a critical metric, but various factors can artificially cap this count, leading to inaccurate results.
The test scenario uses an MQTT service (details omitted) and JMeter 4.0; the required mqtt-xmeter-jar-with-dependencies.jar must be placed in JMeter's lib/ext directory so that MQTT appears under the sampler list.
After skipping script creation details, the test is run and errors appear in the log.
The first issue relates to the system's port number range, which often mirrors the maximum number of simultaneous connections; adjusting the port range resolves this limitation.
Changes to the port range become effective after executing sysctl -p , after which the connection count can be re‑checked.
A subsequent error indicates that too many files are open, revealing that the process has hit the maximum file descriptor limit.
To increase this limit, the command ulimit -n 327680 is applied, allowing a higher number of concurrent connections.
These two factors—port range and file descriptor limits—significantly affect JMeter's ability to simulate many connections; further articles will explore additional influences.
360 Tech Engineering
Official tech channel of 360, building the most professional technology aggregation platform for the brand.
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.