[OpenSIPS-Devel] [OpenSIPS/opensips] 7461c8: Slot Based Taildrop algorithm for ratelimit

Răzvan Crainea razvan at opensips.org
Tue Feb 23 16:44:31 CET 2016


  Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 7461c83c5f1aff1ff56eed4b0af97b4b2a2bdab7
      https://github.com/OpenSIPS/opensips/commit/7461c83c5f1aff1ff56eed4b0af97b4b2a2bdab7
  Author: ionutrazvanionita <ionutionita at opensips.org>
  Date:   2016-01-05 (Tue, 05 Jan 2016)

  Changed paths:
    M modules/ratelimit/README
    M modules/ratelimit/doc/ratelimit_admin.xml
    M modules/ratelimit/ratelimit.c
    M modules/ratelimit/ratelimit.h
    M modules/ratelimit/ratelimit_helper.c

  Log Message:
  -----------
  Slot Based Taildrop algorithm for ratelimit

    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 the bin interface, allowing
to have 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.


  Commit: 225307178ebe13f781065a69e58c1ab641576e5e
      https://github.com/OpenSIPS/opensips/commit/225307178ebe13f781065a69e58c1ab641576e5e
  Author: Răzvan Crainea <razvan at opensips.org>
  Date:   2016-02-23 (Tue, 23 Feb 2016)

  Changed paths:
    M modules/ratelimit/README
    M modules/ratelimit/doc/ratelimit_admin.xml
    M modules/ratelimit/ratelimit.c
    M modules/ratelimit/ratelimit.h
    M modules/ratelimit/ratelimit_helper.c

  Log Message:
  -----------
  Merge pull request #728 from ionutrazvanionita/rlimit

Slot Based Taildrop algorithm for ratelimit


Compare: https://github.com/OpenSIPS/opensips/compare/cec0c7244e3e...225307178ebe


More information about the Devel mailing list