SlideShare una empresa de Scribd logo
1 de 50
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 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?

Más contenido relacionado

La actualidad más candente

RNUG - HCL Notes 11.0.1 FP2 — Performance Boost Re-Reloaded
RNUG - HCL Notes 11.0.1 FP2 — Performance Boost Re-ReloadedRNUG - HCL Notes 11.0.1 FP2 — Performance Boost Re-Reloaded
RNUG - HCL Notes 11.0.1 FP2 — Performance Boost Re-ReloadedChristoph Adler
 
From A to Z-itrix: Setting up the most stable and fastest HCL Notes client on...
From A to Z-itrix: Setting up the most stable and fastest HCL Notes client on...From A to Z-itrix: Setting up the most stable and fastest HCL Notes client on...
From A to Z-itrix: Setting up the most stable and fastest HCL Notes client on...panagenda
 
Virtualization Assessment Example
Virtualization Assessment ExampleVirtualization Assessment Example
Virtualization Assessment Examplekoesteruk22
 
CollapSphere 2019 - SUPERCHARGED HCL Notes V11 Upgrades
CollapSphere 2019 - SUPERCHARGED HCL Notes V11 UpgradesCollapSphere 2019 - SUPERCHARGED HCL Notes V11 Upgrades
CollapSphere 2019 - SUPERCHARGED HCL Notes V11 UpgradesChristoph Adler
 
You don't want to do it like that
You don't want to do it like thatYou don't want to do it like that
You don't want to do it like thatSharon James
 
Technical track-afterimaging Progress Database
Technical track-afterimaging Progress DatabaseTechnical track-afterimaging Progress Database
Technical track-afterimaging Progress DatabaseVinh Nguyen
 
IBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
IBM Connect 2016 - 60+ in 60 - Admin Tips Power HourIBM Connect 2016 - 60+ in 60 - Admin Tips Power Hour
IBM Connect 2016 - 60+ in 60 - Admin Tips Power HourChris Miller
 
IBM Domino / IBM Notes Performance Tuning
IBM Domino / IBM Notes Performance Tuning IBM Domino / IBM Notes Performance Tuning
IBM Domino / IBM Notes Performance Tuning Vladislav Tatarincev
 
BP103 - Got Problems? Let's Do a Health Check
BP103 - Got Problems? Let's Do a Health CheckBP103 - Got Problems? Let's Do a Health Check
BP103 - Got Problems? Let's Do a Health CheckLuis Guirigay
 
WHITE PAPER▶ Blueprint for Optimized Duplication with Backup Exec 15
WHITE PAPER▶ Blueprint for Optimized Duplication with Backup Exec 15WHITE PAPER▶ Blueprint for Optimized Duplication with Backup Exec 15
WHITE PAPER▶ Blueprint for Optimized Duplication with Backup Exec 15Symantec
 
Adm02 Be a Domino Detective: Tackling Your Toughest Performance Problems
Adm02 Be a Domino Detective: Tackling Your Toughest Performance ProblemsAdm02 Be a Domino Detective: Tackling Your Toughest Performance Problems
Adm02 Be a Domino Detective: Tackling Your Toughest Performance ProblemsKim Greene
 
CollabSphere 2020 Live - Virtual, Faster, Better! How to deploy HCL Notes 11....
CollabSphere 2020 Live - Virtual, Faster, Better! How to deploy HCL Notes 11....CollabSphere 2020 Live - Virtual, Faster, Better! How to deploy HCL Notes 11....
CollabSphere 2020 Live - Virtual, Faster, Better! How to deploy HCL Notes 11....Christoph Adler
 
Adm07 The Health Check Extravaganza for IBM Social and Collaboration Environm...
Adm07 The Health Check Extravaganza for IBM Social and Collaboration Environm...Adm07 The Health Check Extravaganza for IBM Social and Collaboration Environm...
Adm07 The Health Check Extravaganza for IBM Social and Collaboration Environm...Kim Greene
 
Got Problems? Let's Do a Health Check
Got Problems? Let's Do a Health CheckGot Problems? Let's Do a Health Check
Got Problems? Let's Do a Health CheckLuis Guirigay
 
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...Symantec
 
Are the Native SQL Server Backup Utilities Holding You Back?
Are the Native SQL Server Backup Utilities Holding You Back?Are the Native SQL Server Backup Utilities Holding You Back?
Are the Native SQL Server Backup Utilities Holding You Back?SQLDBApros
 
Engage 2020 - HCL Notes V11 Performance Boost
Engage 2020 - HCL Notes V11 Performance BoostEngage 2020 - HCL Notes V11 Performance Boost
Engage 2020 - HCL Notes V11 Performance BoostChristoph Adler
 
Dutch Lotus User Group 2009 - Domino Tuning Presentation
Dutch Lotus User Group 2009 - Domino Tuning PresentationDutch Lotus User Group 2009 - Domino Tuning Presentation
Dutch Lotus User Group 2009 - Domino Tuning PresentationVladislav Tatarincev
 

La actualidad más candente (19)

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

Similar a The 5 Minute DBA-DBA Skills for Non-DBA

The 5 Minute MySQL DBA
The 5 Minute MySQL DBAThe 5 Minute MySQL DBA
The 5 Minute MySQL DBAIrawan Soetomo
 
10 cool features in defrag 10
10 cool features in defrag 1010 cool features in defrag 10
10 cool features in defrag 10aosborne
 
Tulsa tech fest 2010 - web speed and scalability
Tulsa tech fest 2010  - web speed and scalabilityTulsa tech fest 2010  - web speed and scalability
Tulsa tech fest 2010 - web speed and scalabilityJason Ragsdale
 
IBM Connect 2017: Back from the Dead: When Bad Code Kills a Good Server
IBM Connect 2017: Back from the Dead: When Bad Code Kills a Good ServerIBM Connect 2017: Back from the Dead: When Bad Code Kills a Good Server
IBM Connect 2017: Back from the Dead: When Bad Code Kills a Good ServerSerdar Basegmez
 
Scaling apps for the big time
Scaling apps for the big timeScaling apps for the big time
Scaling apps for the big timeproitconsult
 
Engage 2020 - HCL Notes V11 Performance Boost
Engage 2020 - HCL Notes V11 Performance BoostEngage 2020 - HCL Notes V11 Performance Boost
Engage 2020 - HCL Notes V11 Performance Boostpanagenda
 
PowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue KidPowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue KidMatthew Johnson
 
Mysql features for the enterprise
Mysql features for the enterpriseMysql features for the enterprise
Mysql features for the enterpriseGiuseppe Maxia
 
Back from the Dead: When Bad Code Kills a Good Server
Back from the Dead: When Bad Code Kills a Good ServerBack from the Dead: When Bad Code Kills a Good Server
Back from the Dead: When Bad Code Kills a Good ServerTeamstudio
 
Geek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVPGeek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVPIDERA Software
 
SharePoint Performance: Physical to Virtual to Microsoft Azure Cloud and Offi...
SharePoint Performance: Physical to Virtual to Microsoft Azure Cloud and Offi...SharePoint Performance: Physical to Virtual to Microsoft Azure Cloud and Offi...
SharePoint Performance: Physical to Virtual to Microsoft Azure Cloud and Offi...Joel Oleson
 
6 Tips to MySQL Performance Tuning
6 Tips to MySQL Performance Tuning6 Tips to MySQL Performance Tuning
6 Tips to MySQL Performance TuningOracleMySQL
 
Hadoop operations-2015-hadoop-summit-san-jose-v5
Hadoop operations-2015-hadoop-summit-san-jose-v5Hadoop operations-2015-hadoop-summit-san-jose-v5
Hadoop operations-2015-hadoop-summit-san-jose-v5Chris Nauroth
 
Hadoop Operations - Best Practices from the Field
Hadoop Operations - Best Practices from the FieldHadoop Operations - Best Practices from the Field
Hadoop Operations - Best Practices from the FieldDataWorks Summit
 
Still All on One Server: Perforce at Scale
Still All on One Server: Perforce at Scale Still All on One Server: Perforce at Scale
Still All on One Server: Perforce at Scale Perforce
 
MySQL Performance Best Practices
MySQL Performance Best PracticesMySQL Performance Best Practices
MySQL Performance Best PracticesOlivier DASINI
 
Why advanced monitoring is key for healthy
Why advanced monitoring is key for healthyWhy advanced monitoring is key for healthy
Why advanced monitoring is key for healthyDenodo
 
DNUG Webcast: IBM Notes V10 Performance Boost
DNUG Webcast: IBM Notes V10 Performance BoostDNUG Webcast: IBM Notes V10 Performance Boost
DNUG Webcast: IBM Notes V10 Performance BoostChristoph Adler
 
SaltConf14 - Brendan Burns, Google - Management at Google Scale
SaltConf14 - Brendan Burns, Google - Management at Google ScaleSaltConf14 - Brendan Burns, Google - Management at Google Scale
SaltConf14 - Brendan Burns, Google - Management at Google ScaleSaltStack
 

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

The 5 Minute MySQL DBA
The 5 Minute MySQL DBAThe 5 Minute MySQL DBA
The 5 Minute MySQL DBA
 
10 cool features in defrag 10
10 cool features in defrag 1010 cool features in defrag 10
10 cool features in defrag 10
 
Tulsa tech fest 2010 - web speed and scalability
Tulsa tech fest 2010  - web speed and scalabilityTulsa tech fest 2010  - web speed and scalability
Tulsa tech fest 2010 - web speed and scalability
 
IBM Connect 2017: Back from the Dead: When Bad Code Kills a Good Server
IBM Connect 2017: Back from the Dead: When Bad Code Kills a Good ServerIBM Connect 2017: Back from the Dead: When Bad Code Kills a Good Server
IBM Connect 2017: Back from the Dead: When Bad Code Kills a Good Server
 
Scaling apps for the big time
Scaling apps for the big timeScaling apps for the big time
Scaling apps for the big time
 
Engage 2020 - HCL Notes V11 Performance Boost
Engage 2020 - HCL Notes V11 Performance BoostEngage 2020 - HCL Notes V11 Performance Boost
Engage 2020 - HCL Notes V11 Performance Boost
 
PowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue KidPowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue Kid
 
Mysql features for the enterprise
Mysql features for the enterpriseMysql features for the enterprise
Mysql features for the enterprise
 
Back from the Dead: When Bad Code Kills a Good Server
Back from the Dead: When Bad Code Kills a Good ServerBack from the Dead: When Bad Code Kills a Good Server
Back from the Dead: When Bad Code Kills a Good Server
 
Geek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVPGeek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVP
 
SharePoint Performance: Physical to Virtual to Microsoft Azure Cloud and Offi...
SharePoint Performance: Physical to Virtual to Microsoft Azure Cloud and Offi...SharePoint Performance: Physical to Virtual to Microsoft Azure Cloud and Offi...
SharePoint Performance: Physical to Virtual to Microsoft Azure Cloud and Offi...
 
6 Tips to MySQL Performance Tuning
6 Tips to MySQL Performance Tuning6 Tips to MySQL Performance Tuning
6 Tips to MySQL Performance Tuning
 
Hadoop operations-2015-hadoop-summit-san-jose-v5
Hadoop operations-2015-hadoop-summit-san-jose-v5Hadoop operations-2015-hadoop-summit-san-jose-v5
Hadoop operations-2015-hadoop-summit-san-jose-v5
 
Hadoop Operations - Best Practices from the Field
Hadoop Operations - Best Practices from the FieldHadoop Operations - Best Practices from the Field
Hadoop Operations - Best Practices from the Field
 
Survey of Percona Toolkit
Survey of Percona ToolkitSurvey of Percona Toolkit
Survey of Percona Toolkit
 
Still All on One Server: Perforce at Scale
Still All on One Server: Perforce at Scale Still All on One Server: Perforce at Scale
Still All on One Server: Perforce at Scale
 
MySQL Performance Best Practices
MySQL Performance Best PracticesMySQL Performance Best Practices
MySQL Performance Best Practices
 
Why advanced monitoring is key for healthy
Why advanced monitoring is key for healthyWhy advanced monitoring is key for healthy
Why advanced monitoring is key for healthy
 
DNUG Webcast: IBM Notes V10 Performance Boost
DNUG Webcast: IBM Notes V10 Performance BoostDNUG Webcast: IBM Notes V10 Performance Boost
DNUG Webcast: IBM Notes V10 Performance Boost
 
SaltConf14 - Brendan Burns, Google - Management at Google Scale
SaltConf14 - Brendan Burns, Google - Management at Google ScaleSaltConf14 - Brendan Burns, Google - Management at Google Scale
SaltConf14 - Brendan Burns, Google - Management at Google Scale
 

Último

20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 

Último (20)

20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 

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
  • 7.
  • 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?