Too Many MySQL Sleep Processes
I’ve been using the CodeIgniter PHP framework to develop a web site that connects to a MySQL database using InnoDB tables and transactions. I ran into some trouble when I filled the MySQL process list with entries with “Sleep” in the command column. This happened even if I was rendering a page that only required reading from the database (and not using transactions). Solutions on the Internet suggesting that I should reduce the MySQL wait_timeout value to 3 seconds (from a setting of 28,800 seconds) or increasing the number of allowed connections didn’t ring true. A post on the MySQL Performance Blog pointed me in the right direction. Apparently, persistent connections do not currently play nice with transactions and InnoDB. The fix was to set the $db['default']['pconnect'] value to FALSE in the CodeIgniter database configuration file (application/config/database.php).

February 17th, 2010 at 1:31 pm
Thanks !
July 16th, 2011 at 12:55 am
I am very glad that I found your blog. Excellent information!
October 15th, 2011 at 6:31 am
Thanks… Good solution for using framework and mysql.
December 16th, 2011 at 4:26 pm
Thank you, this worked perfectly.