After looking around a little bit, these are processes on the backend…
UPDATE
wp_optionsSET
option_value= 'a:16191:{i:1419011820;a:1:{s:27:\"wpua_has_gravatar_cron_hook\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}}i:1419011825;a:1:{s:27:\"wpua_has_gravatar_cron_hook\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:5:\"daily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:86400;}}}i:1419011832;a:1:{s:27:\"wpua_has_gravatar_cron_hook\";a:1:{s:32:\
These cron jobs are inserting 3MB sized binary logs into the wp_options table were adding up to a Gig within 5-7 minutes.
Here’s the portion of the plugins code that’s responsible for the large updates:
/**
? * Checks whether registered user has Grvatar-hosted image or not.
? * Set the flag in database according to existence of Gravatr image.
? * @uses object $wpua_functions
? * @uses int $blog_id
? * @param int $user_id
? * @uses wpua_has_gravatar()
? */
? public function set_wpua_has_gravatar($user_id=""){
? ? ? ? global $blog_id, $wpua_functions;
? ? ? ? if(!empty($user_id)){
? ? ? ? ? ? ? ? $flag = $wpua_functions->wpua_has_gravatar($user_id);
? ? ? ? ? ? ? ? ? ? ? ? // Update usermeta
? ? ? ? ? ? ? ? ? ? ? ? update_user_meta( $user_id, 'wpua_has_gravatar', $flag);
? ? ? ? }
? ? ? ? else{
? ? ? ? ? ? ? ? $blogusers = get_users( 'blog_id='.$blog_id );
? ? ? ? ? ? ? ? // Array of WP_User objects.
? ? ? ? ? ? ? ? foreach ( $blogusers as $user ) {
? ? ? ? ? ? ? ? ? ? ? ? $flag = $wpua_functions->wpua_has_gravatar($user->ID);
? ? ? ? ? ? ? ? ? ? ? ? // Update usermeta
? ? ? ? ? ? ? ? ? ? ? ? update_user_meta( $user->ID, 'wpua_has_gravatar', $flag);
? ? ? ? ? ? ? ? }
? ? ? ? }
? }
For a quick remedy, my host applied max_binlog_files
to cap how much in binary log can be written, which takes care of the load for the time being, but it isn’t a permanent solution.
Any idea how we can optimize this code so that it doesn’t attempt to write Gigs worth of data to the wp_options table?