Peter Zaitsev - Practical MySQL Performance Optimization
-
Upload
carolinerose -
Category
Technology
-
view
744 -
download
2
Transcript of Peter Zaitsev - Practical MySQL Performance Optimization
Peter Zaitsev,CEO, Percona
Los Angeles MySQL MeetupFebruary, 20, 2014
Practical MySQL Performance Optimization
www.percona.com2
About Presentation
Define “Performance”
Provide Practical Approach to getting Performance you need
Talk about Tools you can use
www.percona.com3
Focus on Thought Process
Right Approach to the problems is a key
It is hard to Google “how to approach things”
Easy to find a lot of specific advice once you know what you want to do
MySQL Performance Blog has a lot of specific information
High Performance MySQL Book
www.percona.com4
Speaking about Performance
•Responsive
•Efficient
•Scalable
We mean
we want
system which is
www.percona.com5
Good Enough
•Responsiveness
•Efficiency
•Scalability
System needs to be Good
Enoughin
www.percona.com6
Focus on Application
• It does only as it impacts an Application
Database Performance
Does not Matter
• … and problem are we deal with
Database is a Tool we
use
www.percona.com7
Things to Note
Not all Application Performance Problems come from MySQL
Not all Application Performance Problems which come from MySQL
• … are resolved on MySQL level
www.percona.com8
Putting it in Practice
Look at Complete System
• Start with Architecture
Do not focus on tuning database alone
www.percona.com9
What Databases Do ?
Databases Handle Queries
www.percona.com10
Queries ?
Selects
Inserts
Updates
Deletes
Others
www.percona.com11
What do we need from it ?
•Quickly
•Efficiently
•Reliably
To Handle
Our Queries
www.percona.com12
Are those Right Queries ?
One of Architecture Questions
Changing how Application Logic translates to Queries is a great optimization
www.percona.com13
Putting It in Practice
Look at Application Transactions
See what Queries they Use
Check out how those queries perform
www.percona.com14
Things to Consider
• But avoid focus on extreme outliers
Look beyond
averages
• Daily and Weekly cycle
• Growth of load and Data Size
Make sure to look at
trends over time
www.percona.com15
Tools to Consider
• pt-query-digest (Percona Toolkit)
• MySQL Enterprise Monitor
• Performance_Schema (MySQL 5.6+)
• Check out ps_helper
• Box Anemometer• https://github.com/box/Anemometer/wiki
• Percona Cloud Tools
• http://cloud.percona.com
www.percona.com16
pt-query-digest example
www.percona.com17
Top Queries
www.percona.com18
Query Details
www.percona.com19
More Query Details
www.percona.com20
Percona Cloud Tools
www.percona.com21
Server Profile
www.percona.com22
Query Details
www.percona.com23
Graphs!
www.percona.com24
Process Support
Discover New Queries in the Application
Mark them as “Needing Attention” or “Reviewed”
Tag queries with information about application or user facing function
Discuss it with the team and record changes using Comments
www.percona.com25
Query Performance always shows it
Workload Changes
Data Size
Changing Query Plans
Upgrading MySQL Version
Changing MySQL Settings
Hardware Changes
www.percona.com26
Efficiency
Right Queries
Executed Most Efficiently
www.percona.com27
Practical Metrics
How many rows are being scanned vs Sent ?
How much IO are we doing ?
Is there avoidable overhead ?
• Filesorts ?
• TMP Tables ? On Disk ?
www.percona.com28
Areas of Improvement
Architecture
Hardware http://bit.ly/1dRNtaa
Schema and Queries http://bit.ly/1l1KBLN
MySQL version (and Variant)
MySQL Configuration http://bit.ly/1ctWAN9
www.percona.com29
Advanced Registration Rate Ends March 2nd, 2014
Special Discount for Webinar Attendees:
Use Code PeterZ15 to receive 15% off of standard
rates (new registrations only)
http://bit.ly/MySQLUC2014
www.percona.com30
How Percona Can Help
Support
RemoteDBA
Consulting