magento-lts icon indicating copy to clipboard operation
magento-lts copied to clipboard

High usage of redis hget with attribute group_price

Open midlan opened this issue 4 years ago • 6 comments

Preconditions (*)

  1. Product attribute group_price installed

Steps to reproduce (*)

  1. Visit product page

Result (*)

After we installed the group_price attribute, it really slowed down our product page by many calls to redis hget: image

To fix it, I disabled (rewrite) the method Mage_Catalog_Model_Product_Attribute_Backend_Groupprice_Abstract::afterLoad.

Here is newrelic backtrace where I spotted the problem: image

midlan avatar Apr 02 '21 08:04 midlan

what exactly do you mean by "Product attribute group_price installed" ?

tmotyl avatar Apr 02 '21 09:04 tmotyl

@tmotyl I mean this attribute: https://github.com/OpenMage/magento-lts/blob/1.9.4.x/app/code/core/Mage/Catalog/sql/catalog_setup/upgrade-1.6.0.0.9-1.6.0.0.10.php#L127

midlan avatar Apr 02 '21 09:04 midlan

What did you do to install/enable/disable it?

joshua-bn avatar Apr 02 '21 21:04 joshua-bn

@joshua-bn I did this:

class MyRewrite extends Mage_Catalog_Model_Product_Attribute_Backend_Groupprice {

    public function afterLoad($object) {
        return $this; //afterload disabled due to poor performance
    }

}

midlan avatar Jul 21 '21 15:07 midlan

So is this the function that's causing the problem? https://github.com/OpenMage/magento-lts/blob/1.9.4.x/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Groupprice/Abstract.php#L221-L252

probably the loadPriceData()?

fballiano avatar Aug 28 '22 11:08 fballiano

@fballiano yes the link points to the problematic function

midlan avatar Aug 28 '22 20:08 midlan