开发者

Zen Cart too many writes to database. Possible solutions?

开发者 https://www.devze.com 2023-02-26 07:03 出处:网络
I am working on something that uses Zen Cart. Changing the site from Zen Cart is not optional at this point. The site works fine most of the time, but every week or so, the site takes a performance hi

I am working on something that uses Zen Cart. Changing the site from Zen Cart is not optional at this point. The site works fine most of the time, but every week or so, the site takes a performance hit. Discussions with the server provider indicates that it is almost certainly being caused by too many writes to the database resulting in inefficient i/o usage. The database server is different from the web server, but if the database server does not have enough available i/o, the site would suffer (since pretty much every single page on the site makes a database call). I am looking for a solution to fix this, and believe I have found some, but would like some feedback.

A) Determine if I can modify zen cart to use INSERT DELAY instead of INSERT so the pages don't hang on particular queries. However, Zen Cart is a huge system and making a broad scale change like this might have negative ramifications (for instance, DELAY statements won't execute on tables that have been locked with LOCKED TABLES, or subsequent pages not properly reflecting actions taken by the user on prior pages since they can load without the prior queries being completed).

B) Deploy a hybrid hosting solution in which the site runs on the cloud, but the database runs on a server with multiple SAS drives to increase write speed and thereby freeing up I/O more rapidly for subsequent queries. I would like to avoid this since it raises costs significantly.

Has anyone run into this issue with Zen-Cart? What are your views on these fixes? What fixes have you utilized?

UPDATE: I ended up using Query Cache by Data Diggers开发者_StackOverflow社区 and that helped greatly. I also found out that zencart's usage of getimagesize() accounts for much of its load time, so I am creating a way to get those values from cache. The majority of the mysql query lag was caused by excessive read operations, not write operations. Things have improved drastically since I implemented the changes. I will mark AJ's answer as correct since he did answer what I was originally asking.


Making a broad change like INSERT DELAY instead of INSERT may be the right solution, but not all of your queries are causing the problem. Only a few (or maybe even only one) are responsible for the performance problem.

You should be trying to figure out which specific query/queries are causing the performance issue. Work with your host to enable slow query logging and let MySQL tell you where the inefficiencies are. If none are slow to run, and it's just a sheer concurrency issue, IFF you are married to Zen Cart then you need to look at beefing up your infrastructure. I like your thinking on having separate Web and database servers. Don't go overboard though - if they're both running on one server right now, just get a second server and move your database.

Make incremental changes and monitor the results. Changing too many things at one time will make it difficult to identify the cause of any gains (hopefully not losses) in performance you see.

0

精彩评论

暂无评论...
验证码 换一张
取 消