A Node Red node to measure the flow message speed
A Node Red node for measuring flow message speed.
Run the following npm command in your Node-RED user directory (typically ~/.node-red):
npm install node-red-contrib-msg-speed
This node will count all messages that arrive at the input port, and calculate the message speed every second.
For example when the frequency is 'minute', it will count all the messages received in the last minute:
A second later, the calculation is repeated: again the messages received in the last minute will be counted.
The measurement interval is like a moving window, that is being moved every second.
The process continues this way, while the moving window is forgetting old messages and taking into account new messages:
Remark: The message count will be displayed on the screen:
Moreover the message count will be send to the output port as message payload. An extra 'frequency' message field is also added (containing 'sec', 'min', 'hour').
Some use cases:
- Trigger an alarm e.g. when the message rate drops to 0 messages per minute.
- Performance measurement, e.g. track the number of images per second (received from a camera).
The frequency ('second', 'minute', 'hour') defines the interval length of the moving window.
Remark: when the interval becomes longer:
- It will consume more memory, to store all the calculations.
- It will take longer at startup to calculate the speed. E.g. for frequency 'hour' the speed will become only correct after one hour (i.e. when the interval of the first hour is complete).