Page 1 of 1

Performance issues - mysql_connect

Posted: Mon Apr 14, 2008 9:26 am
by spacebiscuit
Hi,

My host has contacted me to say that my site is causing performance issues on the server

"There were win32 pipes left open in the application pool of the server this
site was hosted on and on checking a sufficient random selection, they were
all owned by this domain."

my site has its content supplied from a MYSQL database and lots of connections are made each time a page is requested. I use the following function to connect:

mysql_connect

..however I have just realised that I am not closing the connection, could this possible be the "win32 pipes" that the host is referring to?

Any feedback would be appreciated.

Thanks,

Rob.

Re: Performance issues - mysql_connect

Posted: Mon Apr 14, 2008 10:12 am
by andym01480
You only need to connect to the database once for a page.

I would connect once at the top of index.php and then that connection is open for all the times I query the database from includes in that instance of index.php. If every you time you query the database you connect - I guess that is the problem!

Re: Performance issues - mysql_connect

Posted: Mon Apr 14, 2008 11:19 am
by spacebiscuit
Yes I am only connecting once on each page, but I think each time theuser clicks on a different page another link is opened.

Would it be better to use a global variable to make the link and that way connections would not have to be opened.

Or should I just close the connection once MYSQL has been executed?

Thanks,

Rob.

Re: Performance issues - mysql_connect

Posted: Mon Apr 14, 2008 11:32 am
by onion2k
"win32 pipes left open in the application pool of the server" is a funny way of describing a database connection. Is that definitely what the hosting company means?

Re: Performance issues - mysql_connect

Posted: Mon Apr 14, 2008 11:44 am
by spacebiscuit
I'm not 100% sure but it is what I am guessing/

Rob.

Re: Performance issues - mysql_connect

Posted: Mon Apr 14, 2008 12:07 pm
by andym01480
Google the issue and you'll find naff hosting companies winging about this all over the web - the solution seem to be to change hosting companies to one that uses Linux!!!! 8O I'm not starting a Windows/Linux fight on a PHP forum BTW 8O

Probably not a database problem. http://www.simplemachines.org/community ... c=197185.0 is one example that everyone quotes on this issue!