• Resolved bigflannel

    (@bigflannel)


    Hi

    I manage but did not build the site I have linked to. I notice the site is eating a lot of server CPU on an ongoing basis. 5 PHP processes related to the site take up over 70% of my 2CPU virtual server. A couple have been running for a long time. The site has very few plugins, and these cron jobs are running and I think are part of the participants database plugin:

    wp_pdb_dynamic_value_update_string-combine_cron_interval
    wp_pdb_dynamic_value_update_numeric-calc_cron_interval
    wp_pdb_dynamic_value_update_date-calc_cron_interval
    wp_pdb_import_cron_interval

    I also had to swotch off the plugin emails, I was getting multiple copies of the same email.

    Something is not quite right, but I can’t figure it out. Do you have any pointers?

    Thank you!

    Regards
    Mike

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Roland Barker

    (@xnau)

    Hi Mike,

    Addressing the issues in your first point is going to require a more specific analysis of how the CPU usage might be related to the plugin. The plugin doesn’t present a significant CPU load in the background, increases in CPU load will be related to specific actions or functionality, such as updating records.

    Using a plugin/CPU load analysis plugin can be helpful there.

    The cron jobs you mention are only used when records are updated in the background. This doesn’t happen automatically, it only happens when records are updated in order to bring all the dynamic values into sync. Even then, these processes don’t take a lot of resources.

    One thing I will mention is it’s a good idea to remove any unused fields, expecially dynamic fields such as string combone fields.

    If the high CPU is related to displaying a list of records, showing a shorter list (using the Records per Page setting) can be helpful.

    Multiple plugin emails: first thing to check is the configuration, the plugin can send to multiple addresses. You’re not specific about the circumstances that triggered the multiple sends, or what emails are showing the problem, that information would be helpful to finding the specific issue there.

    Thread Starter bigflannel

    (@bigflannel)

    Hi

    Thank you for getting back to me.

    I agree I am fumbling in the dark a little here. Using TOP in the terminal, I can see the server is occupied running PHP for this site (more than any other wordpress site I host). The traffic on the site is low. So I wondered what was happening. I looked at the cron jobs, these are all running every 5 minutes and are scheduled for every 5 minutes:

    wp_pdb_dynamic_value_update_string-combine_cron_interval
    wp_pdb_dynamic_value_update_numeric-calc_cron_interval
    wp_pdb_dynamic_value_update_date-calc_cron_interval
    wp_pdb_import_cron_interval

    What might I have done to make these constantly run? There is very little manual activity such as new submissions, updated records etc.

    There are no other non core cron jobs.

    When I mentioned multiple emails. Essentially as I took over administering the site, I was getting sign up emails (4 a day) for each and every one in the database, repeats as it were, of everyone in the list. I think I unchecked both of these in settings / signup form settings:

    Send Signup Response Email
    Send Signup Notification Email

    which stopped it, but it seems like the the whole list is constantly being processed.

    I noticed today because another site on my server has a traffic spike, and as I was monitoring stuff on the server to see if I needed to upgrade, I noticed the issue with this site using PHP.

    Once again, any suggestions warmly received.

    Thank you.

    Regards
    Mike

    Plugin Author Roland Barker

    (@xnau)

    The first thing that comes to mind hearing your description is you’ve got an object cache on your server that needs to be flushed.

    Retriggering a signup email for all records is rather odd, the plugin doesn’t normally do anything like that, the signup email is triggered by the user’s action, and only on the one record the user just submitted.

    Those cron jobs are not normally scheduled to go every 5 minutes UNLESS a background process is underway. The cron is unscheduled after the process is complete, so again, it looks like server cache is supplying stale data.

    Not coincidentally, all of these things are related to data in the wp_options table, which is often cached because it gets used so much.

    Disable that cache if you can until you get everything working.

    • This reply was modified 3 years, 9 months ago by Roland Barker.
    Thread Starter bigflannel

    (@bigflannel)

    Hi

    Really appreciate your thoughts. I design and develop and manage a server to support that. I don’t think it is running object caching, but I have WP Super Cache running as a plugin and NGINX caching running on the server configured via PLESK (the PLESK UI suggests it’s a good thing). I cleared both and the site seems much happier. I will keep monitoring it. I’ve also switched my admin email notifications back on so I will see if it starts looping again. So far so good. I really appreciate your thoughts and responses, it seems like my setup is the issue.

    Thank you!

    Regards
    Mike

    Thread Starter bigflannel

    (@bigflannel)

    Hi

    Switching off the caching seems to have greatly reduced the load from the site. So that’s both WP Super Cache and NGINX caching switched off.

    I switched notification emails on. I am getting a notification about every 5 minutes, which is the same time the cron interval is for:

    wp_pdb_dynamic_value_update_string-combine_cron_interval
    wp_pdb_dynamic_value_update_numeric-calc_cron_interval
    wp_pdb_dynamic_value_update_date-calc_cron_interval
    wp_pdb_import_cron_interval

    All these cron events remain after clearing the cache. The email is a notification of a new signup, but that person is already in the database.

    I did move the site to a new host. I transferred the database. I am wondering if I have lost some data regards person subscribed and notifications sent?

    Once again any pointers greatly received. As far as I am aware I am not running an object cache. I don’t really know what one is however.

    Thank you for any pointers.

    Regards
    Mike

    Plugin Author Roland Barker

    (@xnau)

    I’d suggest clearing out all those crons. (you can do this using the WP Crontrol plugin) The plugin will rebuild them as needed.

    The email, I don’t have an explanation for that…yes, it looks like it’s getting triggered by a cron, but this is not how the plugin normally works, so I don’t have any further details on that.

    The plugin does not check for whether a notification was sent or not, and it does not use a cron to send emails. Those emails are triggered by the user’s actions.

    Yes, it’s allways a good idea to get your site set up and all working before using any caching so that the action of the cache does not confuse issues.

    Thread Starter bigflannel

    (@bigflannel)

    Hi

    I tried to clear the crons, but WP-Crontrol says they belong to another plugin and it can’t cancel them.

    Do you have any idea why that might be?

    Thank you!

    Regards
    Mike

    Plugin Author Roland Barker

    (@xnau)

    So, what I think you’re running up against are problems that stem from your copying the site. You may need to go in to the wp_options database table directly to clear those items out…I’m sorry I don’t have the details on how thats done, but things like transients and cron schedules can be safely deleted because they will be regenerated as needed. Probably, there is a way to clear that stuff out.

    Thread Starter bigflannel

    (@bigflannel)

    Hi Again

    I realize this ball is really in my court, but I am failing to understand how my issue is even happening. Any suggestions greatly appreciated.

    If I check ‘Send an email notification that a signup has occurred.’ in the plugin settings, I get an email every 5 minutes or so regards a signup, they are all previously registered and approved people.

    I tried clearing crons from the database:

    UPDATE wp_options SET option_value = '' WHERE option_name = 'cron';

    I tried FFF Cron, WP Cron Cleaner, and WP Crontrol. Only WP Crontrol shows these crons, the other 2 plugins do not, I am not able to delete them with any plugin:

    wp_pdb_dynamic_value_update_string-combine_cron_interval
    wp_pdb_dynamic_value_update_numeric-calc_cron_interval
    wp_pdb_dynamic_value_update_date-calc_cron_interval
    wp_pdb_import_cron_interval

    I tried code in my functions.php file:

    add_action("init", "clear_crons_left");
    function clear_crons_left() {
    wp_clear_scheduled_hook("wp_pdb_dynamic_value_update_date-calc_cron_interval");
    }

    I couldn’t clear the schedule using the above code.

    I cleared all transients in the site using the plugin Transients Manager. I searched all plugin and theme code for the cron jobs I list, and part of their names, and cannot find them in the code or the database.

    I am really stuck, I can’t figure out where they might exist. As I said any thoughts greatly appreciated and thank you.

    Regards
    Mike

    Plugin Author Roland Barker

    (@xnau)

    So, what it looks like is happening is you have “orphan” cron events in the queue. These may not be able to be deleted in the usual way because the “hook” isn’t registered (that is what makes them orphan cron events).

    The nuclear option here is to delete all the cron schedules. You do this by opening the wp_options table in phpMyAdmin and find an option with the option_name of “cron” This is a serialized array of all the cron events. You will be deleting the value of that item, don’t delete the item from the database, you’re just clearing the value.

    You can usually just delete this because crons are supposed to be temporary and any function that needs a cron will just set a new one if it doesn’t exist. BUT just to be sure, keep a backup of the value in there in case it breaks other things.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘CPU Usage, Cron Jobs, Multiple Emails’ is closed to new replies.