mysqlreport shows the solution to the problem of high change_db occupancy in Com_

  • 2020-05-07 20:34:38
  • OfStack

First of all, the number of page views per day is not very large, so the number of page views per day is only 2W. But why does our server always restart so frequently? mysqlreport shows the running status of mysql as follows:

MySQL 5.1.28-rc-log uptime 0 0:4:48Thu Apr 30 14:04:58 2009

__ Key _________________________________________________________________
Buffer used 7.74M of 384.00M %Used:2.02
Current 52.89M%Usage: 13.77
Write hit0.00%
Read hit91.97%

__ Questions ___________________________________________________________
Total 14.46k50.2/s
DMS9.24k32.1/s %Total: 63.90
QC Hits3.66k12.7/s25.33
Com_ 1.04k 3.6/s7.19
COM_QUIT517 1.8/s3.58
-Unknown 1 0.0/s0.01
Slow 1 s4 0.0/s0.03 %DMS:0.04 Log: OFF
DMS 9.24k32.1/s63.90
SELECT9.21k32.0/s63.75 99.75
UPDATE23 0.1/s0.16 0.25
REPLACE00/s0.00 0.00
DELETE00/s0.00 0.00
INSERT00/s0.00 0.00
Com_1.04k 50/s44.4
set_option 523 1.8/s3.62
change_db510 50/s44.4
show_proces5 0.0/s0.03

__ SELECT and Sort _____________________________________________________
Scan49 0.2/s %SELECT:0.53
Range 16 0.1/s0.17
Full join2 0.0/s0.02
Range check 00/s0.00
Full rng join00/s0.00
Sort scan 55 0.2/s
Sort range475 1.6/s
Sort mrg pass00/s

__ Query Cache _________________________________________________________
Memory usage12.02M of 150.00M %Used:8.01
Block Fragmnt0.01%
Hits3.66k12.7/s
Inserts 9.14k31.8/s
Insrt:Prune9.14k:131.8/s
Hit:Insert 0.40:1

__ Table Locks _________________________________________________________
Waited 00/s %Total:0.00
Immediate 10.49k36.4/s

__ Tables ______________________________________________________________
Open58 of 512%Cache: 11.33
Opened 64 0.2/s

__ Connections _________________________________________________________
Max used4 of 2000 %Max:0.20
Total 519 1.8/s

__ Created Temp ________________________________________________________
Disk table 1 0.0/s
Table 184 0.6/sSize: 256.0M
File5 0.0/s

__ Threads _____________________________________________________________
Running 2 of2
Cached 2 of 150 %Hit: 99.23
Created 4 0.0/s
Slow00/s

__ Aborted _____________________________________________________________
Clients 00/s
Connects00/s

__ Bytes _______________________________________________________________
Sent20.36M70.7k/s
Received1.37M4.7k/s

__ InnoDB Buffer Pool __________________________________________________
Usage 304.00k of8.00M %Used:3.71
Read hit84.42%
Pages
Free493%Total: 96.29
Data 19 3.71 %Drty:0.00
Misc 0 0.00
Latched 0.00
Reads 77 0.3/s
From file12 0.0/s15.58
Ahead Rnd 1 0.0/s
Ahead Sql 00/s
Writes 00/s
Flushes 00/s
Wait Free00/s

__ InnoDB Lock _________________________________________________________
Waits00/s
Current 0
Time acquiring
Total 0 ms
Average0 ms
Max0 ms

__ InnoDB Data, Pages, Rows ____________________________________________
Data
Reads25 0.1/s
Writes3 0.0/s
fsync 3 0.0/s
Pending
Reads0
Writes 0
fsync0

Pages
Created00/s
Read 19 0.1/s
Written00/s

Rows
Deleted00/s
Inserted 00/s
Read 00/s
Updated00/s
As you can see, the proportion in Com_ is quite large, and in the case of 1, the value should be about 3.0%. If this value is too high, then your mysql is processing the request
Did 1 some useless work, occupied a lot of system resources. Among them, we can see that change_db has a high occupancy rate. This value is high, indicating that we are executing user database; Quite a few orders.
Check the program, we used mysql_query_db("database","sql") when executing the query. This statement automatically calls use database every time it is executed;
So we should change mysql_db_query to mysql_query(); Let's see what mysql is doing. ok. 1 tangent is normal. < / pre > < / pre > < / pre > < / pre > < / pre > < / pre > < / pre > < / pre > < / pre > < / pre > < / pre > < / pre > < / pre > < / pre >


Related articles: