[SR-Users] rate limit module

Ovidiu Sas osas at voipembedded.com
Fri Dec 2 23:16:22 CET 2011


It is "allow up to 50 calls/30sec".
You can verify that by observing the debug logs.

Regards,
Ovidiu Sas

On Fri, Dec 2, 2011 at 4:11 PM, Fabian Borot <fborot at hotmail.com> wrote:
>
> thank you Ovidiu, the debug it really helps.
> please help me out with these questions though:
>
> modparam("ratelimit", "timer_interval", 30)
>  modparam("ratelimit", "pipe", "0:TAILDROP:50")
>
> does this mean "allow up to 50 calls/sec" or "allow up to 50 calls/30sec"
>
> or is the logic similar to:
>
> every 30 seconds get a count of messages, if algorithm's threshold is set to
> 50calls/sec, then after the timer elapses (30 secs) if there are more than
> 50 * 30 calls/transactions during the past 30 secs then drop the next call?
>
>  with these settings should be "no more than 50 calls every second"
>
> modparam("ratelimit", "timer_interval", 1)
>  modparam("ratelimit", "pipe", "0:TAILDROP:50")
>
> I really appreciate your assitance here.
> txs a lot in advance
> fborot
>
> ________________________________
> From: fborot at hotmail.com
> To: users at lists.kamailio.org
> Subject: rate limit module
> Date: Fri, 2 Dec 2011 14:56:28 -0500
>
>
> Hello,
>
> I am trying to use the rate limit module using Kamailio 1.5.2. I feel that I
> got it but I would
>  like some pointers and recommendations.
>
> These are my settings: (this is a lab of course), I used 1 on the
> timer_interval because I am
>  generating the calls manually and wanted to see it in action quickly:
>
>
> # ---- ratelimit -------
> modparam("ratelimit", "timer_interval", 1)
> modparam("ratelimit", "reply_code", 506)
> modparam("ratelimit", "reply_reason", "Rejecting due to high load")
> modparam("ratelimit", "queue", "0:INVITE")
> modparam("ratelimit", "pipe", "0:TAILDROP:1")
>
>
>  then in the route section:
>
>
>         if (method=="INVITE") {
>                 xlog("L_INFO","mylog: RL found INVITE.\n");
>                 if (!rl_check()) {
>                         xlog("L_INFO","mylog: RL dropped message.\n");
>                         rl_drop();
>                         exit;
>                 };
>                 xlog("L_INFO","mylog: RL found INVITE but did not drop
> it.\n");
>         };
>
>
> The TAILDROP algorithm seems to work better than the RED, based on what I
> expected of course (with 1 sec timer interval and 1 calls/sec on the pipe).
> Making manual calls one right after the other almost always triggered the
> protecting when there was another call on the same second.
>
>
> But these lines (1.6.3. pipe) on the doc got me kind of confused:
>
> " When specifying a limit, the unit depends on the algorithm used and
> doesn't need to be specified also (eg, for TAILDROP or RED, limit means
> packets/sec, whereas with the FEEDBACK
> algorithm, it means [CPU] load factor).
>
> For these 2 lines below, does this mean that the interval =10 will be
> overridden by the 100 calls/sec on the TAILDROP algorithm?
>
> modparam("ratelimit", "timer_interval", 10)
> modparam("ratelimit", "pipe", "0:TAILDROP:100")
>
> I made a quick test and with timer_interval = 10 and TAILDROP:1, it looks
> like the protection kicks in almost every 10 secs: (Dec 2 19:44:07  and Dec
> 2 19:43:57),
>
>  tail -f proxy.log | grep RL
> Dec  2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.
> Dec  2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.
> Dec  2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.
> Dec  2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.
> Dec  2 19:43:53 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:43:54 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.
> Dec  2 19:43:54 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:43:55 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.
> Dec  2 19:43:55 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:43:56 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.
> Dec  2 19:43:56 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:43:56 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.
> Dec  2 19:43:56 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:43:56 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.
> Dec  2 19:43:56 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:43:57 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.
> Dec  2 19:43:57 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:43:57 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.
> Dec  2 19:43:57 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL dropped
> message.
> Dec  2 19:43:58 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.
> Dec  2 19:43:58 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:43:59 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.
> Dec  2 19:43:59 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:43:59 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.
> Dec  2 19:43:59 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:44:01 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.
> Dec  2 19:44:01 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:44:02 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.
> Dec  2 19:44:02 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:44:02 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.
> Dec  2 19:44:02 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:44:04 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.
> Dec  2 19:44:04 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:44:06 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.
> Dec  2 19:44:06 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:44:06 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.
> Dec  2 19:44:06 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:44:07 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE.
> Dec  2 19:44:07 AW-ATL-PROXY-01 ./kamailio[17449]: mylog: RL found INVITE
> but did not drop it.
> Dec  2 19:44:07 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.
> Dec  2 19:44:07 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL dropped
> message.
> Dec  2 19:44:10 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE.
> Dec  2 19:44:10 AW-ATL-PROXY-01 ./kamailio[17450]: mylog: RL found INVITE
> but did not drop it.
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>



More information about the sr-users mailing list