-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rate control: add a mechanism to limit the maximum publish on mqtt
In some cases like network connection issue, the transport may queue many publish request to be sent to the broker. Without any limitation it may affect the broker performances. In fact if several gateways are in this state and back at the same time, it may generate a huge amount of traffic at the broker level. Much higher than the broker capacity. To limit this problem, a limit in number of publish per seconds can be set with option --mqtt_rate_limit_pps (or with global variable WM_SERVICES_MQTT_RATE_LIMIT_PPS) This value must be carefully chosen. If too low it may reduce the capacity of the gateway. For example if set to 10 but gateway receives in average (under normal condition) 15 packet from sink(s), gateway will always bufferize. On the other hand if set to a too high value, it will not protect the broker. As a rule of thumb, setting it to twice the maximum number of pps expected at the gateway (full packets, not fragment) is a good tradeof. With such value, if a gateway is offline for 1h, it will take another 1h when the connection is back to recover and republish the message received during the connection loss. For example if 10pps is expected and limit set to 20, and the connection is lost for 1h: - publish for 1h (10 pps are bufferized during 1h) - connection is back - publish at 20 pps(limit set): 10 pps from normal traffic + 10pps from buffers - after 1h, buffers are empty, only 10 pps (normal traffic)
- Loading branch information
1 parent
bbcb38c
commit aff767a
Showing
2 changed files
with
126 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters