Random high CPU load and overhead

FreePBX version:
Trixbox version: 2.2.0
Asterisk version: 1.2.17
System receives and makes calls through 1 T1/PRI
All phones connected to this system are SNOM 360’s

This system has been running for over a year now and lately users have been complaining about garbled and “staticy” calls. I have been monitoring the system for the past few days now and have noticed random spikes in CPU usage. It will just randomly spike to about 50 - 90% in the web GUI. If i go into the linux CLI and do a top, it shows Asterisk using 100% of the CPU. Along with this I have noticed that I am sometimes unable to SSH or access the web gui of this server as it becomes unresponsive. It will be unresponsive for a few second to a couple of minuets and then it works fine I don’t know if this is related but I think there is a possibility.

We have call recording on multiple extensions turned on and I had thought that this might be the cause but after turning all of them off it still occurred.

I am wondering if this is an issue with FreePBX, Trixbox or Asterisk. Any help is greatly appreciated.

things that take up CPU are:

recordings and the playing back of them
trancoding of audio (the conversion of audio in one codec to another)
MOH, IVR, etc if the audio is not in native GSM format.

To a small degree CDR log management in mysql can be a issue. If your system handle a ton of calls each day and has been running for years the logging portion can get real huge and inserting more records can slow things down. There is a way to prune the logs (remove records older then 1 year for example). then compress the mysql database (which also will decrease the size of your backups if you do those).

Running low of disk space? If it is starting to fill up take a look at doing some cleaning up. Backups are a good place to start as the backups generate files but nothing removes those backup files. Next would be OLD recordings. After that I would be take a look at your logs. Most important one to look at with older installs of trixbox is the /var/log/asterisk/full log. Does it get rotated or is it forever growing. If it’s forever growing that can hurt and you’ll need to take a look at editing the /etc/logrotate.d/asterisk file to include the full log into the rotation.

thanks much! I’ll take a look at that and we’ll see if that clears anything up.

I cleaned up most of the old log files and there is a script in place that deletes any recording older than 90 days. I’m still getting random spikes in the CPU. I’m wondering if its the call reporting feature in trixbox. I cant see any correlation between the CPU spike and the amount of activity from the users, so the next guess would be the system running something in the background?

Automated call reporting is almost non-existent. It does not schedule and run anything like get totals for calls in last hour. The only thing that happens on a regular basis with call reporting is single record inserts for each call when they are completed. So if your database is HUGE then that could be a issue. past that I’m at a loss. Have you run top and watched it? it will show you the top processes using CPU in almost real time. (every 5 seconds or so it recycles).

i ran top and watched it when it showed high CPU usage in the web GUI. At that time the GUI said 80% CPU usage and in top it said asterisk was using 100% of the CPU. Then things got really laggy and I had to wait until the CPU usage went back down to normal. The thing that gets me is there doesn’t seem to be any rhyme or reason to it. It just happens at random.

I’m getting the same thing…in the FreePBX System Status, the CPU usage goes to 100% for 5-10 seconds, then back down to 0%. I do know it seems to correlate w/ incoming and outgoing calls, but I’m not sure what else to check to dig deeper.

Any suggestions would be appreciated.

I ran the command: “top” from the command line and my usage wasn’t nearly so high, nor did it seem to correlate w/ the CPU usage in the System Status page in FreePBX.

Is there a problem with the way FreePBX calculates CPU usage?

I upgraded to 2.5 and rebooted…not sure which did it, but problem solved.