mqtt-sn-tools
mqtt-sn-tools copied to clipboard
added counter and delay for load testing
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.
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 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.
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.