SlideShare a Scribd company logo
MySQL Tech Tour 2015 - Manage & Tune
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
How To Manage & Tune
MySQL
Mark Swarbrick
Principle Presales Consultant
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
3
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Manage & Tune MySQL
Tuning Considerations + Go-live factors to consider
4
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Tuning + Go-Live
Considerations
5
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Performance Testing – How to measure success
Monitoring – Make sure you are monitoring the correct metrics
Backup Strategy – Will your backups be suitable for purpose?
High Availability – Does the uptime requirement match the design?
Failover – Have you got the policies and procedures in place to failover to
a backup data center or server?
Growth – Have you planned for growth of data and throughput?
Tuning – How to tune and monitor for performance
6
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
MySQL Performance Schema
• Identify performance bottlenecks
• Identify problematic queries
• Get real time insight into locks
• See exactly what is happening
within MySQL
• Get real time insight into MySQL
internals
• Get real time insight into query
executions
7
mysql> select * from host_summary_by_stages;
+------+--------------------------------+-------+-----------+-----------+
| host | event_name | total | wait_sum | wait_avg |
+------+--------------------------------+-------+-----------+-----------+
| hal | stage/sql/Opening tables | 889 | 1.97 ms | 2.22 us |
| hal | stage/sql/Creating sort index | 4 | 1.79 ms | 446.30 us |
| hal | stage/sql/init | 10 | 312.27 us | 31.23 us |
| hal | stage/sql/checking permissions | 10 | 300.62 us | 30.06 us |
| hal | stage/sql/freeing items | 5 | 85.89 us | 17.18 us |
| hal | stage/sql/statistics | 5 | 79.15 us | 15.83 us |
| hal | stage/sql/preparing | 5 | 69.12 us | 13.82 us |
| hal | stage/sql/optimizing | 5 | 53.11 us | 10.62 us |
| hal | stage/sql/Sending data | 5 | 44.66 us | 8.93 us |
| hal | stage/sql/closing tables | 5 | 37.54 us | 7.51 us |
| hal | stage/sql/System lock | 5 | 34.28 us | 6.86 us |
| hal | stage/sql/query end | 5 | 24.37 us | 4.87 us |
| hal | stage/sql/end | 5 | 8.60 us | 1.72 us |
| hal | stage/sql/Sorting result | 5 | 8.33 us | 1.67 us |
| hal | stage/sql/executing | 5 | 5.37 us | 1.07 us |
| hal | stage/sql/cleaning up | 5 | 4.60 us | 919.00 ns |
+------+--------------------------------+-------+-----------+-----------+
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
MySQL Workbench Overview
• MySQL Database IDE
• Millions of Downloads
• Windows, OS X, Linux
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Workbench 6.0
New Look, Redesigned GUI, Simplified Workflow
• Home Screen, Managing Connections, Edit & Admin, Color Scheme, Icons
For Developers
• Schema Inspector, Maintenance, Cascading Delete, Vertical Results, Table Data Search, Context Sensitive Help, Table Templates
For Migration
• New Sybase Anywhere, SQLite
For Administrators
• Server Status / Server Data, Backup GUI, Audit Log Inspector
For Design
• Improved Synchronization, Improved model printing to PDF files
What’s New
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Performance Tasks
In Workbench
Monitor
Assess
OptimizeTune
Configure
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Start by looking at Server Status
 Management Tab – Server Status
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Basics
• Enabled/Disabled
Features
 Directory Setup
 On best disks?
 Adequate space?
 Slow Query Log On?
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Performance Testing – How to measure success
Monitoring – Make sure you are monitoring the correct metrics
Availability
Use a decent query
Logs
Logs filling up disk space
Slow query log filling space
Disk Space
Disks getting full is the most common problem
Ideally alarm on how soon disk space changes rather than absolute disk space
13
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Performance Testing – How to measure success
Monitoring – Make sure you are monitoring the correct metrics
Stalls / Spikes
Table Locks
CPU Spikes
Memory Paging
Connections
Are you reaching max_connections limit?
Can the application connect?
Processes
Long running Processes
14
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Performance Testing – How to measure success
Monitoring – Make sure you are monitoring the correct metrics
Transactions
Long running or long idle transactions
Queued transactions (size of trans queue) (show innodb status)
Replication
Is Replication running
Whats the replication lag
15
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Performance Testing – How to measure success
Monitoring – Make sure you are monitoring the correct metrics
Query Performance
Top Queries to optimise – (interactive monitor not generate alerts on)
Response time outliers
Queries not using index
Queries using full/ partial scans / table scans
Queries that return errors / warning
Operational Aspects
Server restarts
Server config change events
Messages in the error Log
16
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Backup Strategy – Will your backups be suitable for purpose
MySQLdump - It can be used to dump a database or a collection of databases for backup or transfer to
another SQL server (not necessarily a MySQL server). The dump typically contains SQL statements to
create the table, populate it, or both. However, mysqldumpcan also be used to generate files in CSV,
other delimited text, or XML format.
MySQL Enterprise Backup - "Hot" Online Backups - Backups take place entirely online, without
interrupting MySQL transactions
High Performance - Save time with faster backup and recovery
Incremental Backup - Backup only data that has changed since the last backup
Partial Backup - Target particular tables or tablespaces
Full Instance Backup - Backs up data, as well as configuration and other information to easily create a
complete "replica"
17
MySQL Backup Types: Comparison
mysqldump LVM Snapshots MySQL Replication MySQL Enterprise Backup
Full Backup ✔ ✔ ✔ ✔
Incremental Backups ✖ ✔ ✖ ✔
Partial Backups ✔ ✖ ✖ ✔
Compression Support ✖ ✖ ✖ ✔
Allows updates ✖ ✖ ✔ ✔
Point in Time - Consistent ✖ ✔ ✔ ✔
Backup Speed Poor Good Very Good Very Good
Recovery Speed Very Poor Good Very Good Very Good
Partial Restore ✔ ✖ ✖ ✔
LZ4 Compression ✖ ✔
AES 256 Encryption ✖ ✔
Corruption Detection ✔ ✖ ✖ ✔
Meets Regulatory Archive
Req.
✔ ✖ ✖ ✔
Supports DDL ✔ ✖ ✖ ✔
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
High Availability – Does the uptime requirements match the design?
See Planning for outages section ;-) But always good to refer back to the
original design spec!
19
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Failover – Have you got the policies and
procedures in place to failover to a backup
data center or server?
Most HA strategies fail not due to the
hardware or software, but to the lack of
awareness and testing of policies and
procedures in place!
20
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Growth – Have you planned for growth of data and throughput?
21
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Tuning – How to tune and monitor for performance
22
Hardware
Config Options
Schema
InnoDB
Performance Monitoring
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Hardware
Schema Changes
Data Growth
Indexes
SQL
90% of
Performance Problems
Source of Database Performance Problems
23
Hardware: The Perfect MySQL Server
• The more cores the better (especially for 5.5 and later)
• x86_64 - 64 bit for more memory is important
– The more the better
• Fast HD (10-15k RPM SATA) or NAS/SAN……
– RAID 10 for most, RAID 5 OK if very read intensive
– Hardware RAID battery backed up cache critical!
– More disks are always better! - 4+ recommended, 8-16 can increase IO
• …Or SSD (for higher throughput)
– Intel, Fusion-IO good choices; good option for Slaves
• At least 2 x NICs for redundancy
• Slaves should be as powerful as the Master
Config Options
The MySQL server is controlled by “System Variables”
• Set Via:
– my.cnf / my.ini
– SET [GLOBAL] <variable>=<value>
– client, i.e mysql
• Can be local (session) or global
The World’s Most Popular Open Source DatabaseCopyright 2010 Oracle
The World’s Most Popular Open Source DatabaseCopyright 2010 Oracle
Schemas
• Size = performance, smaller is better
– Size right! Do not automatically use 255 for VARCHAR
• Temp tables, most caches, expand to full size
• Use “procedure analyse” to determine the optimal types given the values in your table
– http://dev.mysql.com/doc/refman/5.1/en/procedure-analyse.html
– mysql> select * from tab procedure analyse (64,2000) G
• Consider the types:
– enum : http://dev.mysql.com/doc/refman/5.1/en/enum.html
– set : http://dev.mysql.com/doc/refman/5.1/en/set.html
• Compress large strings
– Use the MySQL COMPRESS and UNCOMPRESS functions
The World’s Most Popular Open Source DatabaseCopyright 2010 Oracle
InnoDB Tuning
• Unlike MyISAM - InnoDB uses a single cache for both index and data
– innodb_buffer_pool_size - should be 70-80% of available memory.
– It is not uncommon for this to be very large, i.e. 34GB on a system with 40GB of memory
– Make sure its not set so large as to cause swapping!
– mysql>show status like 'Innodb_buffer%' ;
• InnoDB can use direct IO on systems that support it - Linux, FreeBSD, and Solaris
– innodb_flush_method = O_DIRECT
• For more InnoDB tuning see
– http://dev.mysql.com/doc/refman/5.1/en/innodb-tuning-troubleshooting.html
A Virtual MySQL DBA Assistant!
 Web-based, global view of
MySQL/Cluster applications (on-
premise and Cloud deployments)
 Automated, rules-based monitoring
and alerts (SMTP, SNMP enabled)
 Query capture, monitoring, analysis
and tuning, correlated with Monitor
graphs
 Real-time Replication Monitor with
auto-discovery of master-slave
topologies
 Integrated with Oracle Support
MySQL Enterprise Monitor
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Thank You!
29
MySQL Tech Tour 2015 - Manage & Tune

More Related Content

PPTX
MySQL Tech Tour 2015 - 5.7 Security
PDF
Mysql security 5.7
PDF
MySQL Manchester TT - Security
PDF
MySQL for Oracle DBAs
PPTX
MySQL High Availibility Solutions
PDF
MySQL Security
PDF
MySQL Security
PDF
MySQL Community and Commercial Edition
MySQL Tech Tour 2015 - 5.7 Security
Mysql security 5.7
MySQL Manchester TT - Security
MySQL for Oracle DBAs
MySQL High Availibility Solutions
MySQL Security
MySQL Security
MySQL Community and Commercial Edition

What's hot (20)

PDF
Introduction to MySQL
PPTX
MySQL Tech Tour 2015 - 5.7 Whats new
PDF
MySQL Enterprise Backup apr 2016
PDF
MySQL Enterprise Monitor
PDF
MySQL 5.6, news in 5.7 and our HA options
PDF
MySQL 5.7 Replication News
PDF
MySQL Enterprise Edition Overview
PDF
MySQL Enterprise Monitor
PDF
Oracle Enterprise Manager for MySQL
PDF
Mysql user-camp-march-11th-2016
PDF
NoSQL and MySQL
PDF
MySQL Cloud Service
PDF
MySQL 5.7: What's New, Nov. 2015
PDF
MySQL Manchester TT - 5.7 Whats new
PDF
MySQL 5.7: Focus on Replication
PDF
MySQL Enterprise Backup
PDF
What's new in my sql smug
PDF
MySQL Intro JSON NoSQL
PDF
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
PDF
MySQL Document Store
Introduction to MySQL
MySQL Tech Tour 2015 - 5.7 Whats new
MySQL Enterprise Backup apr 2016
MySQL Enterprise Monitor
MySQL 5.6, news in 5.7 and our HA options
MySQL 5.7 Replication News
MySQL Enterprise Edition Overview
MySQL Enterprise Monitor
Oracle Enterprise Manager for MySQL
Mysql user-camp-march-11th-2016
NoSQL and MySQL
MySQL Cloud Service
MySQL 5.7: What's New, Nov. 2015
MySQL Manchester TT - 5.7 Whats new
MySQL 5.7: Focus on Replication
MySQL Enterprise Backup
What's new in my sql smug
MySQL Intro JSON NoSQL
MySQL Day Paris 2016 - Introducing Oracle MySQL Cloud Service
MySQL Document Store
Ad

Viewers also liked (6)

PDF
Simple acl with laravel
PDF
Diagnosing MySQL performance problems
PDF
Drupal7 theming-cheatsheet 0
PDF
Shard-Query, an MPP database for the cloud using the LAMP stack
PDF
Consul: Service-oriented at Scale
PDF
Service discovery in a microservice architecture using consul
Simple acl with laravel
Diagnosing MySQL performance problems
Drupal7 theming-cheatsheet 0
Shard-Query, an MPP database for the cloud using the LAMP stack
Consul: Service-oriented at Scale
Service discovery in a microservice architecture using consul
Ad

Similar to MySQL Tech Tour 2015 - Manage & Tune (20)

PDF
MySQL Webinar Series 4/4 - Manage & tune
PPT
MySQL Performance Tuning at COSCUP 2014
PPTX
6 Tips to MySQL Performance Tuning
PDF
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
PDF
MySQL 5.6 Performance
PDF
MySQL Enterprise Monitor
PDF
The Peoper Care and Feeding of a MySQL Server for Busy Linux Admin
PDF
MySQL Webinar Series 3/4 - MySQl Monitoring With Enterprise Monitor + Query A...
PPTX
MySQL enterprise edition
PDF
MySQL Performance Best Practices
PDF
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
PDF
01 demystifying mysq-lfororacledbaanddeveloperv1
PDF
Tx lf propercareandfeedmysql
ODP
The care and feeding of a MySQL database
PDF
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
PDF
제3회난공불락 오픈소스 인프라세미나 - MySQL Performance
PDF
PhpTek Ten Things to do to make your MySQL servers Happier and Healthier
PPTX
MySQL in oracle_environments(Part 2): MySQL Enterprise Monitor & Oracle Enter...
PDF
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
PDF
Using MySQL Enterprise Monitor for Continuous Performance Improvement
MySQL Webinar Series 4/4 - Manage & tune
MySQL Performance Tuning at COSCUP 2014
6 Tips to MySQL Performance Tuning
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
MySQL 5.6 Performance
MySQL Enterprise Monitor
The Peoper Care and Feeding of a MySQL Server for Busy Linux Admin
MySQL Webinar Series 3/4 - MySQl Monitoring With Enterprise Monitor + Query A...
MySQL enterprise edition
MySQL Performance Best Practices
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
01 demystifying mysq-lfororacledbaanddeveloperv1
Tx lf propercareandfeedmysql
The care and feeding of a MySQL database
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
제3회난공불락 오픈소스 인프라세미나 - MySQL Performance
PhpTek Ten Things to do to make your MySQL servers Happier and Healthier
MySQL in oracle_environments(Part 2): MySQL Enterprise Monitor & Oracle Enter...
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
Using MySQL Enterprise Monitor for Continuous Performance Improvement

More from Mark Swarbrick (20)

PDF
MySQL NoSQL Document Store
PPSX
MySQL @ the University Of Nottingham
PDF
InnoDb Vs NDB Cluster
PDF
MySQL Security & GDPR
PDF
Intro To MySQL 2019
PDF
PDF
MySQL Dublin Event Nov 2018 - MySQL 8
PDF
MySQL Dublin Event Nov 2018 - State of the Dolphin
PDF
Oracle Code Event - MySQL JSON Document Store
PDF
TLV - MySQL Security overview
PDF
TLV - MySQL Enterprise Edition + Cloud
PDF
TLV - Whats new in MySQL 8
PDF
MySQL At University Of Nottingham - 2018 MySQL Days
PDF
MySQL At Mastercard - 2018 MySQL Days
PDF
MySQL 8 - 2018 MySQL Days
PDF
MySQL Security + GDPR - 2018 MySQL Days
PDF
MySQL InnoDB + NDB Cluster - 2018 MySQL Days
PDF
MySQL Cloud - 2018 MySQL Days
PDF
MySQL 2018 Intro - 2018 MySQL Days
PDF
MySQL + GDPR
MySQL NoSQL Document Store
MySQL @ the University Of Nottingham
InnoDb Vs NDB Cluster
MySQL Security & GDPR
Intro To MySQL 2019
MySQL Dublin Event Nov 2018 - MySQL 8
MySQL Dublin Event Nov 2018 - State of the Dolphin
Oracle Code Event - MySQL JSON Document Store
TLV - MySQL Security overview
TLV - MySQL Enterprise Edition + Cloud
TLV - Whats new in MySQL 8
MySQL At University Of Nottingham - 2018 MySQL Days
MySQL At Mastercard - 2018 MySQL Days
MySQL 8 - 2018 MySQL Days
MySQL Security + GDPR - 2018 MySQL Days
MySQL InnoDB + NDB Cluster - 2018 MySQL Days
MySQL Cloud - 2018 MySQL Days
MySQL 2018 Intro - 2018 MySQL Days
MySQL + GDPR

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Big Data Technologies - Introduction.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
KodekX | Application Modernization Development
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Spectroscopy.pptx food analysis technology
PDF
MIND Revenue Release Quarter 2 2025 Press Release
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Reach Out and Touch Someone: Haptics and Empathic Computing
Network Security Unit 5.pdf for BCA BBA.
The Rise and Fall of 3GPP – Time for a Sabbatical?
MYSQL Presentation for SQL database connectivity
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Big Data Technologies - Introduction.pptx
The AUB Centre for AI in Media Proposal.docx
Mobile App Security Testing_ A Comprehensive Guide.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Electronic commerce courselecture one. Pdf
KodekX | Application Modernization Development
NewMind AI Weekly Chronicles - August'25 Week I
Encapsulation_ Review paper, used for researhc scholars
Advanced methodologies resolving dimensionality complications for autism neur...
Programs and apps: productivity, graphics, security and other tools
Spectroscopy.pptx food analysis technology
MIND Revenue Release Quarter 2 2025 Press Release

MySQL Tech Tour 2015 - Manage & Tune

  • 2. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | How To Manage & Tune MySQL Mark Swarbrick Principle Presales Consultant
  • 3. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 3
  • 4. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Manage & Tune MySQL Tuning Considerations + Go-live factors to consider 4
  • 5. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Tuning + Go-Live Considerations 5
  • 6. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Performance Testing – How to measure success Monitoring – Make sure you are monitoring the correct metrics Backup Strategy – Will your backups be suitable for purpose? High Availability – Does the uptime requirement match the design? Failover – Have you got the policies and procedures in place to failover to a backup data center or server? Growth – Have you planned for growth of data and throughput? Tuning – How to tune and monitor for performance 6
  • 7. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | MySQL Performance Schema • Identify performance bottlenecks • Identify problematic queries • Get real time insight into locks • See exactly what is happening within MySQL • Get real time insight into MySQL internals • Get real time insight into query executions 7 mysql> select * from host_summary_by_stages; +------+--------------------------------+-------+-----------+-----------+ | host | event_name | total | wait_sum | wait_avg | +------+--------------------------------+-------+-----------+-----------+ | hal | stage/sql/Opening tables | 889 | 1.97 ms | 2.22 us | | hal | stage/sql/Creating sort index | 4 | 1.79 ms | 446.30 us | | hal | stage/sql/init | 10 | 312.27 us | 31.23 us | | hal | stage/sql/checking permissions | 10 | 300.62 us | 30.06 us | | hal | stage/sql/freeing items | 5 | 85.89 us | 17.18 us | | hal | stage/sql/statistics | 5 | 79.15 us | 15.83 us | | hal | stage/sql/preparing | 5 | 69.12 us | 13.82 us | | hal | stage/sql/optimizing | 5 | 53.11 us | 10.62 us | | hal | stage/sql/Sending data | 5 | 44.66 us | 8.93 us | | hal | stage/sql/closing tables | 5 | 37.54 us | 7.51 us | | hal | stage/sql/System lock | 5 | 34.28 us | 6.86 us | | hal | stage/sql/query end | 5 | 24.37 us | 4.87 us | | hal | stage/sql/end | 5 | 8.60 us | 1.72 us | | hal | stage/sql/Sorting result | 5 | 8.33 us | 1.67 us | | hal | stage/sql/executing | 5 | 5.37 us | 1.07 us | | hal | stage/sql/cleaning up | 5 | 4.60 us | 919.00 ns | +------+--------------------------------+-------+-----------+-----------+
  • 8. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | MySQL Workbench Overview • MySQL Database IDE • Millions of Downloads • Windows, OS X, Linux
  • 9. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Workbench 6.0 New Look, Redesigned GUI, Simplified Workflow • Home Screen, Managing Connections, Edit & Admin, Color Scheme, Icons For Developers • Schema Inspector, Maintenance, Cascading Delete, Vertical Results, Table Data Search, Context Sensitive Help, Table Templates For Migration • New Sybase Anywhere, SQLite For Administrators • Server Status / Server Data, Backup GUI, Audit Log Inspector For Design • Improved Synchronization, Improved model printing to PDF files What’s New
  • 10. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Performance Tasks In Workbench Monitor Assess OptimizeTune Configure
  • 11. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Start by looking at Server Status  Management Tab – Server Status
  • 12. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Basics • Enabled/Disabled Features  Directory Setup  On best disks?  Adequate space?  Slow Query Log On?
  • 13. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Performance Testing – How to measure success Monitoring – Make sure you are monitoring the correct metrics Availability Use a decent query Logs Logs filling up disk space Slow query log filling space Disk Space Disks getting full is the most common problem Ideally alarm on how soon disk space changes rather than absolute disk space 13
  • 14. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Performance Testing – How to measure success Monitoring – Make sure you are monitoring the correct metrics Stalls / Spikes Table Locks CPU Spikes Memory Paging Connections Are you reaching max_connections limit? Can the application connect? Processes Long running Processes 14
  • 15. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Performance Testing – How to measure success Monitoring – Make sure you are monitoring the correct metrics Transactions Long running or long idle transactions Queued transactions (size of trans queue) (show innodb status) Replication Is Replication running Whats the replication lag 15
  • 16. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Performance Testing – How to measure success Monitoring – Make sure you are monitoring the correct metrics Query Performance Top Queries to optimise – (interactive monitor not generate alerts on) Response time outliers Queries not using index Queries using full/ partial scans / table scans Queries that return errors / warning Operational Aspects Server restarts Server config change events Messages in the error Log 16
  • 17. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Backup Strategy – Will your backups be suitable for purpose MySQLdump - It can be used to dump a database or a collection of databases for backup or transfer to another SQL server (not necessarily a MySQL server). The dump typically contains SQL statements to create the table, populate it, or both. However, mysqldumpcan also be used to generate files in CSV, other delimited text, or XML format. MySQL Enterprise Backup - "Hot" Online Backups - Backups take place entirely online, without interrupting MySQL transactions High Performance - Save time with faster backup and recovery Incremental Backup - Backup only data that has changed since the last backup Partial Backup - Target particular tables or tablespaces Full Instance Backup - Backs up data, as well as configuration and other information to easily create a complete "replica" 17
  • 18. MySQL Backup Types: Comparison mysqldump LVM Snapshots MySQL Replication MySQL Enterprise Backup Full Backup ✔ ✔ ✔ ✔ Incremental Backups ✖ ✔ ✖ ✔ Partial Backups ✔ ✖ ✖ ✔ Compression Support ✖ ✖ ✖ ✔ Allows updates ✖ ✖ ✔ ✔ Point in Time - Consistent ✖ ✔ ✔ ✔ Backup Speed Poor Good Very Good Very Good Recovery Speed Very Poor Good Very Good Very Good Partial Restore ✔ ✖ ✖ ✔ LZ4 Compression ✖ ✔ AES 256 Encryption ✖ ✔ Corruption Detection ✔ ✖ ✖ ✔ Meets Regulatory Archive Req. ✔ ✖ ✖ ✔ Supports DDL ✔ ✖ ✖ ✔
  • 19. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | High Availability – Does the uptime requirements match the design? See Planning for outages section ;-) But always good to refer back to the original design spec! 19
  • 20. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Failover – Have you got the policies and procedures in place to failover to a backup data center or server? Most HA strategies fail not due to the hardware or software, but to the lack of awareness and testing of policies and procedures in place! 20
  • 21. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Growth – Have you planned for growth of data and throughput? 21
  • 22. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Tuning – How to tune and monitor for performance 22 Hardware Config Options Schema InnoDB Performance Monitoring
  • 23. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Hardware Schema Changes Data Growth Indexes SQL 90% of Performance Problems Source of Database Performance Problems 23
  • 24. Hardware: The Perfect MySQL Server • The more cores the better (especially for 5.5 and later) • x86_64 - 64 bit for more memory is important – The more the better • Fast HD (10-15k RPM SATA) or NAS/SAN…… – RAID 10 for most, RAID 5 OK if very read intensive – Hardware RAID battery backed up cache critical! – More disks are always better! - 4+ recommended, 8-16 can increase IO • …Or SSD (for higher throughput) – Intel, Fusion-IO good choices; good option for Slaves • At least 2 x NICs for redundancy • Slaves should be as powerful as the Master
  • 25. Config Options The MySQL server is controlled by “System Variables” • Set Via: – my.cnf / my.ini – SET [GLOBAL] <variable>=<value> – client, i.e mysql • Can be local (session) or global The World’s Most Popular Open Source DatabaseCopyright 2010 Oracle
  • 26. The World’s Most Popular Open Source DatabaseCopyright 2010 Oracle Schemas • Size = performance, smaller is better – Size right! Do not automatically use 255 for VARCHAR • Temp tables, most caches, expand to full size • Use “procedure analyse” to determine the optimal types given the values in your table – http://dev.mysql.com/doc/refman/5.1/en/procedure-analyse.html – mysql> select * from tab procedure analyse (64,2000) G • Consider the types: – enum : http://dev.mysql.com/doc/refman/5.1/en/enum.html – set : http://dev.mysql.com/doc/refman/5.1/en/set.html • Compress large strings – Use the MySQL COMPRESS and UNCOMPRESS functions
  • 27. The World’s Most Popular Open Source DatabaseCopyright 2010 Oracle InnoDB Tuning • Unlike MyISAM - InnoDB uses a single cache for both index and data – innodb_buffer_pool_size - should be 70-80% of available memory. – It is not uncommon for this to be very large, i.e. 34GB on a system with 40GB of memory – Make sure its not set so large as to cause swapping! – mysql>show status like 'Innodb_buffer%' ; • InnoDB can use direct IO on systems that support it - Linux, FreeBSD, and Solaris – innodb_flush_method = O_DIRECT • For more InnoDB tuning see – http://dev.mysql.com/doc/refman/5.1/en/innodb-tuning-troubleshooting.html
  • 28. A Virtual MySQL DBA Assistant!  Web-based, global view of MySQL/Cluster applications (on- premise and Cloud deployments)  Automated, rules-based monitoring and alerts (SMTP, SNMP enabled)  Query capture, monitoring, analysis and tuning, correlated with Monitor graphs  Real-time Replication Monitor with auto-discovery of master-slave topologies  Integrated with Oracle Support MySQL Enterprise Monitor
  • 29. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Thank You! 29