0

I'm working in an organisation that makes use of the admin/manual order functionality within the Magento Admin Panel. I've recently added a custom module which has absolutely killed the performance of the page; where products would normally add within a couple of seconds they now take at least 5, rising to 25-30 seconds per item once there are a dozen or so items in the basket. This is too slow when you're trying to process a customer who's on the phone.

The custom module added an attribute to the order (here's the install script):

$installer = new Mage_Eav_Model_Entity_Setup('core_setup');

$installer->startSetup();

$salesInstaller = new Mage_Sales_Model_Resource_Setup('core_setup');

$entities = array(
    'quote',
    'order'
);

$options = array(
    'type'     => Varien_Db_Ddl_Table::TYPE_BOOLEAN,
    'visible'  => true,
    'required' => false,
    'grid'     => true
);
foreach ($entities as $entity) {
    $salesInstaller->addAttribute($entity, 'customer_first_order', $options);
}

$installer->endSetup();

Apart from that, the module simply observes sales_order_save_after

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <WS_FirstOrder>
            <version>0.0.7</version>
        </WS_FirstOrder>
    </modules>   
    <global>
        <resources>
            <ws_firstorder_setup>
                <setup>
                    <module>WS_FirstOrder</module>
                </setup>
            </ws_firstorder_setup>
        </resources> 
        <fieldsets>
            <sales_convert_quote>
                <customer_first_order>
                    <to_order>*</to_order>
                </customer_first_order>
            </sales_convert_quote>
        </fieldsets>
        <models>
            <ws_firstorder>
                <class>WS_FirstOrder_Model</class>
            </ws_firstorder>
        </models>
        <events>
            <sales_order_save_after>
                <observers>
                    <first_order_handle>
                        <class>ws_firstorder/observer</class>
                        <method>handleCustomerFirstOrder</method>
                        <type>singleton</type>
                    </first_order_handle>
                </observers>
            </sales_order_save_after>
            <customer_first_order>
                <observers>
                    <first_order_record>
                        <class>ws_firstorder/observer</class>
                        <method>recordCustomerFirstOrder</method>
                        <type>singleton</type>
                    </first_order_record>
                </observers>
            </customer_first_order>
        </events>
    </global>
    <frontend>
    </frontend>
</config>

Moving the observer to frontend seems to make no difference. The module is functioning otherwise as expected. The only other thing I've done was update the admin order grid to show the new attribute. I've tried disabling module output (through admin) and disabling the module altogether (through config XML) and this all has made no difference.

Does anybody have any ideas why this may have slowed that down so much, and what I can do to get the performance back?

Update 1 I've set the threshold for MySQL Slow Query logging at 0.5 seconds and restarted the server. It doesn't seem to be catching any queries related to the order process - which is odd because NewRelic is reporting that /sales_order_create/loadBlock is making a call to MySQL catalog_product_entity_decimal select that is taking 900ms on average. The WebTransaction itself is reported at 1041ms average.

1

In the end, it was absolutely nothing to do with my module, and was the result of another (very) premium module (Ebizmarts Recurring Payments). Once that was disabled, it's going rather nicely.

Only lost 3 days doubting myself! Let that be a lesson not to roll multiple different updates out in a single commit.

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.