[SR-Users] Memory allocation

Henning Westerholt hw at kamailio.org
Wed Dec 19 22:57:29 CET 2018


Am Mittwoch, 19. Dezember 2018, 19:25:08 CET schrieb Duarte Rocha:
> I have some things that i want to udnerstand about Kamailio's memory
> allocation.
> 
> My settings are 1024Mb for shared memory and 12Mb for private memory.
> 
> I'm running Kamailio on a machine with CentOS7 and 2Gb of RAM. As i
> understand, at startup Kamailio will allocate 1024+12*number_of_processes
> megabytes of memory. Is this correct?
> 
> When i set up Kamailio to run with 150 processes, after starting, i still
> have 500Mb of free RAM and therefore not allocated to any process. That
> goes against what i wrote earlier.
> 
> What is the best way to plan for memory specs in my machines according to
> the desired number of processes and shared\private memory defined?

Hello Duarte,

Kamailio will allocate the shared memory pool under load at run time, not at 
startup. The private memory pool is allocated at startup. Therefore you will 
see a lower memory usage. I just tested it on my machine, with the default 
config (8MB PKG, 64 MB SHM) it is like this:

         9.86 Mb ./kamailio 
         9.86 Mb ./kamailio 
         9.86 Mb ./kamailio 
         9.86 Mb ./kamailio 

If you expecting a really heavy loaded setup and using certain memory 
intensive modules I would suggest to increase the PKG mem pool to 24 or 32 MB. 
Then decrease the number of children e.g. to the number of CPU cores. 150 
processes is too much in my opinion. For normal setups 16MB PKG and 512 MB SHM 
should be enough, with 8 to 16 processes. Kamailio is pretty efficient.

Alex wrote a really detailed blog article about tuning, you'll find some 
chapter about process setup as well:

http://www.evaristesys.com/blog/tuning-kamailio-for-high-throughput-and-performance/

Best regards,

Henning

-- 
Henning Westerholt - https://skalatan.de/blog/
Kamailio services - https://skalatan.de/services
Kamailio security assessment - https://skalatan.de/de/assessment



More information about the sr-users mailing list