cancel
Showing results for 
Search instead for 
Did you mean: 

Up to 1 minute loading time during checkout

Up to 1 minute loading time during checkout

Hey people,

 

I am actually working on my new webshop and have some performance issues.

When i click on the checkout button in the shoppingcart it takes sometimes up to 1 minute to load the login window.

Using the profiler I found this lines, which seems to be the main issue.

 

mage::dispatch::controller::action::checkout_onepage_index::layout_render22.0200100
frontend/base/default/template/checkout/onepage.phtml21.626413,610,8244,194,304

frontend/base/default/template/persistent/checkout/onepage/billing.phtml

21.306912,508,8163,932,160

TEST: Mage_Directory_Helper_Data::getRegionJsonByStore

20.96292946,6721,835,008

 

What can I do?

 

Thanks a lot!
Christian

 

Magento CE

Version 1.9.2.4

7 REPLIES 7

Re: Up to 1 minute loading time during checkout

Have you made any local code customizations to the Mage_Directory_Helper_Data class, or any extension overriding this class? As shown in the profiler output, the method getRegionJsonByStore belonging to this class takes 20 seconds to load, which is not normal. I am also not sure why that line is prepended with the word "TEST:". I would start by looking into the code related to this method.

Sindre M, CEO & Founder
ProperHost.com - The Magento Hosting Experts

Re: Up to 1 minute loading time during checkout

Thanks Sindre for your reply!

 

I found the "TEST-function" in the code, but it seems not to be modified or added by a pugin.

 

    /**
     * Retrieve regions data json
     *
     * @param int|null $storeId
     * @return array()
     */
    public function getRegionJsonByStore($storeId = null)
    {
        Varien_Profiler::start('TEST: '.__METHOD__);
        if (!$this->_regionJson) {
            $store = $this->_app->getStore($storeId);
            $cacheKey = 'DIRECTORY_REGIONS_JSON_STORE' . (string)$store->getId();
            if ($this->_app->useCache('config')) {
                $json = $this->_app->loadCache($cacheKey);
            }
            if (empty($json)) {
                $regions = $this->_getRegions($storeId);
                $helper = $this->_factory->getHelper('core');
                $json = $helper->jsonEncode($regions);

                if ($this->_app->useCache('config')) {
                    $this->_app->saveCache($json, $cacheKey, array('config'));
                }
            }
            $this->_regionJson = $json;
        }

        Varien_Profiler::stop('TEST: ' . __METHOD__);
        return $this->_regionJson;
    }

Re: Up to 1 minute loading time during checkout

That method by itself should not be very time consuming, so the problem could be something else. Is the slowness only appearing on the checkout page and all other pages are loading quickly? Is your site a multi-store installation? If so, how many stores do you have?

Sindre M, CEO & Founder
ProperHost.com - The Magento Hosting Experts

Re: Up to 1 minute loading time during checkout

I am having the same problem. When I click add to shopping cart it will take up to a minute to process.

These are the outstanding entries from Profiler:

Code ProfilerTimeCntEmallocRealMem
frontend/base/default/template/page/1column.phtml60.116140506644718592
frontend/Titan/default/template/checkout/cart.phtml60.096135639364194304
mage60.652100
mage::dispatch::controller::action::checkout_cart_index60.229100
mage::dispatch::controller::action::checkout_cart_index::layout_render60.122100
mage::dispatch::routers_match60.237100
Mage_Checkout_CartController::indexActioncart_display60.138100

 

Magento Version: 1.9.2.4-1

I am running this site is AWS:

Instance type: t2.small

EBS Storage: Type: gp2 (30gb)

FilesystemSizeUsedAvailUse%Mounted on
udev996M12K996M1%/dev
tmpfs201M352K200M1%/run
/dev/xvda130G3.6G25G13%/
none4.0K04.0K0%/sys/fs/cgroup
none5.0M05.0M0%/run/lock
none1001M01001M0%/run/shm
none100M0100M0%/run/user

 

(mySQL Does not seem to be the issue)

SQL Profiler Info:

Executed 69 queries in 0.018908739089966 seconds
Average query length: 0.00027403969695603 seconds
Queries per second: 3649.1063561513
Longest query length: 0.0028798580169678

Re: Up to 1 minute loading time during checkout

I would start by looking at this template: frontend/Titan/default/template/checkout/cart.phtml

 

Judging from the profiler output, there seem to be a large delay while loading this template. You can try to replace it with the default one from the core package. If the issue goes away you need to optimize the code of your custom template.

Sindre M, CEO & Founder
ProperHost.com - The Magento Hosting Experts

Re: Up to 1 minute loading time during checkout

Actually we have 2 stores on the installation. Both are actually running with the default theme.

 

Yes, every other page is fast. It does only and always spend so much time, when you click on the checkout-button in the shopping-cart or in the title-bar while cart is not empty.

 

just try it yourself. This link brings you to a product of our shop.

https://community:1minute@magento.twv-grund.de/index.php/trisana-melaleuka-plus-oel-testflasche-20-m...

Click on "IN DEN WARENKORB" to add it to the shopping-cart.

Then Click on "ZUR KASSE" to checkout.

As you can see it will take a while.

Re: Up to 1 minute loading time during checkout


@SindreM wrote:

I would start by looking at this template: frontend/Titan/default/template/checkout/cart.phtml

 

Judging from the profiler output, there seem to be a large delay while loading this template. You can try to replace it with the default one from the core package. If the issue goes away you need to optimize the code of your custom template.


Thank you and I have checked the file as suggested. The contents is below but this is actually the same file as in the default/modern template (the Titan template is based off that one) The cart.phtml file has not been  customized at this point.

 

<div class="cart">
    <div class="page-title title-buttons">
        <h1><?php echo $this->__('Shopping Cart') ?></h1>
        <?php if(!$this->hasError()): ?>
        <ul class="checkout-types">
        <?php foreach ($this->getMethods('top_methods') as $method): ?>
            <?php if ($methodHtml = $this->getMethodHtml($method)): ?>
            <li><?php echo $methodHtml; ?></li>
            <?php endif; ?>
        <?php endforeach; ?>
        </ul>
        <?php endif; ?>
    </div>
    <?php echo $this->getMessagesBlock()->toHtml() ?>
    <?php echo $this->getChildHtml('form_before') ?>
    <form action="<?php echo $this->getFormActionUrl() ?>" method="post">
        <fieldset>
            <table id="shopping-cart-table" class="data-table cart-table">
                <col width="1" />
                <col />
                <col width="1" />
            <?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
                <col width="1" />
            <?php endif ?>
            <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                <col width="1" />
            <?php endif; ?>
            <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                <col width="1" />
            <?php endif; ?>
                <col width="1" />
            <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                <col width="1" />
            <?php endif; ?>
            <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
                <col width="1" />
            <?php endif; ?>
                <col width="1" />

            <?php $mergedCells = ($this->helper('tax')->displayCartBothPrices() ? 2 : 1); ?>
                <thead>
                    <tr>
                        <th rowspan="<?php echo $mergedCells; ?>">&nbsp;</th>
                        <th rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Product Name') ?></span></th>
                        <th rowspan="<?php echo $mergedCells; ?>"></th>
                        <?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
                        <th rowspan="<?php echo $mergedCells; ?>" class="a-center"><span class="nobr"><?php echo $this->__('Move to Wishlist') ?></span></th>
                        <?php endif ?>
                        <th class="a-center" colspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Unit Price') ?></span></th>
                        <th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
                        <th class="a-center" colspan="<?php echo $mergedCells; ?>"><?php echo $this->__('Subtotal') ?></th>
                        <th rowspan="<?php echo $mergedCells; ?>" class="a-center">&nbsp;</th>
                    </tr>
                    <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
                    <tr>
                        <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
                        <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
                        <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
                        <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
                    </tr>
                    <?php endif; ?>
                </thead>
                <tfoot>
                    <tr>
                        <td colspan="50" class="a-right">
                            <?php if($this->getContinueShoppingUrl()): ?>
                                <button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button btn-continue" onclick="setLocation('<?php echo Mage::helper('core')->quoteEscape($this->getContinueShoppingUrl()) ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
                            <?php endif; ?>
                            <button type="submit" name="update_cart_action" value="update_qty" title="<?php echo $this->__('Update Shopping Cart'); ?>" class="button btn-update"><span><span><?php echo $this->__('Update Shopping Cart'); ?></span></span></button>
                            <button type="submit" name="update_cart_action" value="empty_cart" title="<?php echo $this->__('Clear Shopping Cart'); ?>" class="button btn-empty" id="empty_cart_button"><span><span><?php echo $this->__('Clear Shopping Cart'); ?></span></span></button>
                            <!--[if lt IE 8]>
                            <input type="hidden" id="update_cart_action_container" />
                            <script type="text/javascript">
                            //<![CDATA[
                                Event.observe(window, 'load', function()
                                {
                                    // Internet Explorer (lt 8) does not support value attribute in button elements
                                    $emptyCartButton = $('empty_cart_button');
                                    $cartActionContainer = $('update_cart_action_container');
                                    if ($emptyCartButton && $cartActionContainer) {
                                        Event.observe($emptyCartButton, 'click', function()
                                        {
                                            $emptyCartButton.setAttribute('name', 'update_cart_action_temp');
                                            $cartActionContainer.setAttribute('name', 'update_cart_action');
                                            $cartActionContainer.setValue('empty_cart');
                                        });
                                    }

                                });
                            //]]>
                            </script>
                            <![endif]-->
                        </td>
                    </tr>
                </tfoot>
                <tbody>
                <?php foreach($this->getItems() as $_item): ?>
                    <?php echo $this->getItemHtml($_item) ?>
                <?php endforeach ?>
                </tbody>
            </table>
            <script type="text/javascript">decorateTable('shopping-cart-table')</script>
        </fieldset>
    </form>
    <div class="cart-collaterals">
        <div class="col2-set">
            <div class="col-1">
                <?php if($_crosssell = $this->getChildHtml('crosssell')): ?>
                    <?php echo $_crosssell; ?>
                <?php else: ?>
                <div class="no-crosssell">
                    <img src="<?php echo $this->getSkinUrl('images/media/callout1.jpg') ?>" alt="" />
                    <img src="<?php echo $this->getSkinUrl('images/media/fpo_no_crosssell.gif') ?>" alt="" />
                </div>
                <?php endif; ?>
            </div>
            <div class="col-2">
                <?php /* Extensions placeholder */ ?>
                <?php echo $this->getChildHtml('checkout.cart.extra') ?>
                <?php echo $this->getChildHtml('coupon') ?>
                <?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
                <div class="totals">
                    <?php echo $this->getChildHtml('totals'); ?>
                    <?php if(!$this->hasError()): ?>
                    <ul class="checkout-types">
                    <?php foreach ($this->getMethods('methods') as $method): ?>
                        <?php if ($methodHtml = $this->getMethodHtml($method)): ?>
                        <li><?php echo $methodHtml; ?></li>
                        <?php endif; ?>
                    <?php endforeach; ?>
                    </ul>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</div>