[SR-Users] LCR Routes and memory allocations

Daniel-Constantin Mierla miconda at gmail.com
Mon Mar 14 10:38:36 CET 2011


Hello,

popping in to add some clarifications/hints regarding some statements in 
this thread...

Loading of LCR rules from database is done through private memory, but 
the records are loaded in chunks. So you should be fine with 4MB of 
memory. If it is not enough for startup/reload time, just lower the 
valuu of fetch_rows parameter (usually present in other modules that 
load from database, as well).

http://kamailio.org/docs/modules/stable/modules/lcr.html#id2502056

Also note that private memory is sued temporary to load the rules, just 
to transit from database to shared memory, then no private memory is 
used for lcr records as Juha said.

Regarding the shared memory, looking at the source code will help to see 
the overhead per lcr record and then just add the size of the data 
loaded from memory (some such as domain names are variable size). 
However, there is a simple way to estimate the need of shared memory by 
loading for example 1000 records and then 2000 records. Using 'kamctl 
fifo get_statistics all' you can see the used shared memory size in the 
both cases, make the difference and then estimate the size per record. 
As I said, that is practically to approximate average size per record.

If you reload the rules at runtime, you may need 2x shared memory size 
for lcr rules - Juha can confirm that the module is (re-)loading rules 
in a separate memory structure and then swaps with the active one, and 
frees the old one afterwards, since I am not really using much this module.

Besides the lcr records, you need to have extra shared memory for 
transaction processing.

Cheers,
Daniel

On 3/13/11 9:13 PM, Juha Heinanen wrote:
> Graham Wooden writes:
>
>> I already had the -m 512 in my init file, so it appears I am ok there.
>> I went ahead and recompiled with PKG_MEM_POOL_SIZE to 16MB and I'll see how
>> it goes.
> graham,
>
> lcr module (at least the later versions) does not use any pkg memory.
> it keeps all gws and rules in shm memory.  you can check with kamctl
> command how much shm memory you have left/used/etc.
>
> -- juha
>
> _______________________________________________
> 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

-- 
Daniel-Constantin Mierla
http://www.asipto.com




More information about the sr-users mailing list