954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Kill Old Mysql DB Processes in Application.cfc

I have a problem with my site regularly exceeding Max User Connections. The limit from my hosting provider is 10 and I am regularly exceeding this amount for 1 database user.

I'm unsure if this is due to a Coding Error / stuck or errored cfthread / malicious attack / or some other issue.

I was thinking of coding in a fix to Automatically kill processes when the site starts to error out (exceed Max_User_Connections) to limit the amount of downtime.

Does Coldfusion allow you to run the SHOWPROCESSLIST and/or KILL methods (mySQL) in a CFQUERY. If so, would anyone recommend putting in a KILL function within application.cfc? If so, which method should I put it in? OnError or Other? Anyone have any other ideas?

ozbulldog
Newbie Poster
1 post since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

This is a system administration issue and not necessarily something you'd attempt to solve via code. ColdFusion (Adobe, Railo, and OpenBD) have the ability to pool connections (they all use the same MySQL DB Driver). If you're constantly reaching your max connection value, then maybe consider using pooled connections instead of using a new connection for each query you're running.

If your host will not allow you to use pooled connections, or is unwilling to work with you, then maybe it's time to invest in a VPS. With a VPS, your database is usually hosted on your VPS, and you're able to configure connections and pooling however you need to for your app.

Here's an article from Adobe that talks about Connection Pooling and database interaction with Adobe ColdFusion:
http://helpx.adobe.com/coldfusion/kb/database-connections-handled-coldfusion.html

HTH

utdream
Light Poster
29 posts since Mar 2010
Reputation Points: 10
Solved Threads: 2
 

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: