In this new algorithm a window is held per every pipe, which is defined by two parameters: window_size(seconds) and slot_period(microseconds). The number of slots is window_size*1000/slot_period. The window is updated with every call received and it's implemented as a circular vector, which modifies it's start based on the elements that were dropped.
How is the window updated: * if no message comes in 2*window_time from when the window start was set , it means we can't use the values from any of the slots and we set the value from any of the slots to 0; the window start time is updated; * if the message comes in t=[start+window_time; start+2*window_time) it means that we can keep the values in slots in the interval [t-window_time;start+window_time) and drop the ones in [window_time; t-window_time); the window start time is updated; * it the message come in t=[start; start+window_time) we don't do any update do the window, only to the value of the slot corresponding to time t; The algorithm also shares this value through bin interface, allowing having the values from all the replicas. Also, before sending the value through the interface, the replica checks the window in order to send only the values in valid slots. Two different functions were made because of efficiency reasons. When replicating we only do some very short loops or maybe nothing. You can view, comment on, or merge this pull request online at: https://github.com/OpenSIPS/opensips/pull/728 -- Commit Summary -- * Slot Based Taildrop algorithm for ratelimit -- File Changes -- M modules/ratelimit/README (61) M modules/ratelimit/doc/ratelimit_admin.xml (91) M modules/ratelimit/ratelimit.c (129) M modules/ratelimit/ratelimit.h (19) M modules/ratelimit/ratelimit_helper.c (81) -- Patch Links -- https://github.com/OpenSIPS/opensips/pull/728.patch https://github.com/OpenSIPS/opensips/pull/728.diff --- Reply to this email directly or view it on GitHub: https://github.com/OpenSIPS/opensips/pull/728
_______________________________________________ Devel mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
