Web Hosting Talk







View Full Version : MySQL users limiting problem


xakmak
03-31-2006, 06:02 PM
Hi everyone!
There is a problem, i cannot find answe few month-

I have a server runing on FedoraCore4, running apache+mysql+php on it, its a hosting server, and some of my users run from php to MySQL some very slow queries, i know wait_timeout and interactive_timeout doesnt work on slow queries because they kills only "sleep" queries but dont "executing" queries.

What the answer? i try some Perl cron script that kill process that using more 30 seconds to execute but it doesnt work properly everytime....
Somebody please help me... Thanks.

Dan Grossman
03-31-2006, 06:43 PM
http://mtop.sourceforge.net/

I've not used it myself, but it may be what you're looking for.

mkill (MySQL kill) monitors a MySQL server for long running queries and kills them after a specified time interval. Queries can be selected based on regexes on the user, host, command, database, state and query.

xakmak
03-31-2006, 07:05 PM
Thanks Dan! but mkill use the KILL mysql command, but when VERY slow query executing the MKILL cannot connect to mysql and execute kill pid query, i think maybe some kill mysql slow process in the system processes?

Burhan
04-01-2006, 07:39 AM
I would look at the query itself. Perhaps it can be optimized? Try running EXPLAIN on the query.

Also check your disk space, and try optimizing the tables.

Dan Grossman
04-01-2006, 01:28 PM
He said it's a hosting server and the slow queries are his customers' queries. Even if he forces his customer to optimize the query another one will write a slow query again eventually.

hiryuu
04-01-2006, 06:59 PM
You may want to start with setting max_join_size to something fairly small (say 20 MB) to catch bad queries before they fire.