User Tools

Site Tools


bash:one_liners:mysql_queries_per_second

Oneliner:

LASTVAL=0; CURRVAL=0; while true; do CURRVAL=`mysqladmin status | awk {'print $6'}`; echo "QPS: $((CURRVAL-LASTVAL))"; LASTVAL=$CURRVAL; sleep 1; done

Output example:

[root@thismachine ~]# LASTVAL=0; CURRVAL=0; while true; do CURRVAL=`mysqladmin status | awk {'print $6'}`; echo "QPS: $((CURRVAL-LASTVAL))"; LASTVAL=$CURRVAL; sleep 1; done
QPS: 11429108706
QPS: 8047
QPS: 7783
QPS: 7909
QPS: 9965
QPS: 9835
^C

First output will be a very high number, as LASTVAL is 0. That can be fixed with an “if” statement, but I didn't want to include an if statement that is only used once. Keep it green, save those CPU cycles! ;P

bash/one_liners/mysql_queries_per_second.txt · Last modified: 2017/11/23 10:27 by biggi

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki