MySQL Deadlocks with Magento

One of the things that Magento, and specifically the Zend Framework provide developers is the ability to not have to think about database details as it should just handle all that for you. When it becomes obvious that there is a problem somehow with the production database getting some sort of SQL errors, its time for the developers to start caring about the implementation and architecture details of the database.

Symptoms

One of the indicators of upcoming troubles is that your admin users start to get error messages saying that there are deadlocks in the transactions. At first, these errors are extremely sporadic and hard to track down. Over time and increased traffic loads, they will become more frequent to the point that it requires attention.

Fortunately, there is a relatively new Magento extension that enables you to replay the deadlock transactions until they run successfully so that you can get your site back to running properly. While this is not a permanent fix for your issues, as it will slow the site while doing certain actions, it does make the errors stop so that you can fix the root issue. This extension is the Philwinkle_DeadlockRetry. I have taken a look at the code and it looks fairly safe, but have not used it in any of my sites, so be careful about deploying it to a busy production site.

Related Posts

Mar 30, 2014
2 minutes

Login Problems with Magento and Varnish

When you have a Magento website configured to use Varnish as a caching frontend, there are certain scenarios where you may have some problems logging-in to the frontend of the website. It poses some unique problems that are not frequently seen on a typical website. This issue typically manifests itself to the end user by visiting the login page, entering the correct credential, submitting the form, and then the page reloads the login page again instead of redirecting to the My Account page or whatever page is specified in the configuration.

Mar 26, 2014
3 minutes

Magento FrontName Naming and SSL/HTTPS

One of the things that has always been an issue for sites that are based on Magento is that they are slow. Well, to be fair, sites using Magento Enterprise Edition that take advantage of the built-in full-page caching functionality seem to have decent page load times. One way to take care of this slow load time issue is to utilize a third-party full-page caching solution such as what Varnish provides.

Mar 29, 2014
2 minutes

301 Redirecting in Varnish

In Magento, you can set your secure and non-secure URLs explicitly. This works as expected in most cases, but can cause some issues when you have to specify full URLs or need to make any AJAX requests. When using the Nexcess Turpentine extension to enable Magento and Varnish to work together and you wish to only support traffic at www.example.com and not example.com, you would need to enable the setting in the Turpentine module to normalize the host.