首页 > web前端 > js教程 > 正文

qps统计方法小结

php中世界最好的语言
发布: 2018-04-19 11:33:55
原创
2899 人浏览过

这次给大家带来qps统计方法小结,qps统计方法的注意事项有哪些,下面就是实战案例,一起来看一下。

统计最近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
登录后复制

相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

推荐阅读:

JS实现数据验证与复选框表单提交

JS轻松实现轮播图

js正则快速记忆方法

以上是qps统计方法小结的详细内容。更多信息请关注PHP中文网其他相关文章!

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板