Pablo Westphalen
Forum Replies Created
-
Forum: Plugins
In reply to: [Abandoned Cart Lite for WooCommerce] Performance problems – abundant writesActually, i was not that wrong in the beggining. The plugin doesn’t directly hook itself to calculate_totals(), but it seems that woocommerce_cart_updated is a dangerous hook (https://github.com/woocommerce/woocommerce/issues/13542) that ends up being triggered by it [and other things], so wcal_store_cart_timestamp is called as a side effect (on every kind of request, even to admin heartbeats)
- This reply was modified 8 years, 1 month ago by Pablo Westphalen.
Forum: Plugins
In reply to: [Abandoned Cart Lite for WooCommerce] Performance problems – abundant writesHi! You’re right, i mentioned the wrong hook. I’m analyzing this plugin’s performance impact and came across these 3 major findings
1 – wcal_activate() does not set indexes on the tables it creates for the most queried columns, so the SELECT queries are slow when the tables get big. I’ve manually added some and that helped lookup performance.
2 – The wcal_store_cart_timestamp() function from woocommerce-ac.php is hooked to woocommerce_cart_updated and that indeed fires on every page load. This is a function that does writes to the database and i would think (correct me if im wrong) that we only want it to run when something about the cart actually changes.
3 – the save_data() method from wcal_class-guest.php has DB write calls inside a foreach loop. my profiling tool (new relic) captured one request to it that ran 66 “DELETE FROM
_ac_abandoned_cart_history_liteWHERE user_id = ?” queries that took a total of 56,900ms to process (i think that table indexes would have helped then but, still, there’s got to be a way to optimize these queries, using foreach loop to build one big query that’ll run only once.Oh and i’m afraid i can’t share the URL, it’s not a public store.
I see. Thanks for the tip!