程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> 關於MYSQL數據庫 >> 超簡單的qps統計方法(推薦)

超簡單的qps統計方法(推薦)

編輯:關於MYSQL數據庫

統計最近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: [email protected]
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統計方法(推薦)就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved