SlideShare a Scribd company logo
1 of 24
Download to read offline
www.fromdual.com
1 / 24
MySQL Performance Tuning
DOAG 2013 Datenbank
14. Mai 2013, Düsseldorf
Oli Sennhauser
Senior MySQL Berater, FromDual GmbH
oli.sennhauser@fromdual.com
www.fromdual.com
2 / 24
Über FromDual GmbH
● FromDual bietet neutral und unabhängig:
● Beratung für MySQL
● Support für MySQL und Galera Cluster
● Remote-DBA Dienstleistungen für MySQL
● MySQL Schulungen
● Oracle Silver Partner (OPN)
www.fromdual.com
www.fromdual.com
3 / 24
Inhalt
HA Solutions
➢
Read scale-out
➢
Replication set-up for HA
➢
Active/passive fail-over
➢
MySQL Cluster
➢
Replication Cluster
➢
Storage-Engine-Replication
MySQL Performance Tuning mit System-Variablen
➢
Performance Tuning Hebel
➢
MySQL System Variablen
➢
MySQL Status Variablen
➢
MySQL Architektur
➢
Speicherbelegung
➢
Session Variablen
➢
Globale Variablen
➢
MyISAM Variablen
➢
InnoDB Variablen
➢
Monitoring
➢
Informationen
www.fromdual.com
4 / 24
Performance Tuning Hebel
www.fromdual.com
5 / 24
MySQL System Variablen
● Datenbank-Konfiguration
my.cnf
mysqld ­­help –verbose
/etc/my.cnf /etc/mysql/my.cnf 
/usr/local/mysql/etc/my.cnf 
$basedir/my.cnf ~/.my.cnf
SHOW GLOBAL VARIABLES;
www.fromdual.com
6 / 24
MySQL Status Variablen
● Was wir damit anrichten sieht man mit:
SHOW /*!50001 GLOBAL */ STATUS;
SHOW ENGINE INNODB STATUSG
www.fromdual.com
7 / 24
MySQL Architektur
mysqld
Application / Client
Thread
Cache
Connection
Manager
User Au-
thentication
Command
Dispatcher
Logging
Query Cache
Module
Query
Cache
Parser
Optimizer
Access Control
Table Manager
Table Open
Cache (.frm, fh)
Table Definition
Cache (tbl def.)
Handler Interface
MyISAM Memory NDB PBXTInnoDB ...Aria XtraDB Tokutek
www.fromdual.com
8 / 24
Speicherbelegung
Storage Engines
MySQL Server (mysqld)
Client 2 Client N
Local Memory Areas
Client 1
read_buffer
sort_buffer
tmp_table
read_bufferread_buffer
sort_buffer
table_open_cache
table_definition_cache
query_cache_size
etc...
Global Memory Area
key_buffer_size
innodb_buffer_pool_size
innodb_log_buffer_size
etc...
www.fromdual.com
9 / 24
Thread Cache
● Konifguration:
thread_cache_size
● Status:
threads_created
+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
| Variable_name        | Value |
+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
| Threads_cached       | 8     |
| Threads_connected    | 242   |
| Threads_created      | 15355 |
| Threads_running      | 16    |
+­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
www.fromdual.com
10 / 24
Query Cache
● Konfiguration: query_cache_size
● Status:
Com_select,
Qcache_hits
● Hit ratio:
Qache_hits/(Com_select + Qcache_hits)
+­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+
| Variable_name           | Value    |
+­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+
| Com_select              | 25712    |
| Qcache_free_memory      | 19553200 |
| Qcache_hits             | 65137    |
| Qcache_inserts          | 172167   |
+­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+
www.fromdual.com
11 / 24
Per Session Parameter
● Im „Executor“
● Alloziert/Dealloziert „on Demand“
● Per Session oder global einstellbar
● Meisst Effekt gering oder gar kontraproduktiv!
● Join Buffer
● join_buffer_size
● Read Buffer und Read Random Buffer
● read_buffer_size, read_rnd_buffer_size
www.fromdual.com
12 / 24
Sort Buffer, temporäre Tabellen
●
Temporäre Tabellen
(MEMORY oder MyISAM)
● Konfiguration: tmp_table_size,
(max_heap_table_size)
● Status: created_tmp_tables,
created_tmp_disk_tables
●
Sort Buffer
● Konfiguration:
sort_buffer_size
● Status: sort_merge_passes
www.fromdual.com
13 / 24
Table Definition Cache
● Ab v5.1
● Enthält Info vom .frm File
● Konfiguration: table_definition_cache
● Status: open_table_definitions, 
opened_table_defintions
+­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
| Variable_name            | Value |
+­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
| Open_table_definitions   | 100   |
| Opened_table_definitions | 100   |
+­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
www.fromdual.com
14 / 24
Table (Open) Cache
● Ab v5.1
● File-Descriptioren (1 pro Connection pro Table)
● Früher table_cache
● Konfiguration: table_open_cache
● Status: open_tables, opened_tables
+­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
| Variable_name            | Value |
+­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
| Open_tables              | 64    |
| Opened_tables            | 11812 |
+­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
www.fromdual.com
15 / 24
MyISAM
● Bis MySQL 5.1 default Storage Engine
● Konfiguration: key_buffer_size
● Status: Key_blocks_used, 
Key_blocks_unused, Key_reads, 
Key_read_requests
www.fromdual.com
16 / 24
InnoDB Buffer Pool
● InnoDB seit 5.5 default Storage Engine
● InnoDB Buffer Pool
● Konfiguration:
innodb_buffer_pool_size,
innodb_buffer_pool_instances,
innodb_io_capacity
mysqld
system table space: ibdata1
table table space table table spacetable table space
ib_logfile1ib_logfile2ib_logfilen
undo
double write area
tables/indexes
dd
OS file cache
sync
async
buffer pool
secondary index buffer
trxlogbuffer
data pages
index pages
adaptive hash idx
undo records
lock info table
www.fromdual.com
17 / 24
InnoDB Buffer Pool
● Status:
innodb_buffer_pool_pages_%, 
Innodb_buffer_bytes_%,
Innodb_data_%
www.fromdual.com
18 / 24
InnoDB Log File
● REDO Log, Transaction
Log
● Konfiguration:
innodb_log_file_size, 
innodb_flush_log_at_trx
_commit
● Status: innodb%log%
mysqld
system table space: ibdata1
table table space table table spacetable table space
ib_logfile1ib_logfile2ib_logfilen
undo
double write area
tables/indexes
dd
OS file cache
sync
async
buffer pool
secondary index buffer
trxlogbuffer
data pages
index pages
adaptive hash idx
undo records
lock info table
www.fromdual.com
19 / 24
Binary Log
Application ApplicationApplication
mysqld
bin-log.n
binlog_cache_size
binlog_stmt_cache_size
sync_binlog
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
| Variable_name              | Value |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
| Binlog_cache_disk_use      | 3456  |
| Binlog_cache_use           | 12786 |
| Binlog_stmt_cache_disk_use | 0     |
| Binlog_stmt_cache_use      | 0     |
+­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
www.fromdual.com
20 / 24
Monitoring
● Von Hand:
● SHOW GLOBAL STATUS;
● SHOW ENGINE INNODB STATUSG
● Performance Schema (P_S, >= v5.5)
● Irgend ein graphisches Monitoring Tool...
www.fromdual.com
21 / 24
PERFORMANCE_SCHEMA
● In Diskussion seit mindestens 2006
● Eingeführt in MySQL 5.5 (2010)
→ Einblick in die Datenbank
● In v5.5 disabled, in v5.6 enabled per default
performance_schema = 1
● Overhead 5% - 200%! → also Vorsicht!
www.fromdual.com
22 / 24
Beispiel: Table I/O waits
SELECT OBJECT_SCHEMA, OBJECT_NAME
     , ROUND(SUM_TIMER_WAIT/1000000000, 3) AS SUM_TIMER_WAIT
     , ROUND(SUM_TIMER_READ/1000000000, 3) AS SUM_TIMER_READ
     , ROUND(SUM_TIMER_WRITE/1000000000, 3) AS SUM_TIMER_WRITE
  FROM table_io_waits_summary_by_table
 ORDER BY SUM_TIMER_WAIT DESC
 LIMIT 10
;
+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­+
| OBJECT_SCHEMA | OBJECT_NAME  | SUM_TIMER_WAIT | SUM_TIMER_READ | SUM_TIMER_WRITE |
+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­+
| zabbix        | items        |    1182496.258 |     616630.696 |      565865.562 |
| zabbix        | history_uint |     889884.116 |     370528.991 |      519355.125 |
| zabbix        | history_str  |     460411.155 |     246159.458 |      214251.697 |
| zabbix        | history      |     389815.659 |      86285.980 |      303529.679 |
| zabbix        | trends_uint  |     133955.560 |     107365.626 |       26589.934 |
| zabbix        | functions    |     128657.654 |     128657.654 |           0.000 |
| zabbix        | trends       |      43683.159 |      36314.732 |        7368.428 |
| mpm           | mpm_agent    |      27837.056 |      27837.056 |           0.000 |
| zabbix        | hosts        |      23820.284 |      14044.672 |        9775.612 |
| zabbix        | triggers     |      21052.459 |      20970.604 |          81.855 |
+­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­+
www.fromdual.com
23 / 24
Informationen
● MySQL System Variablen:
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html
● MySQL Status Variablen:
http://dev.mysql.com/doc/refman/5.5/en/server-status-variables.html
● MySQL DB Health Check:
http://www.fromdual.com/mysql-database-health-check
● MySQL Performance Monitor:
http://www.fromdual.com/mysql-performance-monitor
www.fromdual.com
24 / 24
Q & A
Fragen ?
Diskussion?
Wir haben Zeit für ein Performance Audit...!
● FromDual bietet neutral und unabhängig:
● Beratung
● Remote-DBA
● Support für MySQL und Galera Cluster
● Schulung
www.fromdual.com/presentations

More Related Content

What's hot

MySQL 5.6 Performance
MySQL 5.6 PerformanceMySQL 5.6 Performance
MySQL 5.6 Performance
MYXPLAIN
 
MySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summaryMySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summary
Louis liu
 

What's hot (20)

MySQL Performance Metrics that Matter
MySQL Performance Metrics that MatterMySQL Performance Metrics that Matter
MySQL Performance Metrics that Matter
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDB
 
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
 
MySQL Backup and Security Best Practices
MySQL Backup and Security Best PracticesMySQL Backup and Security Best Practices
MySQL Backup and Security Best Practices
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014
 
MySQL 5.7 - What's new and How to upgrade
MySQL 5.7 - What's new and How to upgradeMySQL 5.7 - What's new and How to upgrade
MySQL 5.7 - What's new and How to upgrade
 
MySQL 5.6 Performance
MySQL 5.6 PerformanceMySQL 5.6 Performance
MySQL 5.6 Performance
 
MySQL Performance Tuning - GNUnify 2010
MySQL Performance Tuning - GNUnify 2010MySQL Performance Tuning - GNUnify 2010
MySQL Performance Tuning - GNUnify 2010
 
Percona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient BackupsPercona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient Backups
 
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
 
MySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summaryMySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summary
 
Designing enterprise drupal
Designing enterprise drupalDesigning enterprise drupal
Designing enterprise drupal
 
MyDUMPER : Faster logical backups and restores
MyDUMPER : Faster logical backups and restores MyDUMPER : Faster logical backups and restores
MyDUMPER : Faster logical backups and restores
 
MySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware companyMySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware company
 
InnoDB Cluster Experience (MySQL User Camp)
InnoDB Cluster Experience (MySQL User Camp)InnoDB Cluster Experience (MySQL User Camp)
InnoDB Cluster Experience (MySQL User Camp)
 
MySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery PlanningMySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery Planning
 
MySQL 5.6 config 優化
MySQL 5.6 config 優化MySQL 5.6 config 優化
MySQL 5.6 config 優化
 
MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바
 
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
 

Viewers also liked

MySQL Server Settings Tuning
MySQL Server Settings TuningMySQL Server Settings Tuning
MySQL Server Settings Tuning
guest5ca94b
 
MySQL Performance Tuning
MySQL Performance TuningMySQL Performance Tuning
MySQL Performance Tuning
FromDual GmbH
 
MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6
MYXPLAIN
 

Viewers also liked (20)

MySQL Tokudb engine benchmark
MySQL Tokudb engine benchmarkMySQL Tokudb engine benchmark
MySQL Tokudb engine benchmark
 
Storage Methods for Nonstandard Data Patterns
Storage Methods for Nonstandard Data PatternsStorage Methods for Nonstandard Data Patterns
Storage Methods for Nonstandard Data Patterns
 
Visualizing Data in Elasticsearch DevFest DC 2016
Visualizing Data in Elasticsearch DevFest DC 2016Visualizing Data in Elasticsearch DevFest DC 2016
Visualizing Data in Elasticsearch DevFest DC 2016
 
TokuDB 高科扩展性 MySQL 和 MariaDB 数据库
TokuDB 高科扩展性 MySQL 和 MariaDB 数据库TokuDB 高科扩展性 MySQL 和 MariaDB 数据库
TokuDB 高科扩展性 MySQL 和 MariaDB 数据库
 
TokuDB - What You Need to Know
TokuDB - What You Need to KnowTokuDB - What You Need to Know
TokuDB - What You Need to Know
 
MySQL 5.5 Guide to InnoDB Status
MySQL 5.5 Guide to InnoDB StatusMySQL 5.5 Guide to InnoDB Status
MySQL 5.5 Guide to InnoDB Status
 
浅析My sql事务隔离级别与锁 seanlook
浅析My sql事务隔离级别与锁 seanlook浅析My sql事务隔离级别与锁 seanlook
浅析My sql事务隔离级别与锁 seanlook
 
MySQL Server Settings Tuning
MySQL Server Settings TuningMySQL Server Settings Tuning
MySQL Server Settings Tuning
 
Performance Tuning
Performance TuningPerformance Tuning
Performance Tuning
 
MySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerMySQL Performance Tuning für Entwickler
MySQL Performance Tuning für Entwickler
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
 
MySQL Performance Tuning
MySQL Performance TuningMySQL Performance Tuning
MySQL Performance Tuning
 
Webinar 2013 advanced_query_tuning
Webinar 2013 advanced_query_tuningWebinar 2013 advanced_query_tuning
Webinar 2013 advanced_query_tuning
 
Join-fu: The Art of SQL Tuning for MySQL
Join-fu: The Art of SQL Tuning for MySQLJoin-fu: The Art of SQL Tuning for MySQL
Join-fu: The Art of SQL Tuning for MySQL
 
MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6
 
MySQL查询优化浅析
MySQL查询优化浅析MySQL查询优化浅析
MySQL查询优化浅析
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
 
MySQL Performance Tips & Best Practices
MySQL Performance Tips & Best PracticesMySQL Performance Tips & Best Practices
MySQL Performance Tips & Best Practices
 
Mysql Explain Explained
Mysql Explain ExplainedMysql Explain Explained
Mysql Explain Explained
 
MySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsMySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 Tips
 

Similar to MySQL Performance Tuning Variables

Ukoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dbaUkoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dba
orablue11
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
Lenz Grimmer
 
Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02
Louis liu
 

Similar to MySQL Performance Tuning Variables (20)

MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
MySQL configuration - The most important Variables
MySQL configuration - The most important VariablesMySQL configuration - The most important Variables
MySQL configuration - The most important Variables
 
MySQL database
MySQL databaseMySQL database
MySQL database
 
Collaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAsCollaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAs
 
Ukoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dbaUkoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dba
 
MySQL DBA
MySQL DBAMySQL DBA
MySQL DBA
 
MariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin Frankfurt
MariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin FrankfurtMariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin Frankfurt
MariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin Frankfurt
 
MariaDB 10 and Beyond
MariaDB 10 and BeyondMariaDB 10 and Beyond
MariaDB 10 and Beyond
 
PL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptxPL22 - Backup and Restore Performance.pptx
PL22 - Backup and Restore Performance.pptx
 
Loadays MySQL
Loadays MySQLLoadays MySQL
Loadays MySQL
 
MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014
MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014
MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014
 
Upgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtimeUpgrade to MySQL 5.6 without downtime
Upgrade to MySQL 5.6 without downtime
 
Collaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAsCollaborate 2012 - Administering MySQL for Oracle DBAs
Collaborate 2012 - Administering MySQL for Oracle DBAs
 
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimization
 
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimization
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
 
Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02
 
MySQL and MariaDB Backups
MySQL and MariaDB BackupsMySQL and MariaDB Backups
MySQL and MariaDB Backups
 
The Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL DatabasesThe Proper Care and Feeding of MySQL Databases
The Proper Care and Feeding of MySQL Databases
 

More from FromDual GmbH

More from FromDual GmbH (20)

MariaDB/MySQL pitfalls - And how to come out again...
MariaDB/MySQL pitfalls - And how to come out again...MariaDB/MySQL pitfalls - And how to come out again...
MariaDB/MySQL pitfalls - And how to come out again...
 
MariaDB / MySQL tripping hazard and how to get out again?
MariaDB / MySQL tripping hazard and how to get out again?MariaDB / MySQL tripping hazard and how to get out again?
MariaDB / MySQL tripping hazard and how to get out again?
 
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration WorkshopPXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
 
IT Tage 2019 MariaDB 10.4 New Features
IT Tage 2019 MariaDB 10.4 New FeaturesIT Tage 2019 MariaDB 10.4 New Features
IT Tage 2019 MariaDB 10.4 New Features
 
MariaDB 10.4 New Features
MariaDB 10.4 New FeaturesMariaDB 10.4 New Features
MariaDB 10.4 New Features
 
MariaDB 10.2 New Features
MariaDB 10.2 New FeaturesMariaDB 10.2 New Features
MariaDB 10.2 New Features
 
PERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schemaPERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schema
 
MySQL für Oracle DBA's
MySQL für Oracle DBA'sMySQL für Oracle DBA's
MySQL für Oracle DBA's
 
MySQL Backup/Recovery
MySQL Backup/RecoveryMySQL Backup/Recovery
MySQL Backup/Recovery
 
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
 
MySQL-Server im Teamwork - Replikation und Cluster
MySQL-Server im Teamwork - Replikation und ClusterMySQL-Server im Teamwork - Replikation und Cluster
MySQL-Server im Teamwork - Replikation und Cluster
 
Der Datenbank-Backup ist gemacht - was nun?
Der Datenbank-Backup ist gemacht - was nun?Der Datenbank-Backup ist gemacht - was nun?
Der Datenbank-Backup ist gemacht - was nun?
 
Weltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-ReplikationWeltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-Replikation
 
MySQL Performance Tuning für Oracle-DBA's
MySQL Performance Tuning für Oracle-DBA'sMySQL Performance Tuning für Oracle-DBA's
MySQL Performance Tuning für Oracle-DBA's
 
MySQL Security SLAC 2015
MySQL Security SLAC 2015MySQL Security SLAC 2015
MySQL Security SLAC 2015
 
MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?
 
Reading MySQL fingerprints
Reading MySQL fingerprintsReading MySQL fingerprints
Reading MySQL fingerprints
 
High-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLHigh-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQL
 
MySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterMySQL always-up with Galera Cluster
MySQL always-up with Galera Cluster
 
HA with Galera
HA with GaleraHA with Galera
HA with Galera
 

Recently uploaded

Recently uploaded (20)

Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 

MySQL Performance Tuning Variables

  • 1. www.fromdual.com 1 / 24 MySQL Performance Tuning DOAG 2013 Datenbank 14. Mai 2013, Düsseldorf Oli Sennhauser Senior MySQL Berater, FromDual GmbH oli.sennhauser@fromdual.com
  • 2. www.fromdual.com 2 / 24 Über FromDual GmbH ● FromDual bietet neutral und unabhängig: ● Beratung für MySQL ● Support für MySQL und Galera Cluster ● Remote-DBA Dienstleistungen für MySQL ● MySQL Schulungen ● Oracle Silver Partner (OPN) www.fromdual.com
  • 3. www.fromdual.com 3 / 24 Inhalt HA Solutions ➢ Read scale-out ➢ Replication set-up for HA ➢ Active/passive fail-over ➢ MySQL Cluster ➢ Replication Cluster ➢ Storage-Engine-Replication MySQL Performance Tuning mit System-Variablen ➢ Performance Tuning Hebel ➢ MySQL System Variablen ➢ MySQL Status Variablen ➢ MySQL Architektur ➢ Speicherbelegung ➢ Session Variablen ➢ Globale Variablen ➢ MyISAM Variablen ➢ InnoDB Variablen ➢ Monitoring ➢ Informationen
  • 5. www.fromdual.com 5 / 24 MySQL System Variablen ● Datenbank-Konfiguration my.cnf mysqld ­­help –verbose /etc/my.cnf /etc/mysql/my.cnf  /usr/local/mysql/etc/my.cnf  $basedir/my.cnf ~/.my.cnf SHOW GLOBAL VARIABLES;
  • 6. www.fromdual.com 6 / 24 MySQL Status Variablen ● Was wir damit anrichten sieht man mit: SHOW /*!50001 GLOBAL */ STATUS; SHOW ENGINE INNODB STATUSG
  • 7. www.fromdual.com 7 / 24 MySQL Architektur mysqld Application / Client Thread Cache Connection Manager User Au- thentication Command Dispatcher Logging Query Cache Module Query Cache Parser Optimizer Access Control Table Manager Table Open Cache (.frm, fh) Table Definition Cache (tbl def.) Handler Interface MyISAM Memory NDB PBXTInnoDB ...Aria XtraDB Tokutek
  • 8. www.fromdual.com 8 / 24 Speicherbelegung Storage Engines MySQL Server (mysqld) Client 2 Client N Local Memory Areas Client 1 read_buffer sort_buffer tmp_table read_bufferread_buffer sort_buffer table_open_cache table_definition_cache query_cache_size etc... Global Memory Area key_buffer_size innodb_buffer_pool_size innodb_log_buffer_size etc...
  • 9. www.fromdual.com 9 / 24 Thread Cache ● Konifguration: thread_cache_size ● Status: threads_created +­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+ | Variable_name        | Value | +­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+ | Threads_cached       | 8     | | Threads_connected    | 242   | | Threads_created      | 15355 | | Threads_running      | 16    | +­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
  • 10. www.fromdual.com 10 / 24 Query Cache ● Konfiguration: query_cache_size ● Status: Com_select, Qcache_hits ● Hit ratio: Qache_hits/(Com_select + Qcache_hits) +­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+ | Variable_name           | Value    | +­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+ | Com_select              | 25712    | | Qcache_free_memory      | 19553200 | | Qcache_hits             | 65137    | | Qcache_inserts          | 172167   | +­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­+
  • 11. www.fromdual.com 11 / 24 Per Session Parameter ● Im „Executor“ ● Alloziert/Dealloziert „on Demand“ ● Per Session oder global einstellbar ● Meisst Effekt gering oder gar kontraproduktiv! ● Join Buffer ● join_buffer_size ● Read Buffer und Read Random Buffer ● read_buffer_size, read_rnd_buffer_size
  • 12. www.fromdual.com 12 / 24 Sort Buffer, temporäre Tabellen ● Temporäre Tabellen (MEMORY oder MyISAM) ● Konfiguration: tmp_table_size, (max_heap_table_size) ● Status: created_tmp_tables, created_tmp_disk_tables ● Sort Buffer ● Konfiguration: sort_buffer_size ● Status: sort_merge_passes
  • 13. www.fromdual.com 13 / 24 Table Definition Cache ● Ab v5.1 ● Enthält Info vom .frm File ● Konfiguration: table_definition_cache ● Status: open_table_definitions,  opened_table_defintions +­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+ | Variable_name            | Value | +­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+ | Open_table_definitions   | 100   | | Opened_table_definitions | 100   | +­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
  • 14. www.fromdual.com 14 / 24 Table (Open) Cache ● Ab v5.1 ● File-Descriptioren (1 pro Connection pro Table) ● Früher table_cache ● Konfiguration: table_open_cache ● Status: open_tables, opened_tables +­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+ | Variable_name            | Value | +­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+ | Open_tables              | 64    | | Opened_tables            | 11812 | +­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
  • 15. www.fromdual.com 15 / 24 MyISAM ● Bis MySQL 5.1 default Storage Engine ● Konfiguration: key_buffer_size ● Status: Key_blocks_used,  Key_blocks_unused, Key_reads,  Key_read_requests
  • 16. www.fromdual.com 16 / 24 InnoDB Buffer Pool ● InnoDB seit 5.5 default Storage Engine ● InnoDB Buffer Pool ● Konfiguration: innodb_buffer_pool_size, innodb_buffer_pool_instances, innodb_io_capacity mysqld system table space: ibdata1 table table space table table spacetable table space ib_logfile1ib_logfile2ib_logfilen undo double write area tables/indexes dd OS file cache sync async buffer pool secondary index buffer trxlogbuffer data pages index pages adaptive hash idx undo records lock info table
  • 17. www.fromdual.com 17 / 24 InnoDB Buffer Pool ● Status: innodb_buffer_pool_pages_%,  Innodb_buffer_bytes_%, Innodb_data_%
  • 18. www.fromdual.com 18 / 24 InnoDB Log File ● REDO Log, Transaction Log ● Konfiguration: innodb_log_file_size,  innodb_flush_log_at_trx _commit ● Status: innodb%log% mysqld system table space: ibdata1 table table space table table spacetable table space ib_logfile1ib_logfile2ib_logfilen undo double write area tables/indexes dd OS file cache sync async buffer pool secondary index buffer trxlogbuffer data pages index pages adaptive hash idx undo records lock info table
  • 19. www.fromdual.com 19 / 24 Binary Log Application ApplicationApplication mysqld bin-log.n binlog_cache_size binlog_stmt_cache_size sync_binlog +­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+ | Variable_name              | Value | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+ | Binlog_cache_disk_use      | 3456  | | Binlog_cache_use           | 12786 | | Binlog_stmt_cache_disk_use | 0     | | Binlog_stmt_cache_use      | 0     | +­­­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­+
  • 20. www.fromdual.com 20 / 24 Monitoring ● Von Hand: ● SHOW GLOBAL STATUS; ● SHOW ENGINE INNODB STATUSG ● Performance Schema (P_S, >= v5.5) ● Irgend ein graphisches Monitoring Tool...
  • 21. www.fromdual.com 21 / 24 PERFORMANCE_SCHEMA ● In Diskussion seit mindestens 2006 ● Eingeführt in MySQL 5.5 (2010) → Einblick in die Datenbank ● In v5.5 disabled, in v5.6 enabled per default performance_schema = 1 ● Overhead 5% - 200%! → also Vorsicht!
  • 22. www.fromdual.com 22 / 24 Beispiel: Table I/O waits SELECT OBJECT_SCHEMA, OBJECT_NAME      , ROUND(SUM_TIMER_WAIT/1000000000, 3) AS SUM_TIMER_WAIT      , ROUND(SUM_TIMER_READ/1000000000, 3) AS SUM_TIMER_READ      , ROUND(SUM_TIMER_WRITE/1000000000, 3) AS SUM_TIMER_WRITE   FROM table_io_waits_summary_by_table  ORDER BY SUM_TIMER_WAIT DESC  LIMIT 10 ; +­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­+ | OBJECT_SCHEMA | OBJECT_NAME  | SUM_TIMER_WAIT | SUM_TIMER_READ | SUM_TIMER_WRITE | +­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­+ | zabbix        | items        |    1182496.258 |     616630.696 |      565865.562 | | zabbix        | history_uint |     889884.116 |     370528.991 |      519355.125 | | zabbix        | history_str  |     460411.155 |     246159.458 |      214251.697 | | zabbix        | history      |     389815.659 |      86285.980 |      303529.679 | | zabbix        | trends_uint  |     133955.560 |     107365.626 |       26589.934 | | zabbix        | functions    |     128657.654 |     128657.654 |           0.000 | | zabbix        | trends       |      43683.159 |      36314.732 |        7368.428 | | mpm           | mpm_agent    |      27837.056 |      27837.056 |           0.000 | | zabbix        | hosts        |      23820.284 |      14044.672 |        9775.612 | | zabbix        | triggers     |      21052.459 |      20970.604 |          81.855 | +­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­+
  • 23. www.fromdual.com 23 / 24 Informationen ● MySQL System Variablen: http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html ● MySQL Status Variablen: http://dev.mysql.com/doc/refman/5.5/en/server-status-variables.html ● MySQL DB Health Check: http://www.fromdual.com/mysql-database-health-check ● MySQL Performance Monitor: http://www.fromdual.com/mysql-performance-monitor
  • 24. www.fromdual.com 24 / 24 Q & A Fragen ? Diskussion? Wir haben Zeit für ein Performance Audit...! ● FromDual bietet neutral und unabhängig: ● Beratung ● Remote-DBA ● Support für MySQL und Galera Cluster ● Schulung www.fromdual.com/presentations