1. 當前啟用的連線數
select
* from
global_status
where
variable_name = 'threads_running';
2.當前開啟的連線數
select
* from
global_status
where
variable_name = 'threads_connected';
3.最大連線數
4.當前連線詳細資訊
select
* from
processlist
5.總的查詢數量
select
* from
global_status
where
variable_name = 'questions';
6.mysql服務已執行時間
select
* from
global_status
where
variable_name = 'uptime';
7.執行緒快取命中率
select
1- ( select variable_value from global_status where variable_name = 'threads_created' ) / ( select variable_value from global_status where variable_name = 'connections' );
8.查詢快取命中率
select
( select variable_value from global_status where variable_name = 'qcache_hits' ) /
(( select variable_value from global_status where variable_name = 'com_select' ) +
( select variable_value from global_status where variable_name = 'qcache_hits' )) as query_cache_rate;
9.innodb表快取命中率
select
(1-( select variable_value from global_status where variable_name = 'innodb_buffer_pool_reads' ) /
( select variable_value from global_status where variable_name = 'innodb_buffer_pool_read_requests' )) as inno_buff_hit;
10.myisam key_buffer_hits
select
(1-( select variable_value from global_status where variable_name = 'key_reads') /
( select variable_value from global_status where variable_name = 'key_read_requests' )) as key_buffer_read_hits;
select
(1-( select variable_value from global_status where variable_name = 'key_writes') /
( select variable_value from global_status where variable_name = 'key_write_requests' )) as key_buffer_write_hits;
11.資料庫流量(增刪改查操作之和)
select
(( select variable_value from global_status where variable_name = 'com_insert')+
( select variable_value from global_status where variable_name = 'com_select')+
( select variable_value from global_status where variable_name = 'com_delete')+
( select variable_value from global_status where variable_name = 'com_update')) as oper_fre
12.qps
select (
(select
variable_value
from
global_status
where
variable_name = 'questions')
/ (select
variable_value
from
global_status
where
variable_name = 'uptime')
) as qps
13.tps
select (
( (
select
variable_value
from
global_status
where
variable_name = 'com_commit'
) +
( select
variable_value
from
global_status
where
variable_name = 'com_rollback'
) )/ (
select
variable_value
from
global_status
where
variable_name = 'uptime'
)) as tps
14.臨時表狀況,比值不要超過10%
select (
( select
variable_value
from
global_status
where
variable_name = 'created_tmp_disk_tables'
)/( select
variable_value
from
global_status
where
variable_name = 'created_tmp_tables'
)) as tmp_table_create
15.innodb快取不足等待
select
variable_value
from
global_status
where
variable_name = 'innodb_log_waits'
17.流量狀態(byte)
select (
( (
select
variable_value
from
global_status
where
variable_name = 'bytes_received'
) +
( select
variable_value
from
global_status
where
variable_name = 'bytes_sent'
) )/ (
select
variable_value
from
global_status
where
variable_name = 'uptime'
)) as flow
18.慢查詢次數
select
variable_value
from
global_status
where
variable_name = 'slow_queries'
效能監控 TP 指標
在對系統進行效能測試或效能監控時候,tp 指標是一種比較常見的效能引數,包括 tp50 tp99 tp999 等等。總 次數 指標數 對應指 標在總次 數中的序 號總次數 ast 指標數 對應指標在總次數中的序號 總次數 指標 數 對應 指標在總 次數中的 序號通俗點說,假設為了測試某介面效能,對其...
mysql 效能監控
show status flush status 檢視當前連線數 show status like thread thread cached 被快取的執行緒的個數 thread running 處於啟用狀態的執行緒的個數 thread connected 當前連線的執行緒的個數 thread cre...
mysql效能監控
使用mysql不僅僅需要能簡單的crud,還需要進行效能調優,不管是工作中還是去面試這都比較重要,要想學會mysql調優首先得學會監控mysql的效能,不多說廢話,直接開幹 mysql是自帶監控工具的,有的版本可能預設開啟,有的可能關閉的,所以首先檢查profiling是否開啟 如上profilin...