mysql数据库的QPS和TPS

QPS -(Queries Per Second) 及数据库的每秒查询处理量,同时适用InnoDB

TPS -(Transactions Per Second) 及数据库的每秒传输的事物处理个数,主要是对事务性存储引擎(InnoDB)的一个性能指标。

 

TPS -(Transactions Per Second) 及数据库的每秒传输的事物处理个数,主要是对事务性存储引擎(InnoDB)的一个性能指标。

计算方法:

TPS = (COM_COMMIT + COM_ROLLBACK)/UPTIME

SQL语句:

USE information_schema;
SELECT VARIABLE_VALUE INTO @com_commit FROM GLOBAL_STATUS WHERE VARIABLE_NAME =’COM_COMMIT’;
SELECT VARIABLE_VALUE INTO @com_rollback FROM GLOBAL_STATUS WHERE VARIABLE_NAME =’COM_ROLLBACK’;
SELECT VARIABLE_VALUE INTO @uptime FROM GLOBAL_STATUS WHERE VARIABLE_NAME =’UPTIME’;
SELECT (@com_commit+@com_rollback)/@uptime;

QPS -(Queries Per Second) 及数据库的每秒查询处理量,同时适用InnoDB和MyISAM 等存储引擎。

计算方法:

QPS=QUESTIONS/UPTIME

sql语句:

USE information_schema;
SELECT VARIABLE_VALUE INTO @questions FROM GLOBAL_STATUS WHERE VARIABLE_NAME =’QUESTIONS’;
SELECT VARIABLE_VALUE INTO @uptime FROM GLOBAL_STATUS WHERE VARIABLE_NAME =’UPTIME’;
SELECT @questions/@uptime;

发表评论