mqtt-sn-tools icon indicating copy to clipboard operation
mqtt-sn-tools copied to clipboard

added counter and delay for load testing

Open saumilsdk opened this issue 3 years ago • 3 comments

Added counter to send the same message multiple times to generate load using same connection. Delay is used to delay the messages set in counter.

saumilsdk avatar Jan 14 '21 10:01 saumilsdk

I am not sure about adding the new --count option - not sure how widely useful it is for other people. For sending lots of packets for load testing, you could pass in lots of packets to STDIN with the -l option. Would that work for you? It also has the advantage that you could send a variety of packets if you wanted to.

Although I can see how it might be useful to add a delay between publishing messages. Please can you create a separate PR for just adding --delay? - for use within this loop: https://github.com/njh/mqtt-sn-tools/blob/master/mqtt-sn-pub.c#L227

Also you have done some code style changes in this PR, not just new features. The code style for this project is:

  • K&R style
  • Indented 4 spaces
  • Switch and case statements should be indented

Thanks!

ps. what are you load testing? 🙂

njh avatar Jan 15 '21 17:01 njh

@njh I had to load test MQTT-SN server along with number of messages a server with limited resources like 2GB RAM and 1 core can take how many messages. Count is really helpful in sending messages along with use of delay. I would recommend to have both options enabled.

I will also change back formatting style to what you are recommending.

saumilsdk avatar Jan 26 '21 08:01 saumilsdk

Thanks for the update.

I am sure it is useful to be able to load test and specify a number of packets to send. But I am not sure it should be in the main mqtt-sn-pub.c as it is specific to load testing and adds complexity.

I am wondering about having a separate load test tool (mqtt-sn-load-test?) that is specifically for this purpose. It could just be a wrapper round mqtt-sn-pub and could either be a bash script of C programme.

njh avatar Jan 26 '21 09:01 njh