Magento EE 1.x is taking too much time to load due to layout/db_update

480 Views Asked by At

Our Magento store is getting too slow and taking around 1 minute to load page. I have seen below output in profiler, can you please let us know what is the db_update things and why it takes too much time and how do we fix this.

layout/db_update: default                               20.6206 1   0   0
layout/db_update: STORE_default                         20.6189 1   0   0
layout/db_update: MAP_popup                             20.6146 1   0   0
layout/db_update: MAP_price_msrp_item                   20.6131 1   0   0
layout/db_update: SHORTCUT_popup                        20.6116 1   0   0
layout/db_update: SHORTCUT_uk_popup                     20.6098 1   0   0
layout/db_update: catalog_product_view                  20.6077 1   0   0
layout/db_update: PRODUCT_TYPE_simple                   20.6062 1   0   0
layout/db_update: customer_logged_out                   20.6032 1   0   0
2

There are 2 best solutions below

1
On

You can use Aoe_Profiler extension to debug the details. You can install it from here: https://github.com/AOEpeople/Aoe_Profiler

Also follow this tutorial: http://fbrnc.net/blog/2012/08/magento-profiler#hello

I think it will help you to optimize the time taken by various threads.

1
On

The only place in the code where this profile runs is the function Mage_Core_Model_Layout_Update::fetchDbLayoutUpdates.

There could be several reasons why it would take 20 seconds each time that function runs, in order of likelihood:

  1. Custom code or 3rd party extension that does expensive operations during layout updates. For example an override of Mage::getResourceModel('core/layout')->fetchUpdatesByHandle() or any of the models/helpers used inside that function (which are many).
  2. Infrastructure issues (probably related to the database)
    • Very slow / overloaded database
    • Speed issues in DB connectivity

Like mentioned in another answer, you can use Aoe_Profiler to get more data for the first case.

I personally prefer using NewRelic (or a similar service) cause it will also show traces of specifically which parts of the code, DB queries or 3rd-party APIs are running slow - giving you a more complete picture of everything that could be slowing down your site.

(disclaimer: I'm a NewRelic partner)