How to avoid database lock up in Zen Cart

Sep 10, 2011 | Zen Cart Tips | 0 comments

I was having issues with the database locking up on the server. Each time Zen Cart makes a query of the database, it is locked and then unlocked when the query finishes. I have a lot of processes outside of Zen Cart also running on the server. Periodically, the server would lock up and I would need to manually restart SQL. This was becoming a pain. So, I investigated the queries Zen Cart was making and found one that is called every time a page is viewed. It’s the Zen Cart hit counter.

This is used to display the number of hits in the Zen Cart admin area. If you’re using Google Analytics like most of us, there is really no need for the Zen Cart counter. So, I commented out the line and it seemed clear up the problem. The database has not locked up since.

I can’t guarantee this will cure the problem however. There are so many queries going on in Zen Cart it’s difficult to find the culprit.

**UPDATE** My database did lock up again after a month or so since I made this update. While it did certainly seem to help, there may be some other issues at hand. By the way, the site is hosted on Rackspace (tier 1 provider), and not in a cloud, so this has nothing to do with being on a shared server. They supplied me with a report on the SQL queries that had locked up some of the tables. Most of the queries looked like they came from the Zen admin area by looking up customers and orders. There are over 35k records in the customers table. This doesn’t seem to be excessively large. The version of Zen Cart I’m using is a little outdated, v1.3.9e and I’m not sure if v1.3.9g would make a difference.

Simply comment out the line below with a double slash (as shown) in your /includes/application_top.php file.

[php]
// require(DIR_WS_INCLUDES . ‘counter.php’);
[/php]

 

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.