17站长网

17站长网 首页 数据库 Mysql 查看内容

怎样计算MySQL QPS和TPS的值

2023-3-16 15:30| 查看: 1512 |来源: 互联网

QPS:每秒的查询数TPS:每秒的事物量QPS的计算方法Questions = SHOW GLOBAL STATUS LIKE 'Questions';Uptime = SHOW GLOBAL STATUS LIKE 'Uptim ...

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)

本文最后更新于 2023-3-16 15:30,某些文章具有时效性,若有错误或已失效,请在网站留言或联系站长:17tui@17tui.com
·END·
站长网微信号:w17tui,关注站长、创业、关注互联网人 - 互联网创业者营销服务中心

免责声明:本站部分文章和图片均来自用户投稿和网络收集,旨在传播知识,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系我们及时修正或删除。谢谢!

17站长网微信二维码

始终以前瞻性的眼光聚焦站长、创业、互联网等领域,为您提供最新最全的互联网资讯,帮助站长转型升级,为互联网创业者提供更加优质的创业信息和品牌营销服务,与站长一起进步!让互联网创业者不再孤独!

扫一扫,关注站长网微信

大家都在看

    热门排行

      最近更新

        返回顶部