MySQL中TPS和QPS的計算方式

yantaicuiwei發表於2012-08-23
TPS - Transactions Per Second(每秒傳輸的事物處理個數),即伺服器每秒處理的事務數,如果是InnoDB會顯示,沒有InnoDB就不會顯示。
TPS = (COM_COMMIT + COM_ROLLBACK)/UPTIME

use information_schema;
select VARIABLE_VALUE into @num_com from GLOBAL_STATUS where VARIABLE_NAME ='COM_COMMIT';
select VARIABLE_VALUE into @num_roll from GLOBAL_STATUS where VARIABLE_NAME ='COM_ROLLBACK';
select VARIABLE_VALUE into @uptime from GLOBAL_STATUS where VARIABLE_NAME ='UPTIME';
select (@num_com+@num_roll)/@uptime;


QPS - Queries Per Second(每秒查詢處理量)MyISAM 引擎
QUESTIONS/UPTIME

use information_schema;
select VARIABLE_VALUE into @num_queries from GLOBAL_STATUS where VARIABLE_NAME ='QUESTIONS';
select VARIABLE_VALUE into @uptime from GLOBAL_STATUS where VARIABLE_NAME ='UPTIME';
select @num_queries/@uptime;
 
來源於網路

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/21601207/viewspace-741749/,如需轉載,請註明出處,否則將追究法律責任。

相關文章