[OpenSIPS-Users] Ratelimit CPS Algorithms

Alain Bieuzent alain.bieuzent at free.fr
Tue Jan 31 15:36:48 UTC 2023

Hi James,


After spending hours understanding how the different algorithms work, we selected the "TAILDROP" with the following parameters:


modparam("ratelimit", "timer_interval", 1)

modparam("ratelimit", "default_algorithm", "TAILDROP")

modparam("ratelimit", "hash_size", 2048)


it does the job (it drops what it takes!).

The only thing I can advise you is to cache the limitation for each IP, because if you must query your database to obtain the limitation, in case of DDOS, your server will crash because of the possible slowdown of the database queries.




De : Users <users-bounces at lists.opensips.org> au nom de James Seer <sj6502621 at gmail.com>
Répondre à : OpenSIPS users mailling list <users at lists.opensips.org>
Date : lundi 30 janvier 2023 à 14:33
À : <users at lists.opensips.org>
Objet : [OpenSIPS-Users] Ratelimit CPS Algorithms


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% load)
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

_______________________________________________ Users mailing list Users at lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20230131/f36d2f3f/attachment.html>

More information about the Users mailing list