Re: [SR-Users] Calls per second

2014-07-03 Thread Daniel-Constantin Mierla
Hello, On 03/07/14 13:37, Olle E. Johansson wrote: Hi! Have you implemented a per-customer rate limit in Calls per second? If so - how? I've played with ratelimit/pipelimit and it seems like I can define a database with one pipe per customer - but have to restart Kamailio to add customers. T

Re: [SR-Users] Calls per second

2014-07-03 Thread Carlos Ruiz Díaz
Ok. Thanks Alex. On Thu, Jul 3, 2014 at 8:00 AM, Alex Balashov wrote: > On 07/03/2014 08:52 AM, Carlos Ruiz Díaz wrote: > >> Hi, >> >> do you know how the autoexpire is implemented in the htable module? If >> it's a timer doing the polling and checking the expiration value, it may >> not be ide

Re: [SR-Users] Calls per second

2014-07-03 Thread Alex Balashov
On 07/03/2014 08:52 AM, Carlos Ruiz Díaz wrote: Hi, do you know how the autoexpire is implemented in the htable module? If it's a timer doing the polling and checking the expiration value, it may not be ideal for your CPU do it that way. Several entries will surely impact negatively on the perfo

Re: [SR-Users] Calls per second

2014-07-03 Thread Carlos Ruiz Díaz
Hi, do you know how the autoexpire is implemented in the htable module? If it's a timer doing the polling and checking the expiration value, it may not be ideal for your CPU do it that way. Several entries will surely impact negatively on the performance. I'm planning to implement this for cnxcc

Re: [SR-Users] Calls per second

2014-07-03 Thread Alex Balashov
On 07/03/2014 08:31 AM, Olle E. Johansson wrote: I really need per second, not average. I need to react FAST. That was why I picked an interval of 3. It seemed the shortest practicable interval in which to collect meaningful sampling. But if the volume of calls is so large that 1-second coll

Re: [SR-Users] Calls per second

2014-07-03 Thread Abdelkader Allam
Yes if you set the key created to auto expire in a second On Thu, Jul 3, 2014 at 12:31 PM, Olle E. Johansson wrote: > > On 03 Jul 2014, at 14:21, Alex Balashov wrote: > > > On 07/03/2014 08:18 AM, Abdelkader Allam wrote: > >> Very true Alex, didnt knew about htables, just checking about it, ve

Re: [SR-Users] Calls per second

2014-07-03 Thread Olle E. Johansson
On 03 Jul 2014, at 14:21, Alex Balashov wrote: > On 07/03/2014 08:18 AM, Abdelkader Allam wrote: >> Very true Alex, didnt knew about htables, just checking about it, very >> interesting :) The added value of Redis though is that other scripts >> running outside of Kamailio can interact with it a

Re: [SR-Users] Calls per second

2014-07-03 Thread Fred Posner
I think my head isn't fully woken up yet -- sorry about that. Fred Posner The Palner Group, Inc. http://www.palner.com (web) +1-503-914-0999 (direct) +1-954-472-2896 (fax) On 07/03/2014 07:48 AM, Olle E. Johansson wrote: > I am looking for calls setups per second - not concurrent calls. > Sorry f

Re: [SR-Users] Calls per second

2014-07-03 Thread Alex Balashov
On 07/03/2014 08:18 AM, Abdelkader Allam wrote: Very true Alex, didnt knew about htables, just checking about it, very interesting :) The added value of Redis though is that other scripts running outside of Kamailio can interact with it and potentially interact with kamailio, can an external scri

Re: [SR-Users] Calls per second

2014-07-03 Thread Abdelkader Allam
Very true Alex, didnt knew about htables, just checking about it, very interesting :) The added value of Redis though is that other scripts running outside of Kamailio can interact with it and potentially interact with kamailio, can an external script have access to htables in memory db ? On Thu,

Re: [SR-Users] Calls per second

2014-07-03 Thread Alex Balashov
On 07/03/2014 08:12 AM, Abdelkader Allam wrote: Then to check the number of invite per seconds for CUSTOMER_A smoothed over a window of 10 seconds, you count the keys in the DB that starts with CUSTOMER_A ( KEYS CUSTOMER_A*) and divide it by 10. Indeed. But one could also do this with a purely

Re: [SR-Users] Calls per second

2014-07-03 Thread Abdelkader Allam
Hello Olle, If you are to reimplement this by scripting instead of developing a C module, maybe you could use redis as a database, and for each invite of a customer, create a unique key in the redis database like this: CUSTOMER_A:CALLID Then set this key to auto expire in let's 10 seconds for in

Re: [SR-Users] Calls per second

2014-07-03 Thread Alex Balashov
I do it using htable. I maintain a rolling 3-second sample of number of calls in 'htable', the tail of which is auto-expired. The need to implement CPS limits was the basis for the 'updateexpires' option I added to the htable code in Dec 2011--I wanted updates not to cause entries' expiration t

Re: [SR-Users] Calls per second

2014-07-03 Thread Olle E. Johansson
I am looking for calls setups per second - not concurrent calls. Sorry for not being exact. /O On 03 Jul 2014, at 13:41, Fred Posner wrote: > I've done this with dialog and a sql lookup/update. > > The sql call updates the table with how many calls are in total for the > "client" and how many

Re: [SR-Users] Calls per second

2014-07-03 Thread Fred Posner
I've done this with dialog and a sql lookup/update. The sql call updates the table with how many calls are in total for the "client" and how many international calls. There's a max calls and a max international. If current < max, the call can go through. The db allows me to combine the lookup ov