[Asterisk-Users] Virtual Memory Usage
Tzafrir Cohen
tzafrir at cohens.org.il
Fri Dec 23 05:40:00 MST 2005
Hi
On Fri, Dec 23, 2005 at 09:54:24AM +0100, Christian Benke wrote:
> Good Morning List!
>
> I have a instance of asterisk running since 2 weeks under relative heavy
> zap usage(mostly disa-customers), about 3000calls/day. last time(2 weeks
> ago) it had been shut down by oom-killer for some reason and since then i
> keep a jealous watch over the asterisk process.
Here is a tidbit about Linux's memory management:
When a process allocates many pages but has not yet used them, the
operating system will not allocate those pages. Those pages will only be
allocated when the process first uses them.
Asterisk seems to be one such major over-commiter. Thus the virtual
memory column is not the only column to look at. Also look at the "real
memory" column:
ps -o vsz -o rsz
> I know that linux is
> keeping old pages in the cache and erases them when free memory is needed,
This is another thing: Linux tends to use the availble free memory for
IO buffers, disk cache and such. So in the output of 'free', look at the
second line.
> though i'm concerned about the virtual memory usage of asterisk. it is
> rising every day and is at 56488kB at the moment(it never declines) with a
> processor time of 192:19.77. Is this normal behaviour and will the virtual
> memory be erased at some point when there really is insufficient memory?
> Or should i be concerned about it? The free memory has always been between
> 50 and 70 MB in this two weeks (cache is at 1969MB so enough spare memory
> yet).
> I also suspect my two agi-bash-scripts for producing the memory usage,
If they are regular AGIs and not some sort of FastAGI then a new process
is recreated for each invocation. Wastes more CPU cycles, but a sure way
to prevent leaks (unless the AGI-executing code in Asterisk leaks memory).
> i'm
> not sure if the results of the scripts are kept in (virt)memory, though
> i'm not a specialist how linux manages this and would like to hear a
> professional opinion about it(see attachments for my - simple -
> bash-scripts that are called for every call, authentication and dialstring
> cosmetics, the "list-usergroup1" that is beeing called is a simple list of
> numbers)
>
> In the meantime i've installed monit(tildeslash.com/monit/) which is a
> quite nice tool for monitoring and restarting of processes in case of
> failure, though i'd like to find the real problem, not just fight the
> consequences...
If you want to trace leaks, yo can build Asterisk with memory allocation
debugging support (look for astmm in the makefile) and watch which part
keeps growing.
--
Tzafrir Cohen | tzafrir at jbr.cohens.org.il | VIM is
http://tzafrir.org.il | | a Mutt's
tzafrir at cohens.org.il | | best
ICQ# 16849755 | | friend
More information about the asterisk-users
mailing list