Hello,
I have committed some code to allow easier troubleshooting and
monitoring of PKG usage per process.
One new functions are exported by cfgutils module:
- pkg_summary() - can be used to dump summary of PKG usage
Btw, there was also added shm_summary() that dumps the summary of SHM usage.
The kex module exports a new rpc command 'pkg.stats' that prints PKG
usage metrics (used, free, real_used) per process. Here is a sample output:
sercmd> pkg.stats
{
entry: 0
pid: 4793
rank: 0
used: 124788
free: 3813512
real_used: 380792
}
{
entry: 1
pid: 4794
rank: 1
used: 132740
free: 3805512
real_used: 388792
}
{
entry: 2
pid: 4795
rank: 2
used: 132740
free: 3805512
real_used: 388792
}
The adding free to real_used values results in pkg memory size per
process (4MB in this example).
To get these stats, you have to compile with MALLOC_STATS enabled (this
is default for Kamailio, so nothing actually to do for it).
One benefit of this pkg.stats is ability to monitor usage of private
memory and trigger alerts if the amount of available memory (free) for
one process goes below a lower limit, useful when there is a memory leak
(so you restart in time and report the problem) or the config operations
for given traffic needs larger PKG size.
In the near future there will be some new additions to be able to access
these values also via PVs.
Testing and feedback is appreciated.
Cheers,
Daniel
--
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
http://www.asipto.com