[OpenSIPS-Users] Delay requests to avoid CPS provider's CPS limits

Bogdan-Andrei Iancu bogdan at opensips.org
Mon Mar 28 10:21:02 CEST 2016


Hi Mateusz,

You have 2 approaches:

1) send the calls to the carriers as you get them (same rate) - 90 calls 
will be rejected and you can capture that in failure route (I guess they 
will use a given reply code to indicate rejection when exceeding cps); 
in failure route, do a async sleep (or usleep) and send the call again 
to the carrier (serial forking). Hopefully, 10 more will be accepted to 
this new iteration, and you will have to get in failure route only 80.
This is a bit of a brutal approach, but it is the simple.

2) on the carrier side, use ratelimit module to control the cps (not 
more than 10 cps) - each time you send a call to the carrier, check the 
cps for that carrier -> if more than 10 -> do sleep / usleep (in async 
mode !) and retry (you can do a "while(cps>10) usleep()" )

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 28.03.2016 01:03, Mateusz Bartczak wrote:
> Hi
>
> I'm looking for a solution to nicely handle call spikes
>
> The issue is like this:
>
> I have customer generating 100 calls every 10 seconds. Not during 10 
> seconds, but exactly every 10 seconds I get 100 calls in one second, 
> next 9 seconds nothing and then next 100 calls...
>
> On the other side, I have provider that has 10 CPS limit
>
> In current setup I can only handle every 10 first calls, 90 are 
> discarded by the provider. So I can handle only 10% of customer's traffic
>
> I'm thinking about a solution to delay calls above CPS limit to the 
> nearly future. If I could delay calls 10-20 by one second, 20-30 by 
> two seconds and so on. This way, in theory, I could handle 100% of 
> calls not just 10%
>
> I can implement such thing with FreeSWITCH, call parking and some 
> fancy scripting, but FS is many, many times slower than OpenSIPS and 
> I'd like to avoid using it in such high CPS scenario
>
> Is there any pure OpenSIPS solution to this kind of problem?
>
> Best Regards
>
> Ten e-mail został wysłany z komputera wolnego od wirusów chronionego 
> przez Avast.
> www.avast.com 
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> 
>
>
>
>
> _______________________________________________
> 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/20160328/f8c37dad/attachment.htm>


More information about the Users mailing list