[SR-Users] rate limit module

Fabian Borot fborot at hotmail.com
Fri Dec 2 20:56:28 CET 2011





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.


 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20111202/c24cece3/attachment-0001.htm>


More information about the sr-users mailing list