axelerant / testimonials-widget

Easily add social proofing to your website with Testimonials Widget. List or slide reviews via functions, shortcodes, or widgets.
http://wordpress.org/plugins/testimonials-widget/
GNU General Public License v2.0
10 stars 7 forks source link

DB Performance Issues #80

Closed michael-cannon closed 10 years ago

michael-cannon commented 10 years ago

https://help.wpengine.com/requests/203937


502 errors are definitely no good - Sorry to hear your site's been having them. Usually this is caused by inefficient queries coming from themes or plugins, causing WordPress to slow down or even time out.

After running a few tests, I definitely found some culprits.

It looks like they're mostly coming from your plugins, specifically "Testimonials Widget Premium." I've attached an image of all the queries being launched from your site, which currently has 154 queries that are running when the site is visited. In general, anything over 100 is worth investigating if you come across connection issues.

Unfortunately, I'm unable to troubleshoot what exactly is making that plugin so slow, that would be a better conversation between you and the developer for Testimonials Widget, but I can at least give you the slow queries that you can show them are causing high load:

SELECT wp_users.ID,wp_users.display_name FROM wp_users INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id) WHERE 1=1 AND ( (wp_usermeta.meta_key = 'wp_capabilities' AND CAST(wp_usermeta.meta_value AS CHAR) LIKE '%\"administrator\"%') ) ORDER BY user_login ASC

Source: /nas/wp/www/cluster-1287/aihrus/wp-content/plugins/testimonials-widget-premium/includes/class-testimonials-widget-premium-form.php:944

Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/restored/front-page.php'), dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, WP_Widget_Text->widget, apply_filters('widget_text'), call_user_func_array, do_shortcode, preg_replace_callback, do_shortcode_tag, call_user_func, Testimonials_Widget_Premium::testimonialswidgetpremium_count, Testimonials_Widget_Premium::testimonials_count, Testimonials_Widget_Settings::validate_settings, Aihrus_Settings::validate_settings, Testimonials_Widget_Settings::get_defaults, Aihrus_Settings::get_defaults, Testimonials_Widget_Settings::settings, apply_filters('testimonials_widget_settings'), call_user_func_array, Testimonials_Widget_Premium_Form->settings, get_users, WP_User_Query->__construct, WP_User_Query->query

(5 seconds of loading)


SELECT wp_users.ID,wp_users.display_name FROM wp_users INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id) WHERE 1=1 AND ( (wp_usermeta.meta_key = 'wp_capabilities' AND CAST(wp_usermeta.meta_value AS CHAR) LIKE '%\"editor\"%') ) ORDER BY user_login ASC

Source: /nas/wp/www/cluster-1287/aihrus/wp-content/plugins/testimonials-widget-premium/includes/class-testimonials-widget-premium-form.php:951

Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/restored/front-page.php'), dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, WP_Widget_Text->widget, apply_filters('widget_text'), call_user_func_array, do_shortcode, preg_replace_callback, do_shortcode_tag, call_user_func, Testimonials_Widget_Premium::testimonialswidgetpremium_count, Testimonials_Widget_Premium::testimonials_count, Testimonials_Widget_Settings::validate_settings, Aihrus_Settings::validate_settings, Testimonials_Widget_Settings::get_defaults, Aihrus_Settings::get_defaults, Testimonials_Widget_Settings::settings, apply_filters('testimonials_widget_settings'), call_user_func_array, Testimonials_Widget_Premium_Form->settings, get_users, WP_User_Query->__construct, WP_User_Query->query

(4.7 seconds of loading)


SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'testimonials-widget' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') ORDER BY wp_posts.ID DESC

Source: /nas/wp/www/cluster-1287/aihrus/wp-content/plugins/testimonials-widget-premium/includes/class-testimonials-widget-premium.php:356

Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/restored/front-page.php'), dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, WP_Widget_Text->widget, apply_filters('widget_text'), call_user_func_array, do_shortcode, preg_replace_callback, do_shortcode_tag, call_user_func, Testimonials_Widget_Premium::testimonialswidgetpremium_count, Testimonials_Widget_Premium::testimonials_count, WP_Query->__construct, WP_Query->query, WP_Query->get_posts

(1.3 seconds of loading)


SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') ORDER BY wp_posts.ID DESC

Source: /nas/wp/www/cluster-1287/aihrus/wp-content/plugins/testimonials-widget-premium/includes/class-testimonials-widget-premium.php:356

Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/restored/front-page.php'), dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, WP_Widget_Text->widget, apply_filters('widget_text'), call_user_func_array, do_shortcode, preg_replace_callback, do_shortcode_tag, call_user_func, Testimonials_Widget_Premium::testimonialswidgetpremium_count, Testimonials_Widget_Premium::testimonials_count, WP_Query->__construct, WP_Query->query, WP_Query->get_posts

(1 second of loading)

I can also confirm that this Testimonials Widget Premium plugin is what's causing the majority of your WordPress Dashboard load on the back end. The queries it's launching was varying some pages I was loading from 5.2 - 9.3 seconds before showing what I just clicked on...

Your "Aihrus Restored" theme is also using quite a lot of queries. None of them are particularly slow, but the sheer amount of them are still combining to make about 8.3 seconds of loading time on an uncached hit of your site.

Unfortunately, it looks like a lot of your plugins are using a very inefficient way of combing your database. Some of them are even looking through 110,000 and even 200,000+ rows of information and are only bringing back single digit amounts of information back, which takes lots and lots of time. I'll post some examples below, but a developer would truly be needed to dig into what could be causing these inefficiencies:

Inefficient Queries (queries that send or affect less than 25% of rows examined) wp_aihrus has 109 inefficient queries (total time: 00:04:32) in order of time consumed:

[undefined] Count: 35 queries totalling 00:01:20 (average of 2.286 sec/query) Efficiency: 0.009 | Rows Sent/Affected: 1112 | Rows Examined: 118186 Query: SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'; Efficiency: 0.000 | Rows Sent/Affected: 1 | Rows Examined: 118183 Query: SELECT SQL_CALC_FOUND_ROWS * FROM

wp_options WHERE

option_value LIKE '%testimonials6%' LIMIT 1;

/nas/wp/www/cluster-1287/aihrus/wp-content/plugins/wordpress-seo/inc/class-wpseo-options.php:3514 Count: 10 queries totalling 00:00:25 (average of 2.500 sec/query) Efficiency: 0.009 | Rows Sent/Affected: 1112 | Rows Examined: 118206 Query: SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'

/nas/wp/www/cluster-1287/aihrus/wp-content/plugins/wordpress-seo/inc/class-sitemaps.php:75 Count: 2 queries totalling 00:00:05 (average of 2.500 sec/query) Efficiency: 0.009 | Rows Sent/Affected: 1114 | Rows Examined: 118230 Query: SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'

/nas/wp/www/cluster-1287/aihrus/wp-settings.php:192 Count: 2 queries totalling 00:00:05 (average of 2.500 sec/query) Efficiency: 0.009 | Rows Sent/Affected: 1114 | Rows Examined: 118241 Query: SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'

/nas/wp/www/cluster-1287/aihrus/wp-content/plugins/iwp-client/stats.class.php:592 Count: 2 queries totalling 00:00:04 (average of 2.000 sec/query) Efficiency: 0.009 | Rows Sent/Affected: 1114 | Rows Examined: 118241 Query: SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'

/nas/wp/www/cluster-1287/aihrus/wp-content/plugins/scissors-watermark/functions.php:390 Count: 1 queries totalling 00:00:02 (average of 2.000 sec/query) Efficiency: 0.000 | Rows Sent/Affected: 0 | Rows Examined: 137802 Query: SELECT post_id FROM wp_postmeta WHERE meta_value = '2014/04/testimonials-widget-premium-1.20.0-no-screenshots.zip' LIMIT 1

/nas/wp/www/cluster-1287/aihrus/wp-content/plugins/edd-software-licensing/includes/EDD_Software_Licensing.php:716 Count: 50 queries totalling 00:02:11 (average of 2.620 sec/query) Efficiency: 0.003 | Rows Sent/Affected: 581 | Rows Examined: 205992 Query: SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND

wp_posts.post_type = 'edd_license_log' AND (wp_posts.post_status = 'publish') AND ( (wp_postmeta.meta_key = '_edd_sl_log_license_id' AND CAST(wp_postmeta.meta_value AS CHAR) = '120874') ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC Efficiency: 0.000 | Rows Sent/Affected: 1 | Rows Examined: 204838 Query: SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND

wp_posts.post_type = 'edd_license_log' AND (wp_posts.post_status = 'publish') AND ( (wp_postmeta.meta_key = '_edd_sl_log_license_id' AND CAST(wp_postmeta.meta_value AS CHAR) = '110619') ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC Efficiency: 0.000 | Rows Sent/Affected: 2 | Rows Examined: 204840