CPU utiliziation spikes......gulp

ok, I know that this seems to be a bad topic right now, but I just dealt with an issue related to this and thought I would share my experience.
I am sure there are many reasons why your cpu might spike, this one I happen to catch by accident and it has to do with ldap synchronization.
I happen to notice while running htop that the ldap sync process was running long (1 to 2 minutes) and pegging the cpu the whole time. That made me think about what it was doing. The default when you set up an ldap directory in FreePBX seems to be sync every hour:

If you ldap directory is small, I am sure this would have little impact, but we have a medium size directory and I believe scanning through it was just taking a lot.
To fix this, I change the synchronization to daily so we would not be impacted often.

I want to make something clear…I do NOT think this is a bug or fault in FreePBX, the size of your ldap directory, the starting point you picked in the setup and the power behind your domain controller (or ldap server) all contribute to how long it takes to scan. I am just documenting this in case anyone else needs this help.

I guess I do have one suggestion for Sangoma, maybe you should rethink the 1hr default setting…?

It’s because freepbx doesn’t do incremental sync. It should. So every time it runs it takes a long time and has to reprocess all users and groups.

Hmm, is that an opportunity for improvement? should I put in a feature request?

There’s might already be one. I’m not certain. Definitely should be improved.

Setting to daily also makes it happen at 12am. Which is probably low activity for most pbxes

Actually, I had a question about that, on the 1hr and 6hr settings when do they actually run…it seems to be (in the 1hr example) every 60 minutes past the time when you created (or last modified) the directory…is that right?

fyi, for anyone who want to vote on this

It’ll show up in crontab. Or if you upgraded under

fwconsole job --list

I get this:

[[email protected] ~]# fwconsole job --list

Command “job” is not defined.

also, my /etc/crontab is empty

Crontab for the asterisk user

As for job. You have to upgrade framework to edge if you wanted that.

so, i see in /var/spool/cron/asterisk this:

*/15 * * * * /usr/sbin/fwconsole userman --syncall -q

I have 2 AD directory’s configured and I have them both set to daily sync…what is this line doing…it seems to be syncing every 15 minutes?

Oh. oops. Yeah I forgot that this doesnt modify the crontab. It runs every 15 minutes but it checks to make sure it hasn’t run since the last run in whatever you set. So everything I said was wrong.

So it’s not running every 15 minutes. You can run it manually and see for yourself: /usr/sbin/fwconsole userman --syncall

so, i think i understand, it check every 15 minutes to see if it needs to run or not based on the sync setting on the directory?

Exactly. Sorry for the confusion

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.