如何计算MySQLQPS和TPS的值

QPS:每秒的查询数
TPS:每秒的事物量

QPS的计算方法
Questions = SHOW GLOBAL STATUS LIKE 'Questions';
Uptime = SHOW GLOBAL STATUS LIKE 'Uptime';
QPS=Questions/Uptime
例如:
MySQL> show global status like 'questions';
+---------------+-----------+
| Variable_name | Value     |
+---------------+-----------+
| Questions     | 449106827 |
+---------------+-----------+
1 row in set (0.00 sec)

mysql> show global status like 'uptime';
+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| Uptime        | 238722 |
+---------------+--------+
1 row in set (0.00 sec)

mysql> select 449106827/238722 as 'QPS VALUE' from dual;
+-----------+
| QPS VALUE |
+-----------+
| 1881.2963 |
+-----------+
1 row in set (0.00 sec)

___________________________________________________________

TPS的计算方法
Com_commit = SHOW GLOBAL STATUS LIKE 'Com_commit';
Com_rollback = SHOW GLOBAL STATUS LIKE 'Com_rollback';
Uptime = SHOW GLOBAL STATUS LIKE 'Uptime';
TPS=(Com_commit + Com_rollback)/Uptime
例如:
mysql> SHOW GLOBAL STATUS LIKE 'Com_commit';
+---------------+----------+
| Variable_name | Value    |
+---------------+----------+
| Com_commit    | 71050554 |
+---------------+----------+
1 row in set (0.00 sec)

mysql> SHOW GLOBAL STATUS LIKE 'Com_rollback';
+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| Com_rollback  | 537161 |
+---------------+--------+
1 row in set (0.00 sec)

mysql> SHOW GLOBAL STATUS LIKE 'Uptime';
+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| Uptime        | 238827 |
+---------------+--------+
1 row in set (0.00 sec)


mysql> select (71050554+537161)/238827 as 'TPS VALUE' from dual;
+-----------+
| TPS VALUE |
+-----------+
|  299.7472 |
+-----------+
1 row in set (0.00 sec)

本文名称:如何计算MySQLQPS和TPS的值
文章转载:http://bzwzjz.com/article/ihgocs.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 营销型网站建设 网站设计 重庆企业网站建设 成都做网站建设公司 企业网站设计 古蔺网站建设 网站建设方案 网站建设公司 企业网站设计 企业网站制作 成都网站设计 成都网站制作 泸州网站建设 成都网站设计 定制网站设计 广安网站设计 高端网站设计推广 成都网站建设推广 成都网站建设 成都企业网站设计 手机网站制作 网站设计公司