超简单的qps统计方法(推荐)【转】
2017-05-08 16:46
176 查看
统计最近N秒内的QPS值(包括每秒select,insert等值)
mysql> select variable_name,sum(per_sec) as qps from (select straight_join lower(gs0.variable_name) as variable_name, (gs1.variable_value - gs0.variable_value)/5 as per_sec from ( select variable_name ,variable_value from information_schema.global_status where variable_name in ('com_select','com_update','com_insert','com_replace','com_delete') union all select '',sleep(5) from dual ) as gs0 join information_schema.global_status gs1 using (variable_name)) t group by variable_name with rollup;
+---------------+---------+
| variable_name | qps |
+---------------+---------+
| com_delete | 0 |
| com_insert | 2.2 |
| com_replace | 0 |
| com_select | 11524.8 |
| com_update | 3 |
| NULL | 11530 |
+---------------+---------+
6 rows in set (5.00 sec)
统计db启动以来的qps值,慢查询数量等信息
mysql> \s
--------------
mysql Ver 14.14 Distrib 5.5.35, for Linux (x86_64) using readline 5.1
Connection id: 98313987
Current database: udb
Current user: ucloud@172.23.0.48
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.5.35-log MySQL Community Server (GPL) by Remi
Protocol version: 10
Connection: 172.23.9.201 via TCP/IP
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3206
Uptime: 274 days 1 hour 22 min 29 sec
Threads: 172 Questions: 7559640986 Slow queries: 150149138 Opens: 7799 Flush tables: 15 Open tables: 973 Queries per second avg: 319.261
转自
超简单的qps统计方法(推荐)_Mysql_脚本之家 http://www.jb51.net/article/109784.htm
mysql> select variable_name,sum(per_sec) as qps from (select straight_join lower(gs0.variable_name) as variable_name, (gs1.variable_value - gs0.variable_value)/5 as per_sec from ( select variable_name ,variable_value from information_schema.global_status where variable_name in ('com_select','com_update','com_insert','com_replace','com_delete') union all select '',sleep(5) from dual ) as gs0 join information_schema.global_status gs1 using (variable_name)) t group by variable_name with rollup;
+---------------+---------+
| variable_name | qps |
+---------------+---------+
| com_delete | 0 |
| com_insert | 2.2 |
| com_replace | 0 |
| com_select | 11524.8 |
| com_update | 3 |
| NULL | 11530 |
+---------------+---------+
6 rows in set (5.00 sec)
统计db启动以来的qps值,慢查询数量等信息
mysql> \s
--------------
mysql Ver 14.14 Distrib 5.5.35, for Linux (x86_64) using readline 5.1
Connection id: 98313987
Current database: udb
Current user: ucloud@172.23.0.48
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.5.35-log MySQL Community Server (GPL) by Remi
Protocol version: 10
Connection: 172.23.9.201 via TCP/IP
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3206
Uptime: 274 days 1 hour 22 min 29 sec
Threads: 172 Questions: 7559640986 Slow queries: 150149138 Opens: 7799 Flush tables: 15 Open tables: 973 Queries per second avg: 319.261
转自
超简单的qps统计方法(推荐)_Mysql_脚本之家 http://www.jb51.net/article/109784.htm
相关文章推荐
- 超简单的qps统计方法(推荐)
- 最简单的qps统计方法
- SAMBA最简单的配置方法 推荐
- 终极体验:WINDOWS SERVER 2003密码最简单破解方法 推荐
- Eclipse统计代码行数的最简单方法
- 通过img标签调用实现静态页面访问次数统计的简单方法
- 程序员推荐简单有效的科学健脑方法
- 简单的项目规模统计方法
- PHP简单实现“相关文章推荐”功能的方法
- 程序员推荐简单有效的科学健脑方法
- 程序员推荐简单有效的科学健脑方法
- 推荐一种简单易学的读书方法
- 简单有效统计web 页pv、uv的方法
- jsp网站访问次数统计的几种方法(比较简单的几种)
- 简单的java web 统计在线人数实现方法
- 程序员推荐简单有效的科学健脑方法
- Trojan.PSW.Win32.QQPass.tou简单解决方法 推荐
- 比较简单的CentOS服务器安装方法小结 推荐
- 写给新手:javascript写的简单的计算器,内容很多,方法实用,推荐!
- Visual Studio 2010 统计解决方案或项目代码总行数的最简单方法