1

Time to first byte is almost 6 seconds and full page load time is 8.60 second

I try to run profiler and here is the results

Memory usage: real: 45350912, emalloc: 44510384enter image description here

I can't figure out why page is too slow.

    <?php
    /**
     * Magento
     *
     * NOTICE OF LICENSE
     *
     * This source file is subject to the Academic Free License (AFL 3.0)
     * that is bundled with this package in the file LICENSE_AFL.txt.
     * It is also available through the world-wide-web at this URL:
     * http://opensource.org/licenses/afl-3.0.php
     * If you did not receive a copy of the license and are unable to
     * obtain it through the world-wide-web, please send an email
     * to license@magentocommerce.com so we can send you a copy immediately.
     *
     * DISCLAIMER
     *
     * Do not edit or add to this file if you wish to upgrade Magento to newer
     * versions in the future. If you wish to customize Magento for your
     * needs please refer to http://www.magentocommerce.com for more information.
     *
     * @category    design
     * @package     base_default
     * @copyright   Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
     * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
     * Modified by 2jdesign.co.uk(Developer 6) Date:12/28/2011
     */
    ?>
    <?php
    /**
     * Product list template
     *
     * @see Mage_Catalog_Block_Product_List
     */
    ?>
    <?php
        $_productCollection=$this->getLoadedProductCollection();
        $_helper = $this->helper('catalog/output');
    ?>
    <?php if(!$_productCollection->count()): ?>
    <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
    <?php else: ?>
    <div class="category-products">
     <h2 class="product-title">
         <?php
          /*BOF 2jdesign.co.uk (Dev 1)*/
          // For Category name on products list page //
          $current_page = Mage::app()->getFrontController()->getRequest()->getRouteName();
          if($current_page=='catalog'){
          $currCat = Mage::registry('current_category'); 
            echo  $currCat->getName();
         }
         /*EOF*/
        ?>
        </h2>
        <?php echo $this->getToolbarHtml() ?>   
        <?php // List mode ?>
        <?php $_columnCount = $this->getColumnCount(); ?>
        <?php $_columnCount = 3; ?>
        <?php if($this->getMode()!='grid'): ?>
        <?php $_iterator = 0; ?>
        <ol class="products-list" id="products-list">
        <?php foreach ($_productCollection as $_product): ?>
            <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
              <div class="list-top">
               <div class="list-bottom">
                <?php // Product Image ?>
                <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
                <?php echo Mage::helper('productlabel')->showLabel($_product,'category',$_productCollection);?><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(307,228); ?>" width="307" height="228" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
                <?php // Product description ?>
                <div class="product-shop">
                    <div class="f-fix">
                        <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
                        <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
                        <?php if($_product->getRatingSummary()): ?>
                        <?php //echo $this->getReviewsSummaryHtml($_product) ?>
                        <?php endif; ?>

                        <div class="list-price-left">
                        <div style="min-height:48px;float:left;">
                         <div class="price-per-me">
                         <?php //$price_per_meter_sq=$_product->getResource()->getAttribute('price_per_meter_sq')->getFrontend()->getValue($_product);             
                         // if($price_per_meter_sq){    
                             // echo "testprice".$price_per_meter_sq;
                            // print_r($_product);
                           ?>                         
                          <?php $currency = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); ?>
                          <?php
                            $_packm = $_product->getPackm2();
                            $_price = $_product->getPrice();
                            $_tax = $_product->getTaxPercent();                     
                            if(isset($_packm) && ($_packm!='')){                            
                                //$packmarray = explode('.',$_packm);
                                $packmarray = $_packm; // pack meter for calulation to per meter sq
                                //print_r($packmarray);
                                $pricewithtax = $_price*$_tax/100; // tax calculation
                                $includetaxprice = $_price+$pricewithtax; // price with include tax             
                                $packmPrice =  $includetaxprice/$packmarray; // final formula for per meter sq price                    
                                echo $currency.$price_per_meter_sq = number_format($packmPrice, 2, '.', ''); ?><label>per m<sup>2</sup>(<?php echo $_packm; ?>)</label>  
                           <?php } ?>

                         </div>
                         <?php echo $this->getPriceHtml($_product, true) ?>
                         </div>
                         <?php                  
                          $manufacturer=$_product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($_product);             $imageurl=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/brand/';
                          $manufacturer=str_replace(' ', '',$manufacturer);                 
                          $brands_image=$imageurl.$manufacturer.'.png';?>   
                          <span style="float:right;padding-top:6px;">
                          <img src="<?php echo $brands_image; ?>" width="73" height="34" alt="<?php echo $manufacturer; ?>" />
                          </span>
                        </div>

                        <div class="list-price-desc">
                        <div class="desc std">
                            <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
                        </div>
                        </div>
                        <div class="att-left">
                         <?php                  
                        $delivery_included=$_product->getResource()->getAttribute('delivery_included')->getFrontend()->getValue($_product); 
                        $imageurl=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/brand/';
                            if($delivery_included=='Yes'){
                            $delivery_img = $imageurl.'delivery_inc.png';?>                                 
                             <span style="float:left;padding-right:11px;">
                             <img src="<?php echo $delivery_img; ?>" alt="Delivery Included"/>
                 </span>
                        <?php } ?>
                        <span style="float:left;">
                         <?php $available_to_buy_individually=$_product->getResource()->getAttribute('available_to_buy_individually')->getFrontend()->getValue($_product);                  
                       if($available_to_buy_individually){      
                       $baseurl=$available_to_buy_individually; ?>  
                      <?php $url = Mage::helper('core/url')->getCurrentUrl();                     
                       if ($baseurl!=$url) {
                       $fullpackurlindividual = $this->getUrl($available_to_buy_individually);
                         $fullpackurlindividual = Mage::getModel('core/url')->sessionUrlVar($fullpackurlindividual);
                        $last_character_individual      = substr($fullpackurlindividual, -1 );
                           if($last_character_individual=='/'){
                               $fullpackurlindividual = substr($fullpackurlindividual, 0, -1);
                           }
                       ?>
                         <span class="availableindiually"><a href="<?php echo $fullpackurlindividual; ?>">&nbsp;</a></span>             
                        <?php }}else{ ?>
                        <?php $available_to_buy_by_per_m2=$_product->getResource()->getAttribute('available_to_buy_by_per_m2')->getFrontend()->getValue($_product);                 
                          if($available_to_buy_by_per_m2){      
                          $baseurl=$available_to_buy_by_per_m2; ?>  
                            <?php $url = Mage::helper('core/url')->getCurrentUrl();                     
                              if ($baseurl!=$url) {
                              $fullpackurlm2 = $this->getUrl($available_to_buy_by_per_m2);
                              $fullpackurlm2 = Mage::getModel('core/url')->sessionUrlVar($fullpackurlm2);
                              $last_character_m2      = substr($fullpackurlm2, -1 );
                                  if($last_character_m2=='/'){
                                      $fullpackurlm2 = substr($fullpackurlm2, 0, -1);
                                  }
                              ?>
                            <span class="product-list-availablemeter"><a href="<?php echo $fullpackurlm2; ?>">&nbsp;</a></span> 
                        <?php }}}?> 
                       </span>  
                       <?php if($_product->isSaleable()): ?>
                            <p class="list-add-cart"><button type="button" title="<?php echo $this->__('View') ?>" class="button btn-cart" onclick="setLocation('<?php echo $_product->getProductUrl() ?>')"><span><span><?php //echo $this->__('Add to Cart') ?></span></span></button></p>
                        <?php else: ?>
                            <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                        <?php endif; ?>
                        </div>
                    </div>
                </div>
                </div>
             </div>
            </li>
        <?php endforeach; ?>
        </ol>
        <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>

        <?php else: ?>

        <?php // Grid Mode ?>

        <?php $_collectionSize = $_productCollection->count(); ?>
        <?php $_columnCount = $this->getColumnCount(); ?>
        <?php 
            $_columnCount = 3; 
            $imageurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/brand/';
        ?>
        <?php $i=0; foreach ($_productCollection as $_product): ?>
            <?php if ($i++%$_columnCount==0): ?>
            <ul class="products-grid">
            <?php endif ?>
                <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
                <div class="middle-contain">
                   <h2 class="product-name">
                        <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>">
                           <?php 
                                $productname = explode('-',$_product->getName());
                                $firstskip = 0;
                                $dash_length = count($productname);
                                foreach($productname as $name)
                                {
                                    if($firstskip == 0)
                                    {
                                        echo $name."<br/>";
                                    }
                                    else if($firstskip == $dash_length)
                                    {
                                        echo "-".$name;
                                    }
                                    else
                                    {
                                        echo "-".$name."<br/>";
                                    }
                                    $firstskip++;
                                }
                            ?>
                        </a>
                    </h2>



                    <?php /* ?><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><?php echo Mage::helper('productlabel')->showLabel($_product,'category',$_productCollection);?><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(201,151); ?>" width="201" height="151" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
                    <?php */ ?>
                    <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>

                    <div class="price-des">
                        <div class="price-left">
                            <div style="min-height:73px;float:left;width:112px;">
                                <div class="price-per-me">            
                                    <?php $currency = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); ?>
                                    <?php
                                        $_packm = $_product->getPackm2();
                                        $_price = $_product->getPrice();
                                        $_tax = $_product->getTaxPercent();                     

                                        if(isset($_packm) && ($_packm!=''))
                                        {                           
                                            $packmarray = $_packm;
                                            $pricewithtax = $_price*$_tax/100;
                                            $includetaxprice = $_price+$pricewithtax;               
                                            $packmPrice =  $includetaxprice/$packmarray;

                                            echo $currency.$price_per_meter_sq = number_format($packmPrice, 2, '.', ''); ?><label>per m<sup>2</sup><br />(<?php echo $_packm."m<sup>2</sup> pack"; ?>)</label>  
                                    <?php } ?>
                                </div>              
                                <?php echo $this->getPriceHtml($_product, true) ?>
                                <?php
                                    $_units_per_pack = $_product->getUnits_per_pack();
                                    if(($_packm=='') && ($_units_per_pack!=''))
                                    {
                                        echo "<br /><br /><label>(".$_units_per_pack." units)</label><br />";   
                                    } 
                                ?>
                            </div>

                    <?php                   
                        $manufacturer = $_product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($_product);             
                        //$imageurl=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/brand/';
                        $manufacturer = str_replace(' ', '',$manufacturer); 
                        $brands_image = $imageurl.$manufacturer.'.png';
                    ?>  
                    <span style="float:left;padding-bottom:10px;">
                        <img src="<?php echo $brands_image; ?>" width="73" height="34" alt="<?php echo $manufacturer; ?>" />
                    </span>
                </div>

                    <div class="att-right">
                     <?php                  
                        $delivery_included = $_product->getResource()->getAttribute('delivery_included')->getFrontend()->getValue($_product);

                        if($delivery_included=='Yes')
                        {
                            $delivery_img = $imageurl.'delivery_inc.png';
                    ?>                                  
                            <span style="float:right;padding:0 0px 7px 0;">
                                <img src="<?php echo $delivery_img; ?>" alt="Delivery Included"/>
                            </span>
                    <?php } ?>

                    <span style="float:right;margin-right:-4px;">
                    <?php 
                        $available_to_buy_individually=$_product->getResource()->getAttribute('available_to_buy_individually')->getFrontend()->getValue($_product);

                        if($available_to_buy_individually)
                        {       
                            $baseurl=$available_to_buy_individually; 
                    ?>  
                    <?php 
                            $url = Mage::helper('core/url')->getCurrentUrl();                     

                            if ($baseurl != $url) 
                            {
                                $fullpackurlindividual = $this->getUrl($available_to_buy_individually);
                                $fullpackurlindividual = Mage::getModel('core/url')->sessionUrlVar($fullpackurlindividual);
                                $last_character_individual      = substr($fullpackurlindividual, -1 );
                                if($last_character_individual=='/')
                                {
                                    $fullpackurlindividual = substr($fullpackurlindividual, 0, -1);
                                }
                    ?>
                                <span class="availableindiually">
                                    <a href="<?php echo $fullpackurlindividual; ?>">&nbsp;</a>
                                </span>             
                    <?php 
                            }
                        }
                        else{ 
                    ?>
                    <?php 
                            $available_to_buy_by_per_m2 = $_product->getResource()->getAttribute('available_to_buy_by_per_m2')->getFrontend()->getValue($_product);

                            if($available_to_buy_by_per_m2)
                            {       
                                $baseurl=$available_to_buy_by_per_m2; 
                    ?>  
                    <?php 
                                $url = Mage::helper('core/url')->getCurrentUrl();                     
                                if ($baseurl!=$url) 
                                {
                                    $fullpackurlm2 = $this->getUrl($available_to_buy_by_per_m2);
                                    $fullpackurlm2 = Mage::getModel('core/url')->sessionUrlVar($fullpackurlm2);
                                    $last_character_m2 = substr($fullpackurlm2, -1 );
                                    if($last_character_m2 == '/')
                                    {
                                      $fullpackurlm2 = substr($fullpackurlm2, 0, -1);
                                    }
                    ?>
                                    <span class="availablemeter"><a href="<?php echo $fullpackurlm2; ?>">&nbsp;</a></span>  
                    <?php 
                                }
                            }
                        }
                    ?>  
                    </span> 
                </div>
            </div>      
            <div class="short"><?php echo $_product->getShortDescription(); ?></div>

                    <?php //echo $this->getLayout()->createBlock('ekomimeetsmage/frontend_product_name')->setData('product', $_product)->setTemplate('ekomimeetsmage/product/name.phtml')->toHtml(); ?>

                    <?php if($_product->getRatingSummary()): ?>
                    <?php //echo $this->getReviewsSummaryHtml($_product, 'short') ?>
                    <?php endif; ?> 
                       <div class="actions">
                        <?php if($_product->isSaleable()): ?>
                            <button type="button" title="<?php echo $this->__('View') ?>" class="button btn-cart" onclick="setLocation('<?php echo $_product->getProductUrl() ?>')"><span><span></span></span></button>
                        <?php else: ?>
                            <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                        <?php endif; ?>
                    </div>
                    </div>
                </li>
            <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
            </ul>
            <?php endif ?>
            <?php endforeach ?>
            <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
        <?php endif; ?>

        <div class="toolbar-bottom">
            <?php echo $this->getToolbarHtml() ?>
        </div>
    </div>
    <?php endif; ?>
  • Please share code of list.phtm; – Amit Bera Dec 30 '16 at 9:10
  • List.phtml added to question – Vaibhav Ahalpara Dec 30 '16 at 9:13
  • Please check 2column-right.phtml – Amit Bera Dec 30 '16 at 9:17
  • what do you mean by check 2column-right.phtml my current page layout is 2column-right.phtml – Vaibhav Ahalpara Dec 30 '16 at 9:18
  • based on your profile output your TTFB is 3.5 not 6 – Konstantin Gerasimov Dec 30 '16 at 9:32
2

to me it looks like your shop layout is too heavy for your hardware and software, upgrade to php7 and fine tune mysql with mysqltuner, get more CPU and RAM

quick fix to hide your performance issues - install Full Page Cache extension

more tedious path:

here are a few things to look for:

  1. aitsys_rewriter observer takes 0.6s on every page request! consider disabling aitsys extensions.
  2. get_tablename and init:stores take too long - do you have mysql query cache enabled?
  3. closely inspect these templates:

    1. frontend/default/default/template/magiczoomplus/list.phtml - 0.5s

    2. frontend/default/lsd/template/catalog/category/view.phtml - 0.6s

    3. frontend/default/default/template/mgxtips/catalog/layout/filter.phtml - 1.2s (looks like custom module, try to disable it and see if TTFB drops)

    4. I see you load catalog/product/price.phtml 30 times - try to lower that number

Taken from Magento TTFB optimization .

Also see 34 steps to improve magento performance.

Disclaimer: I wrote the above articles.

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.