SlideShare a Scribd company logo
1 of 33
Download to read offline
Practical MySQL Tuning

UKOUG Conference 2011
          th
December 5 , Birmingham

      Oli Sennhauser
  Senior MySQL Consultant, FromDual

 oli.sennhauser@fromdual.com

            www.fromdual.com          1
FromDual
●   FromDual provides neutral and independent:
    ●  Consulting for MySQL (on-site and remote)
     ● Remote-DBA / MySQL operations


     ● Support for Galera (synchronous MySQL Replication)


     ● Support for MySQL (Basic and Silver)


     ● Training for MySQL


●   Consulting Partner of Open Database Alliance
    (ODBA.org)
●   Oracle Silver Partner (OPN)
●   More information at: www.fromdual.com

                          www.fromdual.com                  2
Our customer




               www.fromdual.com   3
Content
●   FromDual Performance Balance
●   Critical Resources
●   Hardware / OS
●   Database parameter
●   Application-Tuning
●   Architecture & Design
●   Measuring

                    www.fromdual.com   4
The FromDual way of PT
●   Whom of you has or had Performance
    problems with MySQL?
●   Whom of you has a systematic way for
    Performance Tuning?


    → Many roads lead to Rome!

●   Starting point: Customer cries because he
    has a Performance Problem!
                     www.fromdual.com           5
FromDual Performance Balance
Collecting facts
●   How does the problem look like?
    ● DB is suddenly, sometimes or since ever slow?
    ● What exactly is slow?


    ● New version was released?


    ● Somebody has tinkered around?


    ● We are short before going live and still much too slow?


●   Have we historical performance data?
●   Best case if:
    You can (at will) simulate the problem
    ●


  ● Predict the problem or if it happens periodic.


→ Find the pattern!
                           www.fromdual.com                     7
Critical resources
     Hardware

         OS



     www.fromdual.com   8
Critical resources
●   Find the bottle-neck / the limiting resource:

●   Fortunately „only“:
    ●   CPU
    ●   Memory (RAM)
    ●   I/O (IOPS, throughput)
    ●   Network (FpS, throughput)

●   But how? → find the critical resource!
                       www.fromdual.com             9
Measure: CPU
●   top


●   vmstat




●   or mpstat
●   Which process is using CPU?
                   www.fromdual.com   10
Measure: Memory (RAM)
●   free / top:
           #free
                        total   used    free shared buffers cached
           Mem:       1036016 983864   52152      0   35484 547432
           ­/+ buffers/cache: 400948  635068
           swap:      4202112  96148 4105964



●   ps
           # ps ­eo user,pid,%cpu,%mem,vsz,rsz,comm ­­sort ­vsz | 
            egrep 'mysql|COMMAND'
           USER       PID %CPU %MEM    VSZ   RSZ COMMAND
           mysql     1361  0.0  1.5 108368 16444 mysqld
           mysql     1210  0.0  0.1   4536  1956 bash
           mysql     1289  0.0  0.1   4060  1444 safe_mysqld
           mysql     1204  0.0  0.1   4048  1404 su


                          www.fromdual.com                            11
Measure: I/O
●   vmstat                     # vmstat 1
                               procs ­­­swap­­ ­­­­­io­­­­ ­­­­cpu­­­­
                                r  b   si   so    bi    bo us sy id wa
                                0  0    3    3    94   143 21 21 56  2
                                0  0    0    0     0     4  9 37 54  0



●   iostat (→ sysstat package)
              # iostat ­x 1
              avg­cpu:  %user   %nice %system %iowait  %steal   %idle
                         5.88    0.00   34.31    2.94    0.00   56.86

              Device:     r/s   w/s  rkB/s  wkB/s  await  svctm  %util
              hda        0.00  0.00   0.00   0.00   0.00   0.00   0.00
              hdc        0.00  2.94   0.00  23.53  14.67  12.00   3.53


●   pidstat
                           www.fromdual.com                             12
Measure: Network
●   dstat




●   watch ­d ­n 1 'ifconfig'


●   Frames per second (80k – 1.5M) /
    throughput (1 Gbit/s → 120 Mbyte/s)?
                    www.fromdual.com       13
Summary
●   CPU                             ●   I/O
    ●   Which process                   ●   Throughput or IOPS
                                        ●   which device?
    ●   How many cores?
                                        ●   Random or sequential I/O
        → often SQL queries
                                        ●   Read or write
●   Memory                                  → Caches to small, tmp
    ●   Which process                       tables?
    ●   Swapping?
                                    ●   Network
        → Over- or Under-
        allocating of DB caches!        ●   Errors / Drops?
                                        ●   Throughput
                                        ●   FpS
                           www.fromdual.com                            14
Set screws
●   CPU                                  ●   Network
    ●   Faster cores?                        ●    1 Gbit
    ●   More Cores

●   Memory                               ●   OS
    ●   More RAM?                            ●    New 64-bit kernel
                                             ●    XFS
●   I/O                                      ●    → I/O Scheduler
    ●   RAID-5 :-(
                                                   –   noop
    ●   SAN :-(                                    –   Deadline
    ●   RAID-10, many spindles, SSD?
    ●   Battery buffered I/O cache!
                                         ●   Virtualization :-(
                               www.fromdual.com                       15
Database Tuning




    www.fromdual.com   16
MySQL Tuning
●   Which Storage Engine are you using at the
    moment?
●   Which MySQL version? (→ 5.1 and newer)
●   At the moment: about 330 MySQL parameter
      → but only 8 (9) of those are primarily
      significant!
      → Rough-Tuning
●   All other parameters only after detailed
    benchmarking...
      → Fine-Tuning
                        www.fromdual.com        17
InnoDB Rough-Tuning
●   innodb_buffer_pool_size
    ●   about 80% of RAM on a dedicated server
    ●   SHOW STATUS LIKE 
        'Innodb_buffer_pool_pages%';
●   innodb_log_file_size
    ● Big = faster, but longer recovery times → 2 x 256 M
●   innodb_flush_log_at_trx_commit
    ● 0, 2 for top performance, 1 for reliability
●   sync_binlog
    ●   != 0 → often very slow
                           www.fromdual.com                 18
MySQL Rough-Tuning
●   key_buffer_size
    ●   about 25 – 33% of RAM on dedicated machine
    ●   SHOW STATUS LIKE 'Key_blocks_%';
●   table_open_cache
    ●   Running connections x used tables → 2 – 4k is not unusable!
        See Open[ed]_tables.
●   table_definition_cache
    ● See Open[ed]_table_definitions → 512 – 4096 is not
      unusable!
●   query_cache_type/query_cache_size
    ●   Do not make too big (<= 128 M), bad for very high
        concurrency!
                               www.fromdual.com                   19
Further aid
●   How to measure?
    ●   SHOW GLOBAL STATUS;
    ●   SHOW ENGINE INNODB STATUSG
●   ca. 330 variables
●   ca. 310 Status informations
●   MySQL Database Health Check:
        http://www.fromdual.com/mysql-database-health-check
●   MySQL Docu, Server Status Variables:
        http://dev.mysql.com/doc/refman/5.5/en/server-status-variables.html
●   That's it, so far...! :)

                                  www.fromdual.com                            20
Application-Tuning




     www.fromdual.com   21
Application-Tuning
●   Index Tuning
    ● Primary Key (InnoDB) → Length of secondary indices!
    ● Remove (partial) redundant Indices


    ● Remove Indices with a low cardinality!?!


●   Query Tuning
    ●   SHOW PROCESSLIST;
    ●   Slow Query Log (since 5.1 dynamically)
    ●   log_queries_not_using_indexes = 1
    ●   mysqldumpslow ­s t slow.log > slow.log.profile
    ●   EXPLAIN SELECT ...


                             www.fromdual.com               22
EXPLAIN
●    Is the key to the truth
●    Query Tuning: x times faster is possible!

    EXPLAIN SELECT * FROM test where name = 'Oli';

    +­­­­+­­­­­­­­­­­­­+­­­­­­­+­­­­­­+­­­­­­­­­­­­­­­+­­­­­­+­­­­­­­­­+­­­­­­+­­­­­­­­+­­­­­­­+
    | id | select_type | table | type | possible_keys | key  | key_len | ref  | rows   | Extra |
    +­­­­+­­­­­­­­­­­­­+­­­­­­­+­­­­­­+­­­­­­­­­­­­­­­+­­­­­­+­­­­­­­­­+­­­­­­+­­­­­­­­+­­­­­­­+
    |  1 | SIMPLE      | test  | ALL  | last          | NULL | NULL    | NULL | 261369 |       |
    +­­­­+­­­­­­­­­­­­­+­­­­­­­+­­­­­­+­­­­­­­­­­­­­­­+­­­­­­+­­­­­­­­­+­­­­­­+­­­­­­­­+­­­­­­­+




●    EXPLAIN Output Format:
     http://dev.mysql.com/doc/refman/5.5/en/explain-output.html
                                         www.fromdual.com                                          23
Application-Tuning
●   Let it go!
    ●   Remove columns which are not used (or char(0) or fill with NULL)!
    ● Old data → delete (archive, swap out)!
●   Schema Tuning
    ●   mysqldump ­­no­data > structure_dump.sql
    ●   Right data types and right length!
          int(1) → 4 byte int!
    ●   utf8 → only when needed
    ●   NULL or NOT NULL
●   Locality of the data
    ●   InnoDB Primary Key
    ●   V-Partitioning / (H-)Partitioning

                                    www.fromdual.com                    24
Architecture & Design




      www.fromdual.com   25
MySQL Scale-Out vs Scale-Up

         ● Costs
                              Scale-Up
         ● MySQL Design

         ● Physical bottle-necks




     ●   „Relaxation of Constraints“
                                Scale-Out

                         www.fromdual.com   26
The MySQL Scale-Out approach

                        Application
                  ro
                                 rtw
                                              Slave Reporting
                            Master

                                                  Slave Backup

     Slave 1      Slave 2         Slave 3
                                            ...


               Load balancer




                       www.fromdual.com                          27
Architectonic possibilities
●   RDBMS are a slow technology!
    ● Hence: Cache (hot data into a cache!)
    ● MySQL Memcached Plugin / Memcached


    ● HandlerSocket


    ● MySQL Cluster


●   Abstraction layers (ORM, Frameworks, etc.)
    ● Fast development process but
    ● Standard == „non optimized“ → bad for performance!


●   BLOB's are bad for RDBMS
    ● Put on a filer
    ● Blob Streaming (PBMS)


●   Sharding / distributing
    ●   manually
    ●   Spider SE
    ●   MySQL Replication (r/w Traffic Split)
    ●   MySQL Cluster
    ●   Synchronous Replication with Galera

                                            www.fromdual.com   28
Monitoring




 www.fromdual.com   29
What happens, if...?
●   Customer asks: Can my system bear 30%
    more load?
●   Chemical Engineering:




●   Are there differences to a DB based system?
●   What do I need to answer this question?

                     www.fromdual.com             30
Measure, measure, measure...
●   Measure
●   Simulate → Capacity planning




                    www.fromdual.com   31
The circle closes...
●   In ideal case: Only ONE
    change at a time!




                        www.fromdual.com   32
Q&A


                 Questions ?

                 Discussion ?


 We have some time for face to face questions...



                    www.fromdual.com               33

More Related Content

What's hot

Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingSveta Smirnova
 
Moving to the NoSQL side: MySQL JSON functions
 Moving to the NoSQL side: MySQL JSON functions Moving to the NoSQL side: MySQL JSON functions
Moving to the NoSQL side: MySQL JSON functionsSveta Smirnova
 
MySQL Performance Schema in Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in ActionSveta Smirnova
 
New features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionNew features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionSveta Smirnova
 
Preparse Query Rewrite Plugins
Preparse Query Rewrite PluginsPreparse Query Rewrite Plugins
Preparse Query Rewrite PluginsSveta Smirnova
 
Basic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsBasic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsSveta Smirnova
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf TuningHighLoad2009
 
Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Valeriy Kravchuk
 
MariaDB Optimizer
MariaDB OptimizerMariaDB Optimizer
MariaDB OptimizerJongJin Lee
 
Capturing, Analyzing, and Optimizing your SQL
Capturing, Analyzing, and Optimizing your SQLCapturing, Analyzing, and Optimizing your SQL
Capturing, Analyzing, and Optimizing your SQLPadraig O'Sullivan
 
Summary tables with flexviews
Summary tables with flexviewsSummary tables with flexviews
Summary tables with flexviewsJustin Swanhart
 
2008 Collaborate IOUG Presentation
2008 Collaborate IOUG Presentation2008 Collaborate IOUG Presentation
2008 Collaborate IOUG PresentationBiju Thomas
 
10x Performance Improvements
10x Performance Improvements10x Performance Improvements
10x Performance ImprovementsRonald Bradford
 
Optimizer Cost Model MySQL 5.7
Optimizer Cost Model MySQL 5.7Optimizer Cost Model MySQL 5.7
Optimizer Cost Model MySQL 5.7I Goo Lee
 
Mysql 56-experiences-bugs-solutions-50mins
Mysql 56-experiences-bugs-solutions-50minsMysql 56-experiences-bugs-solutions-50mins
Mysql 56-experiences-bugs-solutions-50minsValeriy Kravchuk
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation2009 Collaborate IOUG Presentation
2009 Collaborate IOUG PresentationBiju Thomas
 
MySQL sys schema deep dive
MySQL sys schema deep diveMySQL sys schema deep dive
MySQL sys schema deep diveMark Leith
 
Meb Backup & Recovery Performance
Meb Backup & Recovery PerformanceMeb Backup & Recovery Performance
Meb Backup & Recovery PerformanceKeith Hollman
 

What's hot (20)

Performance Schema for MySQL Troubleshooting
Performance Schema for MySQL TroubleshootingPerformance Schema for MySQL Troubleshooting
Performance Schema for MySQL Troubleshooting
 
Moving to the NoSQL side: MySQL JSON functions
 Moving to the NoSQL side: MySQL JSON functions Moving to the NoSQL side: MySQL JSON functions
Moving to the NoSQL side: MySQL JSON functions
 
MySQL Performance Schema in Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in Action
 
New features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionNew features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in action
 
Preparse Query Rewrite Plugins
Preparse Query Rewrite PluginsPreparse Query Rewrite Plugins
Preparse Query Rewrite Plugins
 
Basic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAsBasic MySQL Troubleshooting for Oracle DBAs
Basic MySQL Troubleshooting for Oracle DBAs
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf Tuning
 
Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013
 
MariaDB Optimizer
MariaDB OptimizerMariaDB Optimizer
MariaDB Optimizer
 
Capturing, Analyzing, and Optimizing your SQL
Capturing, Analyzing, and Optimizing your SQLCapturing, Analyzing, and Optimizing your SQL
Capturing, Analyzing, and Optimizing your SQL
 
Summary tables with flexviews
Summary tables with flexviewsSummary tables with flexviews
Summary tables with flexviews
 
2008 Collaborate IOUG Presentation
2008 Collaborate IOUG Presentation2008 Collaborate IOUG Presentation
2008 Collaborate IOUG Presentation
 
10x Performance Improvements
10x Performance Improvements10x Performance Improvements
10x Performance Improvements
 
Optimizer Cost Model MySQL 5.7
Optimizer Cost Model MySQL 5.7Optimizer Cost Model MySQL 5.7
Optimizer Cost Model MySQL 5.7
 
Mysql 56-experiences-bugs-solutions-50mins
Mysql 56-experiences-bugs-solutions-50minsMysql 56-experiences-bugs-solutions-50mins
Mysql 56-experiences-bugs-solutions-50mins
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
My sql administration
My sql administrationMy sql administration
My sql administration
 
2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation
 
MySQL sys schema deep dive
MySQL sys schema deep diveMySQL sys schema deep dive
MySQL sys schema deep dive
 
Meb Backup & Recovery Performance
Meb Backup & Recovery PerformanceMeb Backup & Recovery Performance
Meb Backup & Recovery Performance
 

Viewers also liked

WordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessWordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessAnthony Somerset
 
170 Radio Stations :: WordPress at Scale
170 Radio Stations :: WordPress at Scale170 Radio Stations :: WordPress at Scale
170 Radio Stations :: WordPress at ScalePeter Chester
 
Scaling WooCommerce on WP Engine
Scaling WooCommerce on WP EngineScaling WooCommerce on WP Engine
Scaling WooCommerce on WP EngineEdmund Turbin
 
Conference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance TuningConference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance TuningSeveralnines
 
Understanding MySQL Performance through Benchmarking
Understanding MySQL Performance through BenchmarkingUnderstanding MySQL Performance through Benchmarking
Understanding MySQL Performance through BenchmarkingLaine Campbell
 
MySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsMySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsOSSCube
 
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)Aurimas Mikalauskas
 

Viewers also liked (10)

WordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessWordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = Success
 
Enterprise-Scale WordPress
Enterprise-Scale WordPressEnterprise-Scale WordPress
Enterprise-Scale WordPress
 
170 Radio Stations :: WordPress at Scale
170 Radio Stations :: WordPress at Scale170 Radio Stations :: WordPress at Scale
170 Radio Stations :: WordPress at Scale
 
Scaling WooCommerce on WP Engine
Scaling WooCommerce on WP EngineScaling WooCommerce on WP Engine
Scaling WooCommerce on WP Engine
 
routrr
routrrroutrr
routrr
 
Conference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance TuningConference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance Tuning
 
Understanding MySQL Performance through Benchmarking
Understanding MySQL Performance through BenchmarkingUnderstanding MySQL Performance through Benchmarking
Understanding MySQL Performance through Benchmarking
 
MySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsMySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 Tips
 
MySQL Tuning
MySQL TuningMySQL Tuning
MySQL Tuning
 
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
MySQL Performance Tuning. Part 1: MySQL Configuration (includes MySQL 5.7)
 

Similar to UKOUG 2011: Practical MySQL Tuning

Open Source Data Deduplication
Open Source Data DeduplicationOpen Source Data Deduplication
Open Source Data DeduplicationRedWireServices
 
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 MySQLFromDual GmbH
 
Buytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerBuytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerkuchinskaya
 
MySQL configuration - The most important Variables
MySQL configuration - The most important VariablesMySQL configuration - The most important Variables
MySQL configuration - The most important VariablesFromDual GmbH
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability SolutionsLenz Grimmer
 
Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02Louis liu
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability SolutionsLenz Grimmer
 
Fosdem2012 mariadb-5.3-query-optimizer-r2
Fosdem2012 mariadb-5.3-query-optimizer-r2Fosdem2012 mariadb-5.3-query-optimizer-r2
Fosdem2012 mariadb-5.3-query-optimizer-r2Sergey Petrunya
 
MySQL Cluster (NDB) - Best Practices Percona Live 2017
MySQL Cluster (NDB) - Best Practices Percona Live 2017MySQL Cluster (NDB) - Best Practices Percona Live 2017
MySQL Cluster (NDB) - Best Practices Percona Live 2017Severalnines
 
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?FromDual GmbH
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialJean-François Gagné
 
Linux-HA with Pacemaker
Linux-HA with PacemakerLinux-HA with Pacemaker
Linux-HA with PacemakerKris Buytaert
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsFromDual GmbH
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadKrivoy Rog IT Community
 
Screaming Fast Wpmu
Screaming Fast WpmuScreaming Fast Wpmu
Screaming Fast Wpmudjcp
 
Shared Database Concurrency
Shared Database ConcurrencyShared Database Concurrency
Shared Database ConcurrencyAivars Kalvans
 

Similar to UKOUG 2011: Practical MySQL Tuning (20)

NoSQL with MySQL
NoSQL with MySQLNoSQL with MySQL
NoSQL with MySQL
 
Open Source Data Deduplication
Open Source Data DeduplicationOpen Source Data Deduplication
Open Source Data Deduplication
 
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
 
Buytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerBuytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemaker
 
MySQL configuration - The most important Variables
MySQL configuration - The most important VariablesMySQL configuration - The most important Variables
MySQL configuration - The most important Variables
 
Shootout at the PAAS Corral
Shootout at the PAAS CorralShootout at the PAAS Corral
Shootout at the PAAS Corral
 
The Accidental DBA
The Accidental DBAThe Accidental DBA
The Accidental DBA
 
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 High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
 
Fosdem2012 mariadb-5.3-query-optimizer-r2
Fosdem2012 mariadb-5.3-query-optimizer-r2Fosdem2012 mariadb-5.3-query-optimizer-r2
Fosdem2012 mariadb-5.3-query-optimizer-r2
 
MySQL Cluster (NDB) - Best Practices Percona Live 2017
MySQL Cluster (NDB) - Best Practices Percona Live 2017MySQL Cluster (NDB) - Best Practices Percona Live 2017
MySQL Cluster (NDB) - Best Practices Percona Live 2017
 
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?
 
Kvm optimizations
Kvm optimizationsKvm optimizations
Kvm optimizations
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
 
Linux-HA with Pacemaker
Linux-HA with PacemakerLinux-HA with Pacemaker
Linux-HA with Pacemaker
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
 
Screaming Fast Wpmu
Screaming Fast WpmuScreaming Fast Wpmu
Screaming Fast Wpmu
 
Shared Database Concurrency
Shared Database ConcurrencyShared Database Concurrency
Shared Database Concurrency
 

More from FromDual GmbH

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...FromDual GmbH
 
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 WorkshopFromDual GmbH
 
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 FeaturesFromDual GmbH
 
MariaDB 10.4 New Features
MariaDB 10.4 New FeaturesMariaDB 10.4 New Features
MariaDB 10.4 New FeaturesFromDual GmbH
 
MariaDB 10.2 New Features
MariaDB 10.2 New FeaturesMariaDB 10.2 New Features
MariaDB 10.2 New FeaturesFromDual GmbH
 
PERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schemaPERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schemaFromDual GmbH
 
MySQL für Oracle DBA's
MySQL für Oracle DBA'sMySQL für Oracle DBA's
MySQL für Oracle DBA'sFromDual GmbH
 
MySQL Backup/Recovery
MySQL Backup/RecoveryMySQL Backup/Recovery
MySQL Backup/RecoveryFromDual GmbH
 
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?FromDual GmbH
 
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 ClusterFromDual GmbH
 
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?FromDual GmbH
 
Weltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-ReplikationWeltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-ReplikationFromDual GmbH
 
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'sFromDual GmbH
 
MySQL Security SLAC 2015
MySQL Security SLAC 2015MySQL Security SLAC 2015
MySQL Security SLAC 2015FromDual GmbH
 
MySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerMySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerFromDual GmbH
 
MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?FromDual GmbH
 
Reading MySQL fingerprints
Reading MySQL fingerprintsReading MySQL fingerprints
Reading MySQL fingerprintsFromDual GmbH
 
MySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterMySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterFromDual GmbH
 
MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014FromDual 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...
 
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 Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerMySQL Performance Tuning für Entwickler
MySQL Performance Tuning für Entwickler
 
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
 
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
 
MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Recently uploaded (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

UKOUG 2011: Practical MySQL Tuning

  • 1. Practical MySQL Tuning UKOUG Conference 2011 th December 5 , Birmingham Oli Sennhauser Senior MySQL Consultant, FromDual oli.sennhauser@fromdual.com www.fromdual.com 1
  • 2. FromDual ● FromDual provides neutral and independent: ● Consulting for MySQL (on-site and remote) ● Remote-DBA / MySQL operations ● Support for Galera (synchronous MySQL Replication) ● Support for MySQL (Basic and Silver) ● Training for MySQL ● Consulting Partner of Open Database Alliance (ODBA.org) ● Oracle Silver Partner (OPN) ● More information at: www.fromdual.com www.fromdual.com 2
  • 3. Our customer www.fromdual.com 3
  • 4. Content ● FromDual Performance Balance ● Critical Resources ● Hardware / OS ● Database parameter ● Application-Tuning ● Architecture & Design ● Measuring www.fromdual.com 4
  • 5. The FromDual way of PT ● Whom of you has or had Performance problems with MySQL? ● Whom of you has a systematic way for Performance Tuning? → Many roads lead to Rome! ● Starting point: Customer cries because he has a Performance Problem! www.fromdual.com 5
  • 7. Collecting facts ● How does the problem look like? ● DB is suddenly, sometimes or since ever slow? ● What exactly is slow? ● New version was released? ● Somebody has tinkered around? ● We are short before going live and still much too slow? ● Have we historical performance data? ● Best case if: You can (at will) simulate the problem ● ● Predict the problem or if it happens periodic. → Find the pattern! www.fromdual.com 7
  • 8. Critical resources Hardware OS www.fromdual.com 8
  • 9. Critical resources ● Find the bottle-neck / the limiting resource: ● Fortunately „only“: ● CPU ● Memory (RAM) ● I/O (IOPS, throughput) ● Network (FpS, throughput) ● But how? → find the critical resource! www.fromdual.com 9
  • 10. Measure: CPU ● top ● vmstat ● or mpstat ● Which process is using CPU? www.fromdual.com 10
  • 11. Measure: Memory (RAM) ● free / top: #free              total   used    free shared buffers cached Mem:       1036016 983864   52152      0   35484 547432 ­/+ buffers/cache: 400948  635068 swap:      4202112  96148 4105964 ● ps # ps ­eo user,pid,%cpu,%mem,vsz,rsz,comm ­­sort ­vsz |   egrep 'mysql|COMMAND' USER       PID %CPU %MEM    VSZ   RSZ COMMAND mysql     1361  0.0  1.5 108368 16444 mysqld mysql     1210  0.0  0.1   4536  1956 bash mysql     1289  0.0  0.1   4060  1444 safe_mysqld mysql     1204  0.0  0.1   4048  1404 su www.fromdual.com 11
  • 12. Measure: I/O ● vmstat # vmstat 1 procs ­­­swap­­ ­­­­­io­­­­ ­­­­cpu­­­­  r  b   si   so    bi    bo us sy id wa  0  0    3    3    94   143 21 21 56  2  0  0    0    0     0     4  9 37 54  0 ● iostat (→ sysstat package) # iostat ­x 1 avg­cpu:  %user   %nice %system %iowait  %steal   %idle            5.88    0.00   34.31    2.94    0.00   56.86 Device:     r/s   w/s  rkB/s  wkB/s  await  svctm  %util hda        0.00  0.00   0.00   0.00   0.00   0.00   0.00 hdc        0.00  2.94   0.00  23.53  14.67  12.00   3.53 ● pidstat www.fromdual.com 12
  • 13. Measure: Network ● dstat ● watch ­d ­n 1 'ifconfig' ● Frames per second (80k – 1.5M) / throughput (1 Gbit/s → 120 Mbyte/s)? www.fromdual.com 13
  • 14. Summary ● CPU ● I/O ● Which process ● Throughput or IOPS ● which device? ● How many cores? ● Random or sequential I/O → often SQL queries ● Read or write ● Memory → Caches to small, tmp ● Which process tables? ● Swapping? ● Network → Over- or Under- allocating of DB caches! ● Errors / Drops? ● Throughput ● FpS www.fromdual.com 14
  • 15. Set screws ● CPU ● Network ● Faster cores? ● 1 Gbit ● More Cores ● Memory ● OS ● More RAM? ● New 64-bit kernel ● XFS ● I/O ● → I/O Scheduler ● RAID-5 :-( – noop ● SAN :-( – Deadline ● RAID-10, many spindles, SSD? ● Battery buffered I/O cache! ● Virtualization :-( www.fromdual.com 15
  • 16. Database Tuning www.fromdual.com 16
  • 17. MySQL Tuning ● Which Storage Engine are you using at the moment? ● Which MySQL version? (→ 5.1 and newer) ● At the moment: about 330 MySQL parameter → but only 8 (9) of those are primarily significant! → Rough-Tuning ● All other parameters only after detailed benchmarking... → Fine-Tuning www.fromdual.com 17
  • 18. InnoDB Rough-Tuning ● innodb_buffer_pool_size ● about 80% of RAM on a dedicated server ● SHOW STATUS LIKE  'Innodb_buffer_pool_pages%'; ● innodb_log_file_size ● Big = faster, but longer recovery times → 2 x 256 M ● innodb_flush_log_at_trx_commit ● 0, 2 for top performance, 1 for reliability ● sync_binlog ● != 0 → often very slow www.fromdual.com 18
  • 19. MySQL Rough-Tuning ● key_buffer_size ● about 25 – 33% of RAM on dedicated machine ● SHOW STATUS LIKE 'Key_blocks_%'; ● table_open_cache ● Running connections x used tables → 2 – 4k is not unusable! See Open[ed]_tables. ● table_definition_cache ● See Open[ed]_table_definitions → 512 – 4096 is not unusable! ● query_cache_type/query_cache_size ● Do not make too big (<= 128 M), bad for very high concurrency! www.fromdual.com 19
  • 20. Further aid ● How to measure? ● SHOW GLOBAL STATUS; ● SHOW ENGINE INNODB STATUSG ● ca. 330 variables ● ca. 310 Status informations ● MySQL Database Health Check: http://www.fromdual.com/mysql-database-health-check ● MySQL Docu, Server Status Variables: http://dev.mysql.com/doc/refman/5.5/en/server-status-variables.html ● That's it, so far...! :) www.fromdual.com 20
  • 21. Application-Tuning www.fromdual.com 21
  • 22. Application-Tuning ● Index Tuning ● Primary Key (InnoDB) → Length of secondary indices! ● Remove (partial) redundant Indices ● Remove Indices with a low cardinality!?! ● Query Tuning ● SHOW PROCESSLIST; ● Slow Query Log (since 5.1 dynamically) ● log_queries_not_using_indexes = 1 ● mysqldumpslow ­s t slow.log > slow.log.profile ● EXPLAIN SELECT ... www.fromdual.com 22
  • 23. EXPLAIN ● Is the key to the truth ● Query Tuning: x times faster is possible! EXPLAIN SELECT * FROM test where name = 'Oli'; +­­­­+­­­­­­­­­­­­­+­­­­­­­+­­­­­­+­­­­­­­­­­­­­­­+­­­­­­+­­­­­­­­­+­­­­­­+­­­­­­­­+­­­­­­­+ | id | select_type | table | type | possible_keys | key  | key_len | ref  | rows   | Extra | +­­­­+­­­­­­­­­­­­­+­­­­­­­+­­­­­­+­­­­­­­­­­­­­­­+­­­­­­+­­­­­­­­­+­­­­­­+­­­­­­­­+­­­­­­­+ |  1 | SIMPLE      | test  | ALL  | last          | NULL | NULL    | NULL | 261369 |       | +­­­­+­­­­­­­­­­­­­+­­­­­­­+­­­­­­+­­­­­­­­­­­­­­­+­­­­­­+­­­­­­­­­+­­­­­­+­­­­­­­­+­­­­­­­+ ● EXPLAIN Output Format: http://dev.mysql.com/doc/refman/5.5/en/explain-output.html www.fromdual.com 23
  • 24. Application-Tuning ● Let it go! ● Remove columns which are not used (or char(0) or fill with NULL)! ● Old data → delete (archive, swap out)! ● Schema Tuning ● mysqldump ­­no­data > structure_dump.sql ● Right data types and right length! int(1) → 4 byte int! ● utf8 → only when needed ● NULL or NOT NULL ● Locality of the data ● InnoDB Primary Key ● V-Partitioning / (H-)Partitioning www.fromdual.com 24
  • 25. Architecture & Design www.fromdual.com 25
  • 26. MySQL Scale-Out vs Scale-Up ● Costs Scale-Up ● MySQL Design ● Physical bottle-necks ● „Relaxation of Constraints“ Scale-Out www.fromdual.com 26
  • 27. The MySQL Scale-Out approach Application ro rtw Slave Reporting Master Slave Backup Slave 1 Slave 2 Slave 3 ... Load balancer www.fromdual.com 27
  • 28. Architectonic possibilities ● RDBMS are a slow technology! ● Hence: Cache (hot data into a cache!) ● MySQL Memcached Plugin / Memcached ● HandlerSocket ● MySQL Cluster ● Abstraction layers (ORM, Frameworks, etc.) ● Fast development process but ● Standard == „non optimized“ → bad for performance! ● BLOB's are bad for RDBMS ● Put on a filer ● Blob Streaming (PBMS) ● Sharding / distributing ● manually ● Spider SE ● MySQL Replication (r/w Traffic Split) ● MySQL Cluster ● Synchronous Replication with Galera www.fromdual.com 28
  • 30. What happens, if...? ● Customer asks: Can my system bear 30% more load? ● Chemical Engineering: ● Are there differences to a DB based system? ● What do I need to answer this question? www.fromdual.com 30
  • 31. Measure, measure, measure... ● Measure ● Simulate → Capacity planning www.fromdual.com 31
  • 32. The circle closes... ● In ideal case: Only ONE change at a time! www.fromdual.com 32
  • 33. Q&A Questions ? Discussion ? We have some time for face to face questions... www.fromdual.com 33