Documente Academic
Documente Profesional
Documente Cultură
2
Exploring Percona Monitoring and
Management
Would like to
follow along in the • https://pmmdemo.percona.com
demo ?
3
In the Presentation
Practical approach to
deal with some of the
common MySQL Issues
4
PMM is not just for MySQL
5
Assumptions
Resource Based
Query Based Approach
Approach
• All the users • Queries use resources.
(developers) care is Slow Performance
how quickly their often caused by
queries perform resource constraints
7
Primary Resources
CPU
Disk IO
Memory
Network
8
Low Resource Usage + Poor Performance
9
Load Average
10
Problems with Load Average
12
Saturation Metrics
• Good to understand where waits are happening
• IO Load is not normalized
13
Looking at CPU Saturation Separately
14
Row Locks – Logical Contention
15
Zooming in on Row Locks Wait Load
• How many MySQL Connections are Blocked because or Row Level Lock
Waits
16
“Load at MySQL Side”
17
MySQL Questions – Inflow of Queries
18
Innodb Rows – Actual Work Being Done
19
Commands – What kind of operations
20
MySQL “Handlers” low lever row access
21
Memory usage by MySQL
22
Innodb in Depth
Innodb Checkpointing
• The log file size is good enough as Uncheckpointed bytes are fraction of
log file size
24
Innodb Checkpointing
• Very Close – Innodb Log File Size too small for optimal performance
25
Innodb Transaction History - not yet
Purged Transactions
• Short term spikes are normal if some longer transactions are ran on the
system
26
Innodb Transaction History
• Growth over long period of time without long queries in the processlist
• Often identifies orphaned transactions (left open)
27
Transaction History Recovery
28
Is your Innodb Log Buffer Large Enough?
• You will be surprised to see how little log buffer space Innodb needs
29
Another way to look at Logging Performance
30
Innodb IO
31
Hot Tables
32
Hot Tables through Performance Schema
33
Most Active Indexes
34
What about Queries causing the most
load?
• Can examine through Query Analytics application
35
Latency Details Explored
36
What are Top Queries ?
Query ran 10 times over second each time taking 0.2 sec
will be load 2
38
Whole Server Summary #2
39
Specific Query – Update Query
• Significant part of response time comes from row level lock waits
40
Expensive SELECT Query
41
Check Query Example
42
Explain and JSON Explain
43
Explore Any Captured Metrics
44
Lets Look at Couple of Case
Studies
Impact Of Durability ?
46
IO Bandwith
47
IO Saturation Jumps a Lot
48
Read and Write Latencies are Impacted
• This SSD (Samsung 960 Pro) Does not like fsync() calls
49
More Disk IO Operations
50
Increase In Disk IO Load
51
Disk IO Utilization jumps to 100%
52
Average IO Size is down
• Large block writes to binlog and innodb transaction logs do not happen
any more
53
Number of Running Threads Impacted
54
MySQL Questions
55
Because of Deadlocks
56
Higher Row Lock Time
57
And Load Caused by Row Locks
58
Log Buffer Used even less with durability
on
59
Is Group Commit Working ?
60
Top Queries Impacted
61
Changing Buffer Pool Size
MySQL 5.7 Allows to change BP Online
63
QPS Impact
64
Saturation spike and when stabilizing on
higher level
• Guess why the spike with lower QPS Level ?
65
Two IO Spikes
66
What is about Disk IO Latency ?
• Higher Number of IOPS does not always mean much higher latency
67
Longer Transactions = More Deadlocks
68
More IO Load Less Contention ?
69
Now we see query 80% IO Bound
70
Summary
71
72
Percona to Support PostgreSQL
73
Thank You!