NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP and MySQL Connections

David Krings ramons at gmx.net
Sun Apr 20 12:49:46 EDT 2008


Randal Rust wrote:
> On Mon, Apr 14, 2008 at 11:13 AM, Daniel Convissor
> <danielc at analysisandsolutions.com> wrote:
> 
>>  close() is called during PHP's cleanup process that happens at the
>>  end of script execution.
> 
> OK, so if I don't have to *explicitly* tell the process to close, then
> why do I keep getting a lot of threads that are Sleeping? And for a
> long period of time? This is what is causing the slowdown on the
> server. If I manually go into the DB and kill threads that have been
> sleeping for a long time, then the system speeds back up.


I am by no means an expert, by I always close the connections explicitly. My 
understanding is that the connection gets closed eventually, but by MySQL 
itself after a time out period. I'd just send the close commands and see that 
the connections are closed in a controlled fashion that I can influence. I am 
sure the one command more will be way less overhead than MySQL holding on to 
idle connections that never will be used again.

David



More information about the talk mailing list