User Tools

Site Tools


bash:one_liners:mysql_queries_per_second

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

bash:one_liners:mysql_queries_per_second [2017/11/23 10:27] (current)
biggi created
Line 1: Line 1:
 +Oneliner:
 +<​code>​
 +LASTVAL=0; CURRVAL=0; while true; do CURRVAL=`mysqladmin status | awk {'​print $6'}`; echo "QPS: $((CURRVAL-LASTVAL))";​ LASTVAL=$CURRVAL;​ sleep 1; done
 +</​code>​
  
 +Output example:
 +<​code>​
 +[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
 +</​code>​
 +
 +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