31

I'm just reviewing the speed of a store and just wondering if anyone knows more about why I have over 100 EAV: Magento\Eav\Model\Config::getAttribute 0.006978 rows within my profiler.

It's just I do not remember ever seeing this many entries when reviewing profiler on previous occasions. This store does have a flat catalog enabled, however, it was disabled for a bit after attributes reached the limit for using a flat catalog. I thought EAV wouldn't be used if the flat catalog was enabled?

UPDATE

Even CMS pages and empty category pages without any products seem to be using the same number of getAttribute calls so I am unsure where they are coming from as the profiler does not make this clear. This seems to be an issue on the product pages also however even slower. This also seems to be getting worse I will try and save a copy of my profiler output for review.

I have tried disabling all third-party modules and reverting to the luma theme but still there and believe it may be since updating to 2.2.0 or 2.2.1?

  • Can anyone else try profiler to see if this is normal and what version you are running?

  • Should I be concerned? Pages Load in about 2-3 seconds noncached on production but within dev, I am noticing huge slowdowns and even worse looking profiler. Magento section of profiler can show as low as 1.5 seconds on dev but take 80 seconds for a response this was always maxed 3-5 seconds. Without profiler on the site speeds up considerably however I'm still concerned at some product pages taking 15 seconds when they used to be under 3s.

  • How can I stop it / track down where they are coming from?

I have a 2.1.7 that I have checked on and this is not the case here.

Profiler:

This seems to be getting worse so I want to show just to show how bad this profiler looks on an empty category page now (Dev and Production in separate tabs):

https://docs.google.com/spreadsheets/d/1fbw_XlJRpRYue8m9VI31lv8BdwBqZypRahFelMGWCq8/edit?usp=sharing

This, however, does seem to be worse with profiler enabled and page loads are a more normal 3 seconds uncached when this is disabled. I need to try a better profiler to try and figure this out but so far I haven't found a good one that is free.

Update 2

I had another little play with this today and have started by removing a lot of blocks from all catalog_product_view.xml files within the core vendor files. None of these removed any of the attributes calls even tho the page was basically blank.

I then modified the get attribute call to just echo a 1 out and the bulk of these was shown at top of the page. This is suggesting to me that this is happening before the page even begins to render unlike other instances of getAttribute which echoed next to where the attribute was called.

My issue however now only affects product and category pages which is odd wish I knew what caused that to change.

magento->LAYOUT->layout_render->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute->EAV: Magento\Eav\Model\Config::getAttribute
14
  • 1
    Could you use a more reliable profiler like Blackfire for eg? Then we will be able to see which class/method make so many calls. Nov 23, 2017 at 10:15
  • The problem does not seem to exist within that profiler from what i can tell?
    – harri
    Nov 23, 2017 at 15:23
  • Have you been able to sort this out? I'm seeing the same issue. Loading pages is incredibly slow.
    – pfandrade
    Feb 15, 2018 at 18:32
  • @pfandrade Not really my pages are not really that slow... like 1 - 3 seconds pre cache but i did wanna solve it to improve the speed. If you do got anywhere yourself please shout me on here tho and ill do the same.
    – harri
    Feb 15, 2018 at 18:56

2 Answers 2

1

I have debugged this function today: I can see your concern as this function seems big and we can see some load/save function calls within it.

However, after inspecting the code, load and save in fact are not calling the database but rather feed property in the classes that appear to be a 'shared' model.

--> each time the function is called, it will assign the attribute's data onto an array that is a property of the Config model and this property will prevent further calls to be doing a whole lot of code lines again.

The one line that could harm is in the function \Magento\Eav\Model\Entity\Collection\AbstractCollection::addAttributeToSelect

in this function, the line $attrInstance = $this->_eavConfig->getAttribute($this->getEntity()->getType(), $attribute); seems to be what will finally load the data for the attribute. However, if your system happens to be using a cache, this should use the cache storage to read the data and that means it should load at the fastest speed you can get.

Long story short, this function is typically a function in Magento that is doing a lot but after all these years of settling Magento as a premium eCommerce platform, it is quite clear Magento team has not fallen into basic traps of calling greedy functions again and again.

1

All product collections contain some columns and attribute to select. Imagine the collection that you prepared yourself without setting any additional attributes to select from DB. For example attribute manufacturer. If you iterate over that collection with getManufacturer method you will have as many additional DB queries as collection size.

For more standard example: You want to show manufacturer name on product's list first page. You have 30 items on that page. You've already edited phtml to implement getManufacturer method. This will produce 30 more queries just to select manufacturer IDs for specific items. This is the place where you can set your manufacturer attribute as used_in_products_listings. That will make sure your attribute will be added to all product collections until you reset the columns part for your collection selection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.