Friday, January 04, 2008

schedule page and mysql too many connections

Found this morning that mysql daemon had died on our hosting provider for radiosai.org , nettigritty. Contacted them, they said too many connections from radiosai user. They said

> 1. Do not use persisternt connections (pconnect)
> 2. Ensure you are correctly closing connections after use.

We're not using pconnect. For non-persistent connects, they are supposed to
automatically disconnect after the script executes, but still we have added
<?php
mysql_close($dbcon);
?>
to the end of our scripts, just to be safe.

But two possible reasons could be

1. Too much traffic on our site

2. The times when our page fails to load properly giving the error
Maximum execution time of 30 seconds exceeded
( log file is at http://www.radiosai.org/program/inerror.log )
every time it fails, maybe the connection remains open.

Reason (1) - http://www.radiosai.org/plesk%2Dstat/webstat/ shows us that the
index.php gets 1000+ hits per day. That should be OK for mysql to handle, I suppose.

About Reason (2) - Another possibility I thought of was: the index.php also
has links to images and flash files, which also have to load before the 30
second timeout. If this can be delinked from the php part of the code - maybe
using div elements or something? - perhaps the timeout issue can be mitigated
to a large extent? For the time being, I've removed the links to the images and flash files and we'll see if this improves matters.

No comments:

Post a Comment