After having many deadlocks due to a high order volumne I've applied the these fixes to the core. Some can be found in a Magento forum. Before the fixes we could only process 1 order every 5-10 secs. Updating to Magento 1.8 is currently not an option but in 1-2 months.
Mage_Sales_Model_Abstract::_afterSave
must be removed and replaced with afterCommitCallback
. This is important to move the grid update (of sales_flat_order_grid) out of the transaction.
Rewrite the method of the Mage_CatalogInventory_Model_Observer::reindexQuoteInventory()
to remove the price reindexing from the transaction. That index process will also be fired in event sales_model_service_quote_submit_success
.
In our case there are no price changing rules so simply commented out the reindexProductIds()
method and reindex the prices during the night. To be more reliable you can write the product ids into a queue table and process them later.
After applying these changes we can now process min 5 orders per second. There is still a deadlock poping up in subtractQuoteInventory()
but that one comes only really seldom. So no furhter investigations for the moment.
Test ran with that JMeter setup:
Replacing Mage_Sales_Model_Abstract::_afterSave with afterCommitCallback will take the inventory reindexing out of the transaction which may lead to a bug in the inventory counts. Did you apply this patch to magento 1.7?