网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

如何计算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://bjjierui.cn/article/ihgocs.html

其他资讯