Greetings,
My network team tells me there's excessive database queries run by our web servers, the results for which are being 'dropped to the floor':
Each of the 4 blog webservers are pulling in ~10Mbit peak from the database but are only serving ~2Mbit each. The cumulative wasted total of ~32Mbit peak is evaluated by the web servers (CPU intensive) and then dropped on the floor. Graphs below. This behavior is not new and has been happening since the conversion [to wpmu-1.3.3], possibly since inception.
The probable root cause has been determined to be from the following if statement in the get_alloptions() function (wp-includes/functions.php). For many of the blogs each test for !$options brings ~500K to the web server which is used only for the test.
Here's the code block to which he's referring:
if ( !$options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'") ) {
$options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options");
}
I imagine this similar line in wp_load_alloptions() may also cause grief:
if ( !$alloptions_db = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'") )
$alloptions_db = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options");
Any ideas how we can resolve or minimize this issue?
Thanks!
Clay