简体   繁体   中英

MQTT (Mosquitto) Connection pool?

What would you suggest for Mosquitto connection pooling in Java? We are wasting (blocking) too much time on establishing each connection, so we think some kind of reuse would be better.

I'd suggest using the generic object pooling in the Apache commons tools https://commons.apache.org/proper/commons-pool/

But also you could extend Thread to instantiate a MQTT connection object on creation and have a persistent connection per thread. This could be combined with the built in thread pool in the standard class libraries.

I assume you do have a fixed number of threads (or a suitably constrained thread pool as burning though threads will kill performance as well)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM