SlideShare a Scribd company logo
THE 5 MINUTE DBA
DBA Skills for Non-DBA’s
Matt Yonkovit ,VP (Consulting) – Percona
Percona University, Washington DC
September 12, 2013
DBA’s are hard to find!
Company Confidential December 2010
-2-
Non-DBA’s in charge of DB’s
Company Confidential December 2010
-3-
• System Administrators
• Web Administrators
• Developers
You get stretched
Company Confidential December 2010
-4-
WHAT CAN YOU DO IN 5
MINUTES?
The top tips to ensure your database is running smoothly
Company Confidential December 2010
-5-
BIG DISCLAIMER!
Company Confidential December 2010
-6-
• Its important to distinguish this up front:
– I am giving you the easy answers, which are not always
the correct answers..
– If you only have 5 minutes to spend on one of these
database topics, you lose a lot of flexibility
– I could spend lots of time talking about everything here,
instead I am focusing on maximizing your benefit.
• This presentation assumes you are running on
Linux/Unix
The 5 Minute DBA-DBA Skills for Non-DBA
The Common Problems Kill You
Company Confidential December 2010
-8-
THOU SHALL HAVE BACKUPS!
Company Confidential December 2010
-9-
They can save your bacon!
• Probably the most common problem to get called
on is some sort of slowness
• Keys to success
– Identify what is slow
– When its slow
– Can you repeat it
• Dig in
The Slow Down Of Doom!
Company Confidential December 2010
-10-
No sense in targeting area’s that do not matter
Target your pain first
Company Confidential December 2010
-11-
• Google is your friend to research problems
• But don’t tune via Google
• Trust but verify
Know where to look
Company Confidential December 2010
-12-
• Know the tools out in the community
• Have them ready to jump in and fight fires at a
moments notice
• Tools like:
– Percona Toolkit
– Cacti
– Home grown scripts
– etc
Know thy tools
Company Confidential December 2010
-13-
• Define what is slow? If its a single page, the
process is drastically different then if its general
slowness.
• Assume General Slowness
– #1 What has changed? A new deployment? More users?
Etc? Sometimes a roll-back of a buggy code release is
the best fix.
• DO NOT ASSUME ITS THE DATABASE!
• Start with the obvious and the quick and move to
more complex
Tuning walk through
Company Confidential December 2010
-14-
• 5.1 -vs- 5.0 provides improvements
• 5.5 -vs- 5.1 provides improvements
• 5.6 –vs- 5.5 provides improvements
HUGE Differences in Versions!
Company Confidential December 2010
-15-
• Often stock OS repos are out of date!
• Watch out for old versions installed as
dependencies of off the shelf software
• Just because a hosting provider installed it does not
mean its the latest or best
Where did you get it?
Company Confidential December 2010
-16-
• Innodb
• Innodb Plugin
• XtraDB
• TokuDB
• MyISAM
• Aria
• Many Many more....
Storage Engines
Company Confidential December 2010
-17-
• Old Kernel?
• Multi-core servers, scalability getting better (~32 cores + )
• Fit your hot data into memory!
– Typically more memory is better
• IO is a Major bottleneck
– RAID For your databases is a must
– Battery Backed Controller
– RAID 10 typically better then RAID 5
– SSD's for optimal performance
• Network should not be forgotten
• 32bit binary or OS on 64 bit machine
Hardware & OS
Company Confidential December 2010
-18-
• Next I start by looking at the server (Sar, vmstat,
top, iostat -x)... I typically start low and work my
way into the database
– Too much io, maybe not enough memory, missing
indexes, or bad config
– Cpu maxed out could be lots of users, lots of concurrent
queries, or something else.
– Is the problem even MySQL? Often times we see issues
with non-database software
– top process is something else ( i.e. apache, php, cron
job, etc )
– Network is often overlooked
Review OS Metrics
Company Confidential December 2010
-19-
COMMON TOOLS
For monitoring the OS/MySQL in a pinch
Company Confidential December 2010
-20-
• Sar is your friend, every unix/linux server should
setup sar to collect stats in the background
– Sar Can give you historical reports on : CPU, Disk,
Memory, Network, and a lot more.
– Scheduled to collect data via cron
• Iostat is valuable in gauging disk performance
– avwait+svctim = response time (iostat -x)
Systat
Company Confidential December 2010
-21-
Sar Network Stats
Company Confidential December 2010
-22-
Sar CPU
Company Confidential December 2010
-23-
Sar Memory
Company Confidential December 2010
-24-
Iostat
Company Confidential December 2010
-25-
VMSTAT
Company Confidential December 2010
-26-
• Can give you a realtime view of changes on the
system to CPU/Memory
Top
Company Confidential December 2010
-27-
• Get a current Snapshot of running processes
Percona Toolkit
Company Confidential December 2010
-28-
• Collection of scripts used for monitoring system and
DB performance
• pt-stalk
• pt-diskstats
• pt-pmp
• Pt-Ioprofiler
• pt-mext
Cacti
Company Confidential December 2010
-29-
• Great Visual Presentation of Historical Stats
• MySQL, Apache, Sphinx, Memcached, (Entire
Stack)
• Percona Maintains the MySQL Templates
• Can add a lot of value...
Example:
Mysterious Slowdown
OMG The Server is Slow!
Company Confidential December 2010
-30-
Dig a little deeper
Company Confidential December 2010
-31-
Oh Wait it Always Happens
Company Confidential December 2010
-32-
Percona Monitoring Plugins- Cacti!
Company Confidential December 2010
-33-
Grab them here:
http://www.percona.com/software/percona-monitoring-plugins/
THE CONFIGURATION
Reasonability Check
Company Confidential December 2010
-34-
MYSQL CHECKS
Looking at the DB
Company Confidential December 2010
-35-
Configuration Options – Top 10
Company Confidential December 2010
-36-
General Configuration Options
• query_cache_size (Disable in many versions)
• log_slow_queries
• long_query_time
• max_connections
• expire_logs_days
MyISAM Specific
• key_buffer_size
Configuration Options
Company Confidential December 2010
-37-
Innodb Specific Options
• innodb_buffer_pool_size
• innodb_flush_log_at_trx_commit
• innodb_log_file_size
Plugin/Xtradb/Mysql 5.5 Innodb Options
• innodb_io_capacity
• innodb_read_ahead
• innodb_write_io_threads
• innodb_read_io_threads
Online Tools to help you set your my.cnf!
Company Confidential December 2010
-38-
• https://tools.percona.com/wizard
Memory and Swap
Company Confidential December 2010
-39-
• Disk IO is bad, Avoiding swapping things that should be
in memory to disk ( do not disable swap however )
• SSD’s/Fast Disks
• Hot Data in Memory!
• read_buffer, read_rnd_buffer, sort_buffer, join_buffer
are all allocated per thread so be careful!
• You want temp tables to be built in memory not on disk
Check Current Activity
• Mysql
– “show full processlist”
– “show global status”
– “Show innodb status”
• Mysqladmin
• Slow Query Log
• pt-query-digest
• Mysqldumpslow
• Innotop
• Mytop
• pt-mext
Company Confidential December 2010
-40-
Show Processlist
Company Confidential December 2010
-41-
mysql> show processlistG
*************************** 1. row ***************************
Id: 52
User: bench
Host: domU-12-31-39-0C-41-81.compute-1.internal:42315
db: simple_benchmark
Command: Sleep
Time: 0
State:
Info: NULL
*************************** 14. row ***************************
Id: 65
User: bench
Host: domU-12-31-39-0C-41-81.compute-1.internal:42328
db: simple_benchmark
Command: Query
Time: 0
State: init
Info: insert into simple_benchmark.simple_comments (lookup_id, comment, mydate) values ( '8519163', 'Comme
*************************** 15. row ***************************
Id: 66
User: bench
Host: domU-12-31-39-0C-41-81.compute-1.internal:42329
db: simple_benchmark
Command: Sleep
Time: 0
State:
Info: NULL
Mysqladmin
Company Confidential December 2010
-42-
• Mysqladmin extended -r -i1 will give you mysql stats at
1 second intervals, change the -i to increase
decrease...
• A few stats of note:
pt-mext
Company Confidential December 2010
-43-
• Mext can take the output from mysqladmin and put the
status variables side by side, this makes it very
convenient to look for differences
Slow Query Log
Company Confidential December 2010
-44-
• The Slow Query log is your friend! As mentioned earlier
queries that take over a certain amount of time are
logged here. (Percona Patches for complete picture )
• Summarize the slow query log with percona toolkit, pt-
query-digest or mysqldumpslow if the percona toolkit is
not available
• Look for not only the longest running query, but also the
one with lots of executions and cumulated time
Pt-query-digest output
Company Confidential December 2010
-45-
pt-query-digest
Company Confidential December 2010
-46-
Memcached/Redis/Other Caching
Company Confidential December 2010
-47-
• Review: More memory the better
• Caching frequently used data is an excellent way to
boost performance
• This typically requires changes to your app
• Performance improvement can be dramatic
Query Tuning
Company Confidential December 2010
-48-
• Review the slow query log, parse the log with pt-
query-digest.
– If I see something here, I will analyze it
• If your still at a loss, try using tcpdump to dump
SQL statements into pt-query-digest and look for
repeated queries. ( Easier then the general query
log if you need sub second slow queries).
Query Tuning
Company Confidential December 2010
-49-
• Use Explain Plan
• Add Indexes where needed, do not over index
– pt-duplicate-key-checker
• Lots of small queries can sometimes be more
impactful than 1 big one.
Remember
Company Confidential December 2010
-50-
• The Disclaimer!
• Questions?

More Related Content

PDF
RNUG - DeepDive Workshop - HCL Notes Client upgrades/deployments using Marvel...
PDF
RNUG - SUPERCHARGED HCL Notes V11 Upgrades: Turning the WORST Notes deploymen...
PDF
CollabSphere 2019 - Dirty Secrets of the Notes Client
PDF
RNUG - HCL Notes V11 Performance Boost
PDF
Engage 2018: IBM Notes and Domino Performance Boost - Reloaded
PDF
Von A bis Z-itrix: Installieren Sie den stabilsten und schnellsten HCL Notes-...
PDF
RNUG - Virtual, Faster, Better! How to deploy HCL Notes 11.0.1 FP2 for Citrix...
PDF
RNUG - HCL Notes 11.0.1 FP2 Upgrades: Easy — Fast — Seamless
RNUG - DeepDive Workshop - HCL Notes Client upgrades/deployments using Marvel...
RNUG - SUPERCHARGED HCL Notes V11 Upgrades: Turning the WORST Notes deploymen...
CollabSphere 2019 - Dirty Secrets of the Notes Client
RNUG - HCL Notes V11 Performance Boost
Engage 2018: IBM Notes and Domino Performance Boost - Reloaded
Von A bis Z-itrix: Installieren Sie den stabilsten und schnellsten HCL Notes-...
RNUG - Virtual, Faster, Better! How to deploy HCL Notes 11.0.1 FP2 for Citrix...
RNUG - HCL Notes 11.0.1 FP2 Upgrades: Easy — Fast — Seamless

What's hot (19)

PDF
RNUG - HCL Notes 11.0.1 FP2 — Performance Boost Re-Reloaded
PDF
From A to Z-itrix: Setting up the most stable and fastest HCL Notes client on...
PDF
Virtualization Assessment Example
PDF
CollapSphere 2019 - SUPERCHARGED HCL Notes V11 Upgrades
PDF
You don't want to do it like that
PPT
Technical track-afterimaging Progress Database
PDF
IBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
POTX
IBM Domino / IBM Notes Performance Tuning
PDF
BP103 - Got Problems? Let's Do a Health Check
PDF
WHITE PAPER▶ Blueprint for Optimized Duplication with Backup Exec 15
PDF
Adm02 Be a Domino Detective: Tackling Your Toughest Performance Problems
PDF
CollabSphere 2020 Live - Virtual, Faster, Better! How to deploy HCL Notes 11....
PDF
Adm07 The Health Check Extravaganza for IBM Social and Collaboration Environm...
PDF
Got Problems? Let's Do a Health Check
PDF
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...
PDF
Are the Native SQL Server Backup Utilities Holding You Back?
PDF
第42回「System x vs ThinkServer 徹底比較 - 1Uラック・サーバー編 -」(2015/03/26 on しすなま!)
PDF
Engage 2020 - HCL Notes V11 Performance Boost
PDF
Dutch Lotus User Group 2009 - Domino Tuning Presentation
RNUG - HCL Notes 11.0.1 FP2 — Performance Boost Re-Reloaded
From A to Z-itrix: Setting up the most stable and fastest HCL Notes client on...
Virtualization Assessment Example
CollapSphere 2019 - SUPERCHARGED HCL Notes V11 Upgrades
You don't want to do it like that
Technical track-afterimaging Progress Database
IBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
IBM Domino / IBM Notes Performance Tuning
BP103 - Got Problems? Let's Do a Health Check
WHITE PAPER▶ Blueprint for Optimized Duplication with Backup Exec 15
Adm02 Be a Domino Detective: Tackling Your Toughest Performance Problems
CollabSphere 2020 Live - Virtual, Faster, Better! How to deploy HCL Notes 11....
Adm07 The Health Check Extravaganza for IBM Social and Collaboration Environm...
Got Problems? Let's Do a Health Check
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...
Are the Native SQL Server Backup Utilities Holding You Back?
第42回「System x vs ThinkServer 徹底比較 - 1Uラック・サーバー編 -」(2015/03/26 on しすなま!)
Engage 2020 - HCL Notes V11 Performance Boost
Dutch Lotus User Group 2009 - Domino Tuning Presentation
Ad

Similar to The 5 Minute DBA-DBA Skills for Non-DBA (20)

PDF
The 5 Minute MySQL DBA
PPTX
Peter Zaitsev "18 ways to fix MySQL bottlenecks"
PDF
Webinar replay: MySQL Query Tuning Trilogy: Query tuning process and tools
PPT
High Performance Mysql
PDF
Performance optimisations PHP meetup Rotterdam
PDF
OSDC 2010 | MySQL and InnoDB Performance - what we know, what we don't by Ba...
PDF
MySQL 和 InnoDB 性能
PDF
01 demystifying mysq-lfororacledbaanddeveloperv1
PPT
MySQL Performance Tuning at COSCUP 2014
PPTX
Maximizing performance via tuning and optimization
PPTX
Maximizing performance via tuning and optimization
PDF
MySQL 5.6 Performance
PDF
MySQL Enterprise Monitor
PPTX
MySQL Tech Tour 2015 - Manage & Tune
PDF
Highload Perf Tuning
PDF
OSDC 2016 - Tuning Linux for your Database by Colin Charles
PDF
Running MySQL on Linux
PDF
Evolution of DBA in the Cloud Era
PPTX
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
PPS
MySQL Optimization from a Developer's point of view
The 5 Minute MySQL DBA
Peter Zaitsev "18 ways to fix MySQL bottlenecks"
Webinar replay: MySQL Query Tuning Trilogy: Query tuning process and tools
High Performance Mysql
Performance optimisations PHP meetup Rotterdam
OSDC 2010 | MySQL and InnoDB Performance - what we know, what we don't by Ba...
MySQL 和 InnoDB 性能
01 demystifying mysq-lfororacledbaanddeveloperv1
MySQL Performance Tuning at COSCUP 2014
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimization
MySQL 5.6 Performance
MySQL Enterprise Monitor
MySQL Tech Tour 2015 - Manage & Tune
Highload Perf Tuning
OSDC 2016 - Tuning Linux for your Database by Colin Charles
Running MySQL on Linux
Evolution of DBA in the Cloud Era
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
MySQL Optimization from a Developer's point of view
Ad

Recently uploaded (20)

PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PPTX
GSA Content Generator Crack (2025 Latest)
PDF
Cost to Outsource Software Development in 2025
PPTX
Custom Software Development Services.pptx.pptx
PDF
Complete Guide to Website Development in Malaysia for SMEs
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
assetexplorer- product-overview - presentation
PPTX
"Secure File Sharing Solutions on AWS".pptx
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
STL Containers in C++ : Sequence Container : Vector
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
GSA Content Generator Crack (2025 Latest)
Cost to Outsource Software Development in 2025
Custom Software Development Services.pptx.pptx
Complete Guide to Website Development in Malaysia for SMEs
DNT Brochure 2025 – ISV Solutions @ D365
Advanced SystemCare Ultimate Crack + Portable (2025)
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
Weekly report ppt - harsh dattuprasad patel.pptx
Monitoring Stack: Grafana, Loki & Promtail
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
wealthsignaloriginal-com-DS-text-... (1).pdf
assetexplorer- product-overview - presentation
"Secure File Sharing Solutions on AWS".pptx
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
Computer Software and OS of computer science of grade 11.pptx
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
STL Containers in C++ : Sequence Container : Vector

The 5 Minute DBA-DBA Skills for Non-DBA

  • 1. THE 5 MINUTE DBA DBA Skills for Non-DBA’s Matt Yonkovit ,VP (Consulting) – Percona Percona University, Washington DC September 12, 2013
  • 2. DBA’s are hard to find! Company Confidential December 2010 -2-
  • 3. Non-DBA’s in charge of DB’s Company Confidential December 2010 -3- • System Administrators • Web Administrators • Developers
  • 4. You get stretched Company Confidential December 2010 -4-
  • 5. WHAT CAN YOU DO IN 5 MINUTES? The top tips to ensure your database is running smoothly Company Confidential December 2010 -5-
  • 6. BIG DISCLAIMER! Company Confidential December 2010 -6- • Its important to distinguish this up front: – I am giving you the easy answers, which are not always the correct answers.. – If you only have 5 minutes to spend on one of these database topics, you lose a lot of flexibility – I could spend lots of time talking about everything here, instead I am focusing on maximizing your benefit. • This presentation assumes you are running on Linux/Unix
  • 8. The Common Problems Kill You Company Confidential December 2010 -8-
  • 9. THOU SHALL HAVE BACKUPS! Company Confidential December 2010 -9- They can save your bacon!
  • 10. • Probably the most common problem to get called on is some sort of slowness • Keys to success – Identify what is slow – When its slow – Can you repeat it • Dig in The Slow Down Of Doom! Company Confidential December 2010 -10-
  • 11. No sense in targeting area’s that do not matter Target your pain first Company Confidential December 2010 -11-
  • 12. • Google is your friend to research problems • But don’t tune via Google • Trust but verify Know where to look Company Confidential December 2010 -12-
  • 13. • Know the tools out in the community • Have them ready to jump in and fight fires at a moments notice • Tools like: – Percona Toolkit – Cacti – Home grown scripts – etc Know thy tools Company Confidential December 2010 -13-
  • 14. • Define what is slow? If its a single page, the process is drastically different then if its general slowness. • Assume General Slowness – #1 What has changed? A new deployment? More users? Etc? Sometimes a roll-back of a buggy code release is the best fix. • DO NOT ASSUME ITS THE DATABASE! • Start with the obvious and the quick and move to more complex Tuning walk through Company Confidential December 2010 -14-
  • 15. • 5.1 -vs- 5.0 provides improvements • 5.5 -vs- 5.1 provides improvements • 5.6 –vs- 5.5 provides improvements HUGE Differences in Versions! Company Confidential December 2010 -15-
  • 16. • Often stock OS repos are out of date! • Watch out for old versions installed as dependencies of off the shelf software • Just because a hosting provider installed it does not mean its the latest or best Where did you get it? Company Confidential December 2010 -16-
  • 17. • Innodb • Innodb Plugin • XtraDB • TokuDB • MyISAM • Aria • Many Many more.... Storage Engines Company Confidential December 2010 -17-
  • 18. • Old Kernel? • Multi-core servers, scalability getting better (~32 cores + ) • Fit your hot data into memory! – Typically more memory is better • IO is a Major bottleneck – RAID For your databases is a must – Battery Backed Controller – RAID 10 typically better then RAID 5 – SSD's for optimal performance • Network should not be forgotten • 32bit binary or OS on 64 bit machine Hardware & OS Company Confidential December 2010 -18-
  • 19. • Next I start by looking at the server (Sar, vmstat, top, iostat -x)... I typically start low and work my way into the database – Too much io, maybe not enough memory, missing indexes, or bad config – Cpu maxed out could be lots of users, lots of concurrent queries, or something else. – Is the problem even MySQL? Often times we see issues with non-database software – top process is something else ( i.e. apache, php, cron job, etc ) – Network is often overlooked Review OS Metrics Company Confidential December 2010 -19-
  • 20. COMMON TOOLS For monitoring the OS/MySQL in a pinch Company Confidential December 2010 -20-
  • 21. • Sar is your friend, every unix/linux server should setup sar to collect stats in the background – Sar Can give you historical reports on : CPU, Disk, Memory, Network, and a lot more. – Scheduled to collect data via cron • Iostat is valuable in gauging disk performance – avwait+svctim = response time (iostat -x) Systat Company Confidential December 2010 -21-
  • 22. Sar Network Stats Company Confidential December 2010 -22-
  • 23. Sar CPU Company Confidential December 2010 -23-
  • 24. Sar Memory Company Confidential December 2010 -24-
  • 26. VMSTAT Company Confidential December 2010 -26- • Can give you a realtime view of changes on the system to CPU/Memory
  • 27. Top Company Confidential December 2010 -27- • Get a current Snapshot of running processes
  • 28. Percona Toolkit Company Confidential December 2010 -28- • Collection of scripts used for monitoring system and DB performance • pt-stalk • pt-diskstats • pt-pmp • Pt-Ioprofiler • pt-mext
  • 29. Cacti Company Confidential December 2010 -29- • Great Visual Presentation of Historical Stats • MySQL, Apache, Sphinx, Memcached, (Entire Stack) • Percona Maintains the MySQL Templates • Can add a lot of value... Example: Mysterious Slowdown
  • 30. OMG The Server is Slow! Company Confidential December 2010 -30-
  • 31. Dig a little deeper Company Confidential December 2010 -31-
  • 32. Oh Wait it Always Happens Company Confidential December 2010 -32-
  • 33. Percona Monitoring Plugins- Cacti! Company Confidential December 2010 -33- Grab them here: http://www.percona.com/software/percona-monitoring-plugins/
  • 34. THE CONFIGURATION Reasonability Check Company Confidential December 2010 -34-
  • 35. MYSQL CHECKS Looking at the DB Company Confidential December 2010 -35-
  • 36. Configuration Options – Top 10 Company Confidential December 2010 -36- General Configuration Options • query_cache_size (Disable in many versions) • log_slow_queries • long_query_time • max_connections • expire_logs_days MyISAM Specific • key_buffer_size
  • 37. Configuration Options Company Confidential December 2010 -37- Innodb Specific Options • innodb_buffer_pool_size • innodb_flush_log_at_trx_commit • innodb_log_file_size Plugin/Xtradb/Mysql 5.5 Innodb Options • innodb_io_capacity • innodb_read_ahead • innodb_write_io_threads • innodb_read_io_threads
  • 38. Online Tools to help you set your my.cnf! Company Confidential December 2010 -38- • https://tools.percona.com/wizard
  • 39. Memory and Swap Company Confidential December 2010 -39- • Disk IO is bad, Avoiding swapping things that should be in memory to disk ( do not disable swap however ) • SSD’s/Fast Disks • Hot Data in Memory! • read_buffer, read_rnd_buffer, sort_buffer, join_buffer are all allocated per thread so be careful! • You want temp tables to be built in memory not on disk
  • 40. Check Current Activity • Mysql – “show full processlist” – “show global status” – “Show innodb status” • Mysqladmin • Slow Query Log • pt-query-digest • Mysqldumpslow • Innotop • Mytop • pt-mext Company Confidential December 2010 -40-
  • 41. Show Processlist Company Confidential December 2010 -41- mysql> show processlistG *************************** 1. row *************************** Id: 52 User: bench Host: domU-12-31-39-0C-41-81.compute-1.internal:42315 db: simple_benchmark Command: Sleep Time: 0 State: Info: NULL *************************** 14. row *************************** Id: 65 User: bench Host: domU-12-31-39-0C-41-81.compute-1.internal:42328 db: simple_benchmark Command: Query Time: 0 State: init Info: insert into simple_benchmark.simple_comments (lookup_id, comment, mydate) values ( '8519163', 'Comme *************************** 15. row *************************** Id: 66 User: bench Host: domU-12-31-39-0C-41-81.compute-1.internal:42329 db: simple_benchmark Command: Sleep Time: 0 State: Info: NULL
  • 42. Mysqladmin Company Confidential December 2010 -42- • Mysqladmin extended -r -i1 will give you mysql stats at 1 second intervals, change the -i to increase decrease... • A few stats of note:
  • 43. pt-mext Company Confidential December 2010 -43- • Mext can take the output from mysqladmin and put the status variables side by side, this makes it very convenient to look for differences
  • 44. Slow Query Log Company Confidential December 2010 -44- • The Slow Query log is your friend! As mentioned earlier queries that take over a certain amount of time are logged here. (Percona Patches for complete picture ) • Summarize the slow query log with percona toolkit, pt- query-digest or mysqldumpslow if the percona toolkit is not available • Look for not only the longest running query, but also the one with lots of executions and cumulated time
  • 47. Memcached/Redis/Other Caching Company Confidential December 2010 -47- • Review: More memory the better • Caching frequently used data is an excellent way to boost performance • This typically requires changes to your app • Performance improvement can be dramatic
  • 48. Query Tuning Company Confidential December 2010 -48- • Review the slow query log, parse the log with pt- query-digest. – If I see something here, I will analyze it • If your still at a loss, try using tcpdump to dump SQL statements into pt-query-digest and look for repeated queries. ( Easier then the general query log if you need sub second slow queries).
  • 49. Query Tuning Company Confidential December 2010 -49- • Use Explain Plan • Add Indexes where needed, do not over index – pt-duplicate-key-checker • Lots of small queries can sometimes be more impactful than 1 big one.
  • 50. Remember Company Confidential December 2010 -50- • The Disclaimer! • Questions?