HiveMQ MQTT 5 Async Client Consuming Messages Slowly from Subscribed Topic

Hi Team,

We are executing one load test of 5K messages onto MQTT broker in one hour and we have one Java MQTT 5 Async Client subscribed to the respected topic which is consuming the messages slowly. One hour of load testing of 5K messages is getting completed in 2 hours.

My question is: Is there a limitation on the MQTT client that it will consume only a certain number of messages within a time interval? If yes, then Is there a way to exceed the capacity of the MQTT Async client to pick messages from the broker, like increase the number of thread for one single MQTT client?

Hi @hussainbadshah,

Thank you so much for your enthusiasm and for being a part of the HiveMQ Community! It’s always a pleasure to welcome passionate users like you who are eager to dive into MQTT and the HiveMQ broker.

Regarding the issue you’re facing, I want to reassure you that there isn’t any inherent limitation in the MQTT protocol or the HiveMQ MQTT 5 Async Client that would restrict the number of messages consumed within a certain time frame. The slower consumption you’re experiencing could stem from various factors, such as client configuration, message QoS, payload size, processing logic, network conditions, or resource limitations on your client machine. However, it’s important to note that this isn’t a built-in limitation of the client itself.

To assist you further, it would be great if you could share the actual Java code of your client. Reviewing the code will allow us to provide more detailed analysis and specific suggestions. If possible, providing access to the repository would be ideal, but of course, feel free to share in the way that’s most convenient for you.

Best regards,
Dasha from the HiveMQ Team

@Daria_H thank you for your quick reply. One query, one of the reasons you stated above was “message QoS” , does QoS play a vital role in consuming messages from the subscribed topic? I was under the notion that QoS plays role only at the time of publishing the message to MQTT broker.

@Daria_H one more question, is there anything in the Java MQTT Async client configuration through which we can increase its threads that would be working to consume messages from the subscribed topic(s)? For example, for our current scenario, for all the 5K messages, I see that those have been consumed and processed by the same thread named “Rx-computation-thread-pool-1”. So is there a way to increase this number of threads?

Hi Hussain,

Thank you for your message and your continued engagement with the HiveMQ Community!

I appreciate your question regarding the multi-thread pool in the Java MQTT Async Client. However, I’m unable to see which specific line in your code you’re referring to about the thread configuration for consuming messages. Could you please provide more context or share the relevant portion of your code? This will help me better understand your implementation and offer more precise guidance.

Looking forward to your response!

Best regards,
Dasha from the HiveMQ Team