资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

如何计算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://cdkjz.cn/article/ihgocs.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220