Pages: [1]
Author Topic: The database is very slow  (Read 839 times)
Newbie
*

Karma: 0
Posts: 3


on: Feb 20, 09, 02:53 AM

My host recently upgraded to MySQL5 and ever since that loading the actual ProArcadeScript games page has become terrible slow. The index and category pages work fine though. I run about 10 other sites using MySQL on the same server as well, and I never see any slowdown on those sites, even though they're completly MySQL driven.

It often takes about 10 seconds before the actual game page appears, and sometimes it doesn't at all, but ends up with a "timed out" error after half a minute or so.

I tried to clean up the code in page_game.html, but it seems like the template system performs all SQL queries even if I leave the template empty.

I'm not only losing money on this, but also making my visitors frustrated and aimed to leave. Sergey, could you please give me some good advice on what to do? There seems to be some hefty SQL-queries on this page, but I'm just not sure how to deal with it since I'm not familiar with the template system.
« Last Edit: Feb 20, 09, 02:56 AM by Lemon » Logged
Customers
Jr. Member
*

Karma: 3
Posts: 15


Reply #1 on: Feb 20, 09, 05:49 PM

you could try optimizing your mysql flavor 

check you my.cnf and also check your httpd.conf
usually a timeout error is caused by apache (webserver) failure not mysql.
maybe you are flooded / ddos ?
Logged
Newbie
*

Karma: 0
Posts: 3


Reply #2 on: Feb 24, 09, 02:59 AM

After experimenting I found out that the problem was in "content/blocks/block_related.php".
By commenting out all the the code in this script the game page is now lightning fast.
« Last Edit: Feb 24, 09, 03:13 AM by Lemon » Logged
Administrator
Sr. Member
*

Karma: 7
Posts: 486


Email
Reply #3 on: Feb 25, 09, 12:15 AM

I have to agree with you guys, that block can couse mysql overload on popular websites, but fortunately there is a simple workaround:
you can change the $cRelatedDays variable (which is equal to 7 by default) to 1. Smaller number means less records in the "related" table, i.e. faster mysql responce.

If that will not increase your site's speed drastically, you can make the time interval even shorter by experimenting with this line:
Code:
// Remove obsolete records
$delta = ...
And again, the smaler delta is, the faster your query is.
Logged
Pages: [1]
 
Jump to: