Replies: 2 comments 1 reply
-
Generally agree but this is likely not possible without a major refactor of the project. There are 3 go routines per client:
In theory there are ways you could reduce the number of goroutines, but as I can think of, each comes with fairly severe penalties - such as slow clients blocking subsequent connections, or writing blocking reading. I would say that hundreds of thousands of connections is currently outside the scope of this project - if you need that type of capacity I would be more comfortable recommending something like NATS or one of the many excellent enterprise MQTT solutions. That said, always open to optimisation ideas! |
Beta Was this translation helpful? Give feedback.
-
I don't see a problem with running a few hundred thousand goroutines, fwiw. They're not threads. Also, starting to optimize before we can measure the impact doesn't sound like a good idea. If we could see a significant performance degradation at some point then that would be a target to work against. |
Beta Was this translation helpful? Give feedback.
-
Mochi MQTT creates 3 goroutines for one client,When there are hundreds of thousands or a million of connections, the impact on performance can be significant.
Should be optimized,Please refer to the https://speakerdeck.com/eranyanay/going-infinite-handling-1m-websockets-connections-in-go
Beta Was this translation helpful? Give feedback.
All reactions