MySQL Usage Limit

October 1st, 2009 by Soumplis Alexandros Leave a reply »

It usually happens on a server to have high load for no apparent reason. My experience have shown that most of the times this high load is due to badly written SQL queries which cause MySQL to use all available resources for lots of time. This also causes an an excessive number of connections as the queries never end so each new site user creates a new SQL connection.For this reason I have written the attached perl script. I have used code portions from several other scripts that i used to have on my servers. The script creates a PerlĀ  daemon which runs every one minute and checks MySQL process list. It then kills any SELECT queries that are in the execute state for more than 60 seconds. Finally it counts the total number of connections per user and if they exceed 5 it kills them all.

I would be very satisfied with your comments, suggestions and contributions.

Here is the script: mycheck

Popularity: 19% [?]

  • Facebook
  • Blogger Post
  • Windows Live Spaces
  • Yahoo Buzz
  • Twitter
  • Technorati Favorites
  • WordPress
  • Delicious
  • Google Bookmarks
  • Windows Live Favorites
  • Yahoo Bookmarks
  • Share/Bookmark
Advertisement

Leave a Reply