0

I have an OSX development environment in which I ported a Magento db that is working fine in production.

My dev environment is using:

  • Magento 1.8.1.0
  • MySql 5.7.11
  • PHP 5.5.30
  • Apache/2.4.16 (Unix)

The backend is working fine, however the frontend is incredibly slow (2.5 minutes to load the index.html).

Do you have any idea of what is going wrong?

This are the first lines of my profiler output ordered by time (I am sorry for the pretty bad table format):

Memory usage: real: 54001664, emalloc: 43746624 Code Profiler Time Cnt Emalloc RealMem mage 292.1082 1 0 0 mage::dispatch::routers_match 291.498 1 0 0 mage::dispatch::controller::action::predispatch 164.4863 1 4,474,112 4,718,592 CORE::create_object_of::Mage_Core_Model_Session 164.4522 2 279,216 262,144 Mage_Core_Model_Session_Abstract_Varien::start/start 164.4475 1 91,096 262,144 mage::dispatch::controller::action::cms_index_index 127.0072 1 0 0 mage::dispatch::controller::action::cms_index_index::layout_render 126.8173 1 0 0 frontend/mascagni/mt_colinus/template/page/1column.phtml 126.7907 1 13,076,656 22,806,528 __EAV_COLLECTION_LOAD_ENT__ 120.2808 26 4,635,184 4,194,304 frontend/mascagni/mt_colinus/template/page/html/header.phtml 118.4312 1 3,421,056 3,670,016 frontend/mascagni/mt_colinus/template/magenthemes/navigation/top.phtml 118.3935 1 2,132,200 2,359,296 frontend/mascagni/mt_colinus/template/magenthemes/productsscroller/productsscroller.phtml 5.1881 1 4,959,856 15,728,640 frontend/mascagni/mt_colinus/template/magenthemes/productslist/productslist.phtml 2.6763 1 709,760 0 frontend/mascagni/mt_colinus/template/magenthemes/productslist/products.phtml 2.6632 1 491,480 0 __EAV_LOAD_MODEL__ 2.3984 208 11,420,360 3,932,160 __EAV_COLLECTION_AFTER_LOAD__ 1.9576 26 3,239,952 2,883,584 __EAV_LOAD_MODEL_AFTER_LOAD__ 1.0366 208 3,548,504 2,883,584 __EAV_LOAD_MODEL_ATTRIBUTES__ 0.9912 208 14,450,832 0 frontend/mascagni/mt_colinus/template/catalog/product/price.phtml 0.6862 22 1,891,032 0 mage::dispatch::db_url_rewrite 0.5266 1 61,168 0 __EAV_COLLECTION_LOAD_ATTR__ 0.4639 26 420,704 262,144 DISPATCH EVENT:catalog_block_product_list_collection 0.3955 2 1,787,800 1,572,864 OBSERVER: review 0.3952 2 1,784,992 1,572,864 OBSERVER: inventory 0.288 66 2,675,256 1,835,008 DISPATCH EVENT:catalog_product_collection_load_after 0.2378 22 3,206,024 2,883,584 mage::dispatch::controller::action::cms_index_index::layout_generate_blocks 0.1612 1 15,425,136 15,204,352 DISPATCH EVENT:catalog_product_load_after 0.0974 44 548,240 0 BLOCK ACTION: checkout_cart_link -> addCartLink 0.0566 1 5,490,824 5,505,024 BLOCK: bestseller 0.0411 1 2,938,944 2,883,584 mage::app::init::stores 0.0344 1 3,654,376 3,670,016

  • Could there be caching set up on production that are not set up or not working on your dev machine? – Aric Watson Feb 11 '16 at 17:18
  • I have disabled (from the backend) both the zend cache and the normal cache in my dev enviroment – Niko Zarzani Feb 11 '16 at 17:25
  • Disabling caching in Magento certainly makes things a lot slower, especially with Modules like ManaDev – DarkMukke Feb 11 '16 at 17:46
  • If cache is turned off on dev, that's certainly slowing things down, if not the whole cause of the performance difference! – Aric Watson Feb 12 '16 at 12:24
  • Actually I enabled and disabled it and doesn't make a noticeable difference :/ – Niko Zarzani Feb 12 '16 at 13:43
0

To my future self: identify the slow call by means of the profiler, try replacing the same call with a different Magento method

e.g.

Get all subcategories:

Mage::getModel('catalog/category')->getCategories($catId);

Replaced with:

$categoryCollection = Mage::getModel('catalog/category')->getCollection()
    ->addAttributeToFilter('is_active', 1) //only active categories
    ->addAttributeToFilter('include_in_menu', 1)
    ->addFieldToFilter('parent_id', $catId)
    ->addAttributeToSort('name', 'ASC');
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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