rumqtt icon indicating copy to clipboard operation
rumqtt copied to clipboard

Rumqttc/no panics and improved performance

Open mneumann opened this issue 4 years ago • 3 comments

  • No longer panics when a PubAck, PubComp or PubRec paket is received with a pkid outside of the inflight range.

  • Avoid cloning Publish messages with QoS=1 or QoS=2. Also avoid cloning a Publish in case of a collision. Cloning is rather expensive as all the memory has to be duplicated (topic and payload).

  • Use a bitset for incoming_pub. This drops memory from 256 KiB to just 8 KiB. Also use a bitset for outgoing_rel, but as this is limited to just max_inflight the saving are usually much less.

  • Factor out code that maintains the list of currently inflight Publish messages into ds.rs. I have some code that makes the data-structures interchangeable, but as that required some generic traits I have not included it here.

mneumann avatar Jan 26 '21 17:01 mneumann

Thanks!! These are a good list of changes. I'll run these through benchmark suite

tekjar avatar Jan 27 '21 09:01 tekjar

Hi. Sorry for the delay on this. I was in a vacation. I'm on a time crunch and I might not get enough time to properly test these changes. Can you create smaller PRs with a subset of features?

Other option is to wait until I have some time in hand to test these properly

tekjar avatar Feb 07 '21 04:02 tekjar

@tekjar Hi, yes I think that PR grew too big. I will have to split this into several independent PRs. Most importantly for me is to get away with panics in case of out-of-range packet ids. But also the unneccessary cloning of Publish is something that I want to go away. I think, the first 4 commits will fit into a separate PR. Then I will make a PR that will use the same data structure as rumqttc is using right now, but that will fix the panics.

mneumann avatar Feb 07 '21 13:02 mneumann