[wp-hackers] Closing Mysql connections

Michael Pretty mpretty at voceconnect.com
Fri Mar 19 15:03:06 UTC 2010


If you're having issues with max user connections, my suggestion would 
be to start looking at what is taking a page so long to render from 
start to finish, that it holds the connection open this long and start 
cleaning those up.  The quickest fixes are adding object cache/memcache 
and WP Super Cache or Batcache.  If those don't cut down the render time 
enough, try to find any of the slower segments of your site that are the 
same on multiple pages and users and caching the rendered portion of 
that content to avoid multiple queries or complex rendering.  If you're 
still having issues after that, it may be time to look into multiple 
servers.

Michael

On 3/19/10 9:49 AM, Andrew Gray wrote:
> I will start with the statement that this wordpress site is on a server where I do not get to control apache or mysql.  It is at Rackspace Sites, which is a LAMP stack where you only get FTP access.  I get a ton of traffic and I am running into max mysql connection errors.   My max user connections is set at 500.  I really want to stay on this platform because of the support I get there and the price.  My traffic profile is unique and I have all the caching I can use.
>
>   Im trying to figure out why there is no call to mysql_close anywhere in wordpress.
>
> Is it just assuming that the connection will be automatically closed when the script ends?
>
> Is there an action or hook I can tie into to close the DB connection manually to ensure that if apache processes hang on they do not stay around.  Can I use the hook shutdown?
>
> Does anyone know why there is no mysql_close() in the wordpress code.
>
> Any insight into this would be very helpful before I go and start breaking stuff.
>
> thanks,
>
> Andrew
>
>
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>    



More information about the wp-hackers mailing list