[OpenSIPS-Users] Ratelimit CPS Algorithms

James Seer sj6502621 at gmail.com
Thu Jan 19 19:04:18 UTC 2023

I'm trying to find the best way to control calls coming to my opensips box
using the Ratelimit module.
i'm setting a specific cps limit to each customer via its ip source and i
want precision and accuracy without exhausting my server (vultr virtual
machine 2 cores, 4gb ram with 2gb dedicated to opensips shared memory and
32m shared + 8 udp workers with a profile scalling up to 16 workers on 70%
I was able to achieve what I wanted by using the SBT algorithm, a
window_size of 1 second and slot_period of 200 milliseconds, 5 slots in
total. Most of my customers have a 5 to 20 cps limit.

modparam("ratelimit", "window_size", 1)
modparam("ratelimit", "slot_period", 200)

if(!rl_check("RL_$si", 5, "SBT")) send_reply("403", "Cps Exceeded");

I admit not being able to understand how the SBT algorithm works via the
documentation, I wanted to know if the values i set for window_size and
slot_period are the best for CPS Limitation.
Also do you confirm that SBT is the most accurate among other ratelimit
algorithms for calls per second limitation ?

Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20230119/e92fe94a/attachment.html>

More information about the Users mailing list