Freeswitch using 30% CPU constantly

Status
Not open for further replies.

yukon

Member
Oct 3, 2016
138
14
18
Hi all,

I have a fusionpbx install with 140 extensions, pretty standard install, nothing special. But I am seeing freeswitch use 30% CPU constantly with no calls, etc going on.

Is this normal? Any suggestions on how to reduce this?

System Information
Version 4.3.1
Git Information Branch: master
Commit: 9aa1133ea64696d76105a82a2adb938cf444f139
Origin: https://github.com/fusionpbx/fusionpbx
Project Path /var/www/fusionpbx
Switch Version 1.6.13 (64bit)
Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,070
577
113
You could start by upgrading to latest freeswitch and see if that helps
 

yukon

Member
Oct 3, 2016
138
14
18
Ok. I will try that... But I have two other boxes that have 1.6.13 installed and not seeing this sort of CPU usage. Just very concerning.
 

yukon

Member
Oct 3, 2016
138
14
18
I just noticed that the box using the large CPU doesn't have the -nonat option... Do you think that could cause higher CPU usage?
 

yukon

Member
Oct 3, 2016
138
14
18
Ok. I upgraded to 1.6.15 and still seeing the same problem. In fact it got a bit worse. I have one server with 21 users and seeing the same type of CPU usage and this is with 0 active calls.

Code:
top - 21:07:51 up 38 days,  2:30,  1 user,  load average: 0.09, 0.17, 0.32
Threads:  36 total,   0 running,  36 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.2 us,  6.7 sy,  0.1 ni, 90.0 id,  0.3 wa,  0.0 hi,  0.8 si,  0.0 st
KiB Mem:  16466416 total, 14947264 used,  1519152 free,   214440 buffers
KiB Swap:  8375292 total,    74012 used,  8301280 free. 13983840 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
24586 www-data  rt -10 2641532  68316  16648 S 72.8  0.4   0:23.11 freeswitch
24591 www-data  -2 -10 2641532  68316  16648 S 13.2  0.4   0:08.98 freeswitch
24576 www-data  -2 -10 2641532  68316  16648 S  6.6  0.4   1:11.84 freeswitch
24578 www-data -11 -10 2641532  68316  16648 S  6.6  0.4   0:02.66 freeswitch
24604 www-data  rt -10 2641532  68316  16648 S  6.6  0.4   0:03.28 freeswitch
24537 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:00.66 freeswitch
24540 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:00.32 freeswitch
24544 www-data  rt -10 2641532  68316  16648 S  0.0  0.4   0:01.09 freeswitch
24560 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:00.03 freeswitch
24561 www-data -11 -10 2641532  68316  16648 S  0.0  0.4   0:02.17 freeswitch
24562 www-data  rt -10 2641532  68316  16648 S  0.0  0.4   0:00.28 freeswitch
24563 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:00.32 freeswitch
24566 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:00.18 freeswitch
24569 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:00.63 freeswitch
24572 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:00.25 freeswitch
24575 www-data  rt -10 2641532  68316  16648 S  0.0  0.4   0:01.65 freeswitch
24577 www-data  rt -10 2641532  68316  16648 S  0.0  0.4   0:08.79 freeswitch
24579 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:02.32 freeswitch
24582 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:00.00 freeswitch
24585 www-data -51 -10 2641532  68316  16648 S  0.0  0.4   0:00.91 freeswitch
24588 www-data -11 -10 2641532  68316  16648 S  0.0  0.4   0:00.00 freeswitch
24589 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:00.04 freeswitch
24590 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:06.32 freeswitch
24592 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:11.70 freeswitch
24593 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:13.54 freeswitch
24594 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:07.74 freeswitch
24595 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:04.39 freeswitch
24596 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:04.25 freeswitch
24597 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:05.08 freeswitch
24598 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:01.97 freeswitch
24599 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:01.69 freeswitch
24600 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:01.79 freeswitch
24601 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:01.53 freeswitch
24603 www-data  rt -10 2641532  68316  16648 S  0.0  0.4   0:00.43 freeswitch
24605 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:00.00 freeswitch
24606 www-data  -2 -10 2641532  68316  16648 S  0.0  0.4   0:00.00 freeswitch

I'm wondering if it could be because all the phones have 10 parking slots on them? The presence on those could be adding a lot of overhead? But I see it jump to like "800%" every once in a while.
 

yukon

Member
Oct 3, 2016
138
14
18
I don't see anything noticeable in the CLI that's looping. It's almost as if the REGISTER process is taking too much resources.

I was also wondering if maybe my memcached is set too low at only 64mb?
 

yukon

Member
Oct 3, 2016
138
14
18
Ok, so here's a little update on my situation...

I created a FS Jira but really wasn't getting anywhere on that so decided it was one of two things
1) FS bug in 1.6.15 as I had recently upgraded from 1.6.xx (something <13)
2) A bug in FusionPBX

Mark has been MIA teaching class so I decided to try two things.
1) downgrade to 1.6.9, this didn't cause anything to change. I was still seeing HUGE CPU spikes
2) I then upgraded to latest master fusionpbx. Still no change was seeing HUGE CPU spikes

Sooo. That left me perplexed, so I disabled MWI. SO FAR, I'm seeing slightly better CPU usage but it's only been about an hour.

I have also noticed that my RAM is getting 100% usage and even with doing a service freeswitch stop, it doesn't seem to free up. So I'm wondering if there's a memory leak somewhere. Question is, FS or Fusion?

Lastly... I did a server reboot which caused 100 phones to switch servers they are registered too. The new server that was getting all the registrations was pegging pegging pegging!

Now I'm thinking this is somewhere in the register lua scripts.

Strange thing is that I have a digitalocean 1core 512meg ram with 6 phones registered and it's running about the same CPU usage as my 8core 16 gig ram server with 40 phones. I was able to have 10 simultaneous calls on the digitalocean system with no problems (and one of those was a VIDEO call!)
 

yukon

Member
Oct 3, 2016
138
14
18
Did you ever work out what the issue was? What OS are you running?

I did actually and I never would have guessed the problem. It was that the fail2ban lists in iptables got too big. Once I cleared out iptables, everything started working normal again.
 

screwloose

Member
Feb 5, 2017
49
9
8
40
Thanks. I cleared out fail2ban but my cpu usage is still high. This is a old build with centos. So i'm just going to migrate it over. The new deb based box's seem to have less issue.
 

rabbidiesel

Member
Aug 28, 2020
38
10
8
9x9tech.com
Hey,

I had a similar issue where my CPU was sporadic. It would be at 20, then up 50, 90, and running all over the place.
I restarted the server and it didn't change.

I checked top and found that PostgreSQL was utilizing the CPU.

I restarted the Postgres service, and it didn't help.
Then is when I stopped Postgres, then restarted it, and then the CPU came back to normal.

Good Luck
 
Status
Not open for further replies.