Lots of queries to the DB
-
Hi, thanks for the great plugin.
We are experiencing a spike in visitors on a particular woocommerce installation and the DB seems to be the slow part. I enabled MariaDB slow quey log for 1 hour and screened the log file and this query pops up thousands of times (although very small time to process each, but too many for the period):
SELECT
ID
FROM
wp_yith_wcwl_lists
WHERE
session_id = ‘?’
AND expiration > NOW()
AND is_default = ?I am not sure if it is this the problem, but in 1 hour period this query was called 60165 times using 1191 seconds in total. Meaning a almost 1/3 of the time processing this kind of request only.
We use Woocommerce 4.1 and YITH wishlist plugin 3.0.10 on flatsome theme with the heart icon on the menu bar along with cart, I am guessing it is firing in every page load possibly multiple times? No idea.
We noticied slow admin after 200 concurrent users (according to google analytics) shopping and 100% CPU usage after 250+, again, not sure if related but since we troubleshooting and found this many queries made me wonder and i came here to ask. All this happened after we updated woocommerce (was very old 3.4) and everythign else like theme and plugins.
Also, there is this on PHP error.log, not sure if related:
PHP message: wc_get_product was called incorrectly. wc_get_product should not be called before woocommerce_init, woocommerce_after_register_taxonomy e woocommerce_after_register_post_type are done.
Backtrace: require_once(‘wp-load.php’), require_once(‘/MYDOMAIN.COM/wp-config.php’), require_once(‘wp-settings.php’), do_action(‘init’), WP_Hook->do_action, WP_Hook->apply_filters, YITH_WCWL_Frontend->init, YITH_WCWL_Frontend->_convert_cookies_to_session, YITH_WCWL_Wishlist->save, YITH_WCWL_Wishlist->save_items, WC_Data->save, WC_Data_Store->create, YITH_WCWL_Wishlist_Item_Data_Store->create, YITH_WCWL_Wishlist_Item->get_product_price, YITH_WCWL_Wishlist_Item->get_product, wc_get_product, wc_doing_it_wrong. This message was added in version 3.9″ while reading response header from upstream, client: [ip-censored], server: MYDOMAIN.COM, request: “GET /wp-admin/admin-ajax.php?action=flatsome_update_wishlist_count HTTP/2.0”, upstream: “fastcgi://127.0.0.1:9070”Again, I am not sure if it really is the plugin, since the front end functionality is ok. Any help appreciated.
- The topic ‘Lots of queries to the DB’ is closed to new replies.