FreePBX Memory Usage
-
Before I contact my support provider to see if they have an idea I was wondering if anyone knew anything about this.
This is the current htop view of my FreePBX server. There are 50 asterisk "processes", which are all using the same amount of RAM. They all fluctuate on CPU usage between 0.0% and 0.3%. However they all use 1.5% or 1.6% of the available memory regardless of how much I add to the system. This is a virtual machine running on Hyper-V Server 2012, it has 2 vCPUs and 4GB of RAM allocated to it currently.
Just wondering if anyone else has encountered something like this before or if it is normal. Does Asterisk spawn one process per extension?
-
That's the htop view and it shows LWPs. Use top and you'll not see that. Nothing to worry about. That's how it should be.
-
In Linux there are no "threads". Instead of a thread Linux uses a thing called a "Light Weight Process". When you use htop you get shown all of those LWPs instead of the full processes. So think of them as threads. Those are simply the "threads" associated with Asterisk. So you need a lot of them, every non-blocking action (like a call) will require at least one of them for itself.
-
@StrongBad said:
That's the htop view and it shows LWPs. Use top and you'll not see that. Nothing to worry about. That's how it should be.
Thanks, I learned something new today. I have never encountered the term LWP (Light weight processes, for people who don't want to look it up) before. That explains why it is using the same amount of RAM as the parent process. Now I just need to figure out why I am using 80% of the available RAM. Is there a way to see resource usage that isn't top of htop? top only shows ~15-20% usage whereas my hypervisor is showing a lot higher.
-
Use free -m to see your memory usage.
-
-
@scottalanmiller said:
http://www.sheepguardingllama.com/2008/02/linux-memory-monitoring/
Very informative. I will add that to my Linux bookmarks. Doesn't look like my memory subsystem is overloaded I am not swapping anything to disk. So it is probably a non-issue. Thanks.
-
Check your swap settings to see if swap is even possible. What does your "free -m" output look like? Does it have swap turned on?
-
@scottalanmiller said:
Check your swap settings to see if swap is even possible. What does your "free -m" output look like? Does it have swap turned on?
Here are the vmstat and free -m command results:
Looks like there is 766 MB available for swap, only 2 are being used right now.
-
Yup, that looks healthy. If you want to reduce memory usage a little you can look at this...
http://www.scottalanmiller.com/linux/2012/09/02/improving-elastix-memory-usage/
-
You do seem to be using an awful lot of memory for a FreePBX install. You have way more than enough, but you are using more than you would expect.
-
@scottalanmiller said:
You do seem to be using an awful lot of memory for a FreePBX install. You have way more than enough, but you are using more than you would expect.
Yep, which why I was concerned. I do have FOP2 running, but that doesn't seem to be using anything really, it seems to be using ~335MB, although since people are using it not sure if I should modify the apache settings as per your previous link.
Here is my top output. It looks like the httpd processes are using a huge amount of memory, or rather it is claiming a huge amount it doesn't seem to be using a lot of it, if I understand the difference between virt and res correctly.
-
@scottalanmiller said:
Yup, that looks healthy. If you want to reduce memory usage a little you can look at this...
http://www.scottalanmiller.com/linux/2012/09/02/improving-elastix-memory-usage/
This is one of my go-to steps any time I roll out Elastix / FreePBX. It's a great help.
-
@coliver said:
@scottalanmiller said:
You do seem to be using an awful lot of memory for a FreePBX install. You have way more than enough, but you are using more than you would expect.
Yep, which why I was concerned. I do have FOP2 running, but that doesn't seem to be using anything really, it seems to be using ~335MB, although since people are using it not sure if I should modify the apache settings as per your previous link.
Here is my top output. It looks like the httpd processes are using a huge amount of memory, or rather it is claiming a huge amount it doesn't seem to be using a lot of it, if I understand the difference between virt and res correctly.
Even with FOP2 running, applying Scott's article should not cause any problems with FOP2.