database - Check MySQL CPU Usage (internally) -
from outside mysql, know can many things know cpu usage of process is, ie. top
.
but, internal standpoint, know if possible run query mysql know system cpu or cpu consumption of current thread is.
i'm running massive queries nightly through event scheduler , db server gets stuck @ 100% cpu few minutes blocking or slowing down users around globe.
i've tried research way limit cpu usage thread or user, doesn't seem possible yet.
so, i'm trying along lines of following in event:
if (select cpu_usage() > 0.8) repeat sleep(0.01); until (select cpu_usage() < 0.25) end repeat; end if;
obviously cpu_usage()
doesn't exist, if there similar can accomplish similar effect, i'm ears. thanks.
p.s. i'm on amazon rds
i afraid there no such option select option natively in mysql.
if inside mysql client command line, can call "top" command inside mysql client using command : \! top
, don't think need.
the best answer use udf sys functions. more info here. have no experience using seems closest need.
Comments
Post a Comment