MySQL Tuning

Ford AntiTrust
Ford AntiTrustIT Project Manager in a financial company, Cloud-native solutions, Developer, Blogger, and Photographer.
MySQL Tuning
  Ford AntiTrust
What ?




“Managing performance of the memory and processing
    resources of the computer running the DBMS
Why ?




  Default settings are for toy databases
Why ?




Maximum performance (or Optimal between
   other services) and Maximum speed
How ? | today
• I/O tuning
• Optimize Queries
• Maintenances
• Configurations on DBMS
How ? | today
• I/O tuning
• Configurations on DBMS
I/O tuning




    The first bottleneck in database
       performance encountered.
I/O tuning | effect
• Transaction logs
• Files associated
  – Temporary file storage
  – Table file storage
  – Index file storage
I/O tuning | recommended
• CPU : Disabling HyperThreading
• Used different physical storage
   –   Transaction logs                 Transaction logs and
   –   Temporary file storage       temporary spaces are heavy
   –   Table file storage
                                    consumers of I/O, and affect
   –   Index file storage
                                    performance for all users of
• Hard Drive
                                    the database.
   – 7,200+ rpm
   – SATA/SCSI
• RAID levels : 5 +
   – With battery backed up cache may be important.
   – Not use NAS.
MySQL Tuning
How ? | today
• I/O tuning
• Configurations on DBMS
In Architecture
                             •   Caches
                             •   Connections
                             •   Thread
                             •   Buffer
                             •   Temp tables
                             •   Index
                             •   Storage Engine
                             •   File System
                             •   Network I/O
                             •   Client Library



                  http://dev.mysql.com/doc/
General
• Set ‘sql-mode’
   – STRICT_TRANS_TABLES
   – NO_AUTO_CREATE_USER
   – NO_ENGINE_SUBSTITUTION“
• Set ‘default-storage-engine’
   – to INNODB
• Not used ‘old_passwords’
• Use ‘big-tables’
• Use ‘skip-name-resolve’
Log
• Use ‘log-slow-queries’ and ‘log-warnings’
  – For monitor long time queries and warning messages.
• Set ‘long_query_time’
  – For log all queries that have taken more than
    ‘long_query_time’ seconds
Key Buffer
Key blocks unused              27683
Key blocks used                1312

Key read requests              1318393
Key reads                      1344
Key Buffer = (Key read requests - Key reads) * 100 / Key read requests
Sort / Read / Join Buffer
• Set ‘sort_buffer_size’
  – Dynamic by number of ‘ORDER BY’ query
• Set ‘read_buffer_size’
  – Dynamic by traffic and b/w
• Set ‘read_rnd_buffer_size’
  – Dynamic by ‘GROUP BY’ or ‘ORDER BY’
• Set ‘join_buffer_size’
  – Dynamic by join table not use indexes
Query Cache
• Set ‘query_cache_size’
  – to 10% RAM
• Set ‘query_cache_type’
  – to 1, Cache all query results except for those
    that begin with SELECT SQL_NO_CACHE
• Set ‘query_cache_limit’
  – to 5-10% RAM
Temp Table
• Set ‘tmp_table_size’
  – to 5-10% RAM
• Set ‘max_tmp_tables’
  – to 5-10% number of table in all databases
• Set ‘tmpdir’ to different physical drive
Thread
• Use ‘skip-thread-priority’
• Set ‘thread_concurrency’
  – number of Core CPU * 2
• Set ‘thread_cache_size’
  – to 100 - ((threads_created / max_connections) * 100)
Table Cache
Open tables     1024
Opened tables   1120

table_cache     =1024
for InnoDB
• Set ‘innodb_buffer_pool_size’
   – Typical value 60-80% of memory
     (If Innodb is only your storage engine)
• Use ‘innodb_file_per_table’
• Set ‘innodb_additional_mem_pool_size’
   – Do not set too high, avoid memory waste
• Set ‘innodb_flush_log_at_trx_commit’ = 2
   – Control by OS
• Set ‘innodb_thread_concurrency’
   – 2*(NumCPUs+NumDisks) – in theory
Never ending in tune-up theory
References
• Optimizing the mysqld variables, June 15, 2004
  (www.databasejournal.com/features/mysql/article.php/3367871)
• MySQL Database Design and Tuning, Robert D. Schneider, Sams
  Publishing, ISBN: 0-672-32765-1
• InnoDB Architecture and Performance Optimization (OS-DB-
  CON2006), Peter Zaitsev, Percona Ltd
• InnoDB Performance Optimization Heikki Tuuri, Innobase Oy/Oracle
  Corp. Peter Zaitsev, Percona Ltd, uc2007 (April 23-26 2007)
• MySQL/Innodb performance optimization Peter Zaitsev, MySQL AB,
  O'Reilly Open Source Convention 2004 Portland,OR July 26-30
Ford AntiTrust


THANK YOU
1 of 24

Recommended

MySQL Performance Tuning: Top 10 Tips by
MySQL Performance Tuning: Top 10 TipsMySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsOSSCube
55.6K views34 slides
How the Postgres Query Optimizer Works by
How the Postgres Query Optimizer WorksHow the Postgres Query Optimizer Works
How the Postgres Query Optimizer WorksEDB
2.5K views61 slides
MySQL Performance Tuning (In Korean) by
MySQL Performance Tuning (In Korean)MySQL Performance Tuning (In Korean)
MySQL Performance Tuning (In Korean)OracleMySQL
7.2K views58 slides
The PostgreSQL Query Planner by
The PostgreSQL Query PlannerThe PostgreSQL Query Planner
The PostgreSQL Query PlannerCommand Prompt., Inc
8.5K views32 slides
AWR and ASH Deep Dive by
AWR and ASH Deep DiveAWR and ASH Deep Dive
AWR and ASH Deep DiveKellyn Pot'Vin-Gorman
2K views87 slides
MySQL 8.0 Optimizer Guide by
MySQL 8.0 Optimizer GuideMySQL 8.0 Optimizer Guide
MySQL 8.0 Optimizer GuideMorgan Tocker
8.3K views176 slides

More Related Content

What's hot

Understanding index by
Understanding indexUnderstanding index
Understanding indexChien Chung Shen
2K views85 slides
Introduction of sql server indexing by
Introduction of sql server indexingIntroduction of sql server indexing
Introduction of sql server indexingMahabubur Rahaman
6.5K views57 slides
Database Performance Tuning by
Database Performance Tuning Database Performance Tuning
Database Performance Tuning Arno Huetter
37.1K views31 slides
Maria DB Galera Cluster for High Availability by
Maria DB Galera Cluster for High AvailabilityMaria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityOSSCube
2.2K views32 slides
Advanced MySQL Query Tuning by
Advanced MySQL Query TuningAdvanced MySQL Query Tuning
Advanced MySQL Query TuningAlexander Rubin
1.2K views67 slides
Database index by
Database indexDatabase index
Database indexRiteshkiit
1.3K views15 slides

What's hot(20)

Database Performance Tuning by Arno Huetter
Database Performance Tuning Database Performance Tuning
Database Performance Tuning
Arno Huetter37.1K views
Maria DB Galera Cluster for High Availability by OSSCube
Maria DB Galera Cluster for High AvailabilityMaria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High Availability
OSSCube2.2K views
Database index by Riteshkiit
Database indexDatabase index
Database index
Riteshkiit1.3K views
State transfer With Galera by Mydbops
State transfer With GaleraState transfer With Galera
State transfer With Galera
Mydbops214 views
MySQL Query And Index Tuning by Manikanda kumar
MySQL Query And Index TuningMySQL Query And Index Tuning
MySQL Query And Index Tuning
Manikanda kumar17.9K views
InnoDB MVCC Architecture (by 권건우) by I Goo Lee.
InnoDB MVCC Architecture (by 권건우)InnoDB MVCC Architecture (by 권건우)
InnoDB MVCC Architecture (by 권건우)
I Goo Lee.11.3K views
Yahoo: Experiences with MySQL GTID and Multi Threaded Replication by Yashada Jadhav
Yahoo: Experiences with MySQL GTID and Multi Threaded ReplicationYahoo: Experiences with MySQL GTID and Multi Threaded Replication
Yahoo: Experiences with MySQL GTID and Multi Threaded Replication
Yashada Jadhav7.8K views
Introduction to Storm by Chandler Huang
Introduction to Storm Introduction to Storm
Introduction to Storm
Chandler Huang20.1K views
MySQL_SQL_Tunning_v0.1.3.docx by NeoClova
MySQL_SQL_Tunning_v0.1.3.docxMySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docx
NeoClova325 views
Dd and atomic ddl pl17 dublin by Ståle Deraas
Dd and atomic ddl pl17 dublinDd and atomic ddl pl17 dublin
Dd and atomic ddl pl17 dublin
Ståle Deraas2.3K views
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors by John Kanagaraj
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
John Kanagaraj6K views
Hybrid Columnar Compression in a non-Exadata System by Enkitec
Hybrid Columnar Compression in a non-Exadata SystemHybrid Columnar Compression in a non-Exadata System
Hybrid Columnar Compression in a non-Exadata System
Enkitec7.8K views
Galera cluster for high availability by Mydbops
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
Mydbops2.2K views
MariaDB Performance Tuning and Optimization by MariaDB plc
MariaDB Performance Tuning and OptimizationMariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and Optimization
MariaDB plc11.3K views
MariaDB Performance Tuning Crash Course by Severalnines
MariaDB Performance Tuning Crash CourseMariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash Course
Severalnines1.3K views

Viewers also liked

MySQL on AWS 101 by
MySQL on AWS 101MySQL on AWS 101
MySQL on AWS 101Anders Karlsson
2.3K views29 slides
My SQL 101 by
My SQL 101My SQL 101
My SQL 101Dave Stokes
1.3K views30 slides
Objective-C for Java developers by
Objective-C for Java developersObjective-C for Java developers
Objective-C for Java developersFábio Bernardo
1.8K views76 slides
Tuning Android Applications (Part One) by
Tuning Android Applications (Part One)Tuning Android Applications (Part One)
Tuning Android Applications (Part One)CommonsWare
1.1K views19 slides
Android performance tuning. Memory. by
Android performance tuning. Memory.Android performance tuning. Memory.
Android performance tuning. Memory.Sergii Kozyrev
351 views16 slides
Deep Parameters Tuning for Android Mobile Apps by
Deep Parameters Tuning for Android Mobile AppsDeep Parameters Tuning for Android Mobile Apps
Deep Parameters Tuning for Android Mobile AppsDavide De Chiara
277 views38 slides

Viewers also liked(20)

Objective-C for Java developers by Fábio Bernardo
Objective-C for Java developersObjective-C for Java developers
Objective-C for Java developers
Fábio Bernardo1.8K views
Tuning Android Applications (Part One) by CommonsWare
Tuning Android Applications (Part One)Tuning Android Applications (Part One)
Tuning Android Applications (Part One)
CommonsWare1.1K views
Android performance tuning. Memory. by Sergii Kozyrev
Android performance tuning. Memory.Android performance tuning. Memory.
Android performance tuning. Memory.
Sergii Kozyrev351 views
Deep Parameters Tuning for Android Mobile Apps by Davide De Chiara
Deep Parameters Tuning for Android Mobile AppsDeep Parameters Tuning for Android Mobile Apps
Deep Parameters Tuning for Android Mobile Apps
Davide De Chiara277 views
iOS Developer Overview - DevWeek 2014 by Paul Ardeleanu
iOS Developer Overview - DevWeek 2014iOS Developer Overview - DevWeek 2014
iOS Developer Overview - DevWeek 2014
Paul Ardeleanu1.9K views
التحدى 6 الإستعلام بطريقة المعالج by bosy sadek
التحدى 6 الإستعلام بطريقة المعالجالتحدى 6 الإستعلام بطريقة المعالج
التحدى 6 الإستعلام بطريقة المعالج
bosy sadek120 views
MarketLine Country Statistics Database by MarketLine
MarketLine Country Statistics DatabaseMarketLine Country Statistics Database
MarketLine Country Statistics Database
MarketLine462 views
Oracle hard and soft parsing by Ishaan Guliani
Oracle hard and soft parsingOracle hard and soft parsing
Oracle hard and soft parsing
Ishaan Guliani10.8K views
الوحدة التاسعة - قاعدة البيانات وادارتها by Amin Abu Hammad
الوحدة التاسعة - قاعدة البيانات وادارتهاالوحدة التاسعة - قاعدة البيانات وادارتها
الوحدة التاسعة - قاعدة البيانات وادارتها
Amin Abu Hammad392 views
Performance Tuning Azure SQL Database by Grant Fritchey
Performance Tuning Azure SQL DatabasePerformance Tuning Azure SQL Database
Performance Tuning Azure SQL Database
Grant Fritchey875 views

Similar to MySQL Tuning

Performance Whack A Mole by
Performance Whack A MolePerformance Whack A Mole
Performance Whack A Moleoscon2007
1.9K views84 slides
Performance Whack-a-Mole Tutorial (pgCon 2009) by
Performance Whack-a-Mole Tutorial (pgCon 2009) Performance Whack-a-Mole Tutorial (pgCon 2009)
Performance Whack-a-Mole Tutorial (pgCon 2009) PostgreSQL Experts, Inc.
2.5K views109 slides
Performance Whackamole (short version) by
Performance Whackamole (short version)Performance Whackamole (short version)
Performance Whackamole (short version)PostgreSQL Experts, Inc.
1.5K views60 slides
Evergreen Sysadmin Survival Skills by
Evergreen Sysadmin Survival SkillsEvergreen Sysadmin Survival Skills
Evergreen Sysadmin Survival SkillsEvergreen ILS
1.9K views33 slides
How to build a state-of-the-art rails cluster by
How to build a state-of-the-art rails clusterHow to build a state-of-the-art rails cluster
How to build a state-of-the-art rails clusterTim Lossen
2.6K views53 slides
MySQL Performance Tuning London Meetup June 2017 by
MySQL Performance Tuning London Meetup June 2017MySQL Performance Tuning London Meetup June 2017
MySQL Performance Tuning London Meetup June 2017Ivan Zoratti
1.2K views72 slides

Similar to MySQL Tuning(20)

Performance Whack A Mole by oscon2007
Performance Whack A MolePerformance Whack A Mole
Performance Whack A Mole
oscon20071.9K views
Evergreen Sysadmin Survival Skills by Evergreen ILS
Evergreen Sysadmin Survival SkillsEvergreen Sysadmin Survival Skills
Evergreen Sysadmin Survival Skills
Evergreen ILS1.9K views
How to build a state-of-the-art rails cluster by Tim Lossen
How to build a state-of-the-art rails clusterHow to build a state-of-the-art rails cluster
How to build a state-of-the-art rails cluster
Tim Lossen2.6K views
MySQL Performance Tuning London Meetup June 2017 by Ivan Zoratti
MySQL Performance Tuning London Meetup June 2017MySQL Performance Tuning London Meetup June 2017
MySQL Performance Tuning London Meetup June 2017
Ivan Zoratti1.2K views
Tuning Linux Windows and Firebird for Heavy Workload by Marius Adrian Popa
Tuning Linux Windows and Firebird for Heavy WorkloadTuning Linux Windows and Firebird for Heavy Workload
Tuning Linux Windows and Firebird for Heavy Workload
Marius Adrian Popa203 views
MySQL Server Backup, Restoration, and Disaster Recovery Planning by Lenz Grimmer
MySQL Server Backup, Restoration, and Disaster Recovery PlanningMySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery Planning
Lenz Grimmer4K views
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed by Equnix
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar AhmedPGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
Equnix908 views
MySQL Server Settings Tuning by guest5ca94b
MySQL Server Settings TuningMySQL Server Settings Tuning
MySQL Server Settings Tuning
guest5ca94b2.2K views
Accelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDS by Ceph Community
Accelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDSAccelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDS
Accelerating Cassandra Workloads on Ceph with All-Flash PCIE SSDS
Ceph Community 2.9K views
CASSANDRA MEETUP - Choosing the right cloud instances for success by Erick Ramirez
CASSANDRA MEETUP - Choosing the right cloud instances for successCASSANDRA MEETUP - Choosing the right cloud instances for success
CASSANDRA MEETUP - Choosing the right cloud instances for success
Erick Ramirez149 views
Development to Production with Sharded MongoDB Clusters by Severalnines
Development to Production with Sharded MongoDB ClustersDevelopment to Production with Sharded MongoDB Clusters
Development to Production with Sharded MongoDB Clusters
Severalnines7.9K views
Maximizing performance via tuning and optimization by MariaDB plc
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimization
MariaDB plc104 views
Maximizing performance via tuning and optimization by MariaDB plc
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimization
MariaDB plc642 views
Tips and Tricks for SAP Sybase IQ by Don Brizendine
Tips and Tricks for SAP  Sybase IQTips and Tricks for SAP  Sybase IQ
Tips and Tricks for SAP Sybase IQ
Don Brizendine87.8K views
Scalabe MySQL Infrastructure by Balazs Pocze
Scalabe MySQL InfrastructureScalabe MySQL Infrastructure
Scalabe MySQL Infrastructure
Balazs Pocze85 views
Oracle Performance On Linux X86 systems by Baruch Osoveskiy
Oracle  Performance On Linux  X86 systems Oracle  Performance On Linux  X86 systems
Oracle Performance On Linux X86 systems
Baruch Osoveskiy766 views
Tips on High Performance Server Programming by Joshua Zhu
Tips on High Performance Server ProgrammingTips on High Performance Server Programming
Tips on High Performance Server Programming
Joshua Zhu13.1K views

More from Ford AntiTrust

Google calendar by
Google calendarGoogle calendar
Google calendarFord AntiTrust
1.4K views28 slides
Qbasic by
QbasicQbasic
QbasicFord AntiTrust
1.8K views72 slides
Drupal in the Cloud with Windows Azure by
Drupal in the Cloud with Windows AzureDrupal in the Cloud with Windows Azure
Drupal in the Cloud with Windows AzureFord AntiTrust
3.1K views81 slides
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows by
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for WindowsFord AntiTrust
1.4K views46 slides
Web Design, Running A Website And Hosting by
Web Design, Running A Website And HostingWeb Design, Running A Website And Hosting
Web Design, Running A Website And HostingFord AntiTrust
731 views50 slides
PHP Performance with APC + Memcached by
PHP Performance with APC + MemcachedPHP Performance with APC + Memcached
PHP Performance with APC + MemcachedFord AntiTrust
22.1K views38 slides

More from Ford AntiTrust(10)

Drupal in the Cloud with Windows Azure by Ford AntiTrust
Drupal in the Cloud with Windows AzureDrupal in the Cloud with Windows Azure
Drupal in the Cloud with Windows Azure
Ford AntiTrust3.1K views
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows by Ford AntiTrust
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
Ford AntiTrust1.4K views
Web Design, Running A Website And Hosting by Ford AntiTrust
Web Design, Running A Website And HostingWeb Design, Running A Website And Hosting
Web Design, Running A Website And Hosting
Ford AntiTrust731 views
PHP Performance with APC + Memcached by Ford AntiTrust
PHP Performance with APC + MemcachedPHP Performance with APC + Memcached
PHP Performance with APC + Memcached
Ford AntiTrust22.1K views
PHP Hoffman Framework (HMF) at Barcamp Bangkok 2 by Ford AntiTrust
PHP Hoffman Framework(HMF) at Barcamp Bangkok 2PHP Hoffman Framework(HMF) at Barcamp Bangkok 2
PHP Hoffman Framework (HMF) at Barcamp Bangkok 2
Ford AntiTrust470 views
GoOO->PHP [5] at Barcamp Bangkok 2 by Ford AntiTrust
GoOO->PHP [5]  at Barcamp Bangkok 2GoOO->PHP [5]  at Barcamp Bangkok 2
GoOO->PHP [5] at Barcamp Bangkok 2
Ford AntiTrust932 views

Recently uploaded

bookmyshow-1.pptx by
bookmyshow-1.pptxbookmyshow-1.pptx
bookmyshow-1.pptx125071035
13 views11 slides
port23_2023121_resize2.pdf by
port23_2023121_resize2.pdfport23_2023121_resize2.pdf
port23_2023121_resize2.pdfSivaphan Wuttingam
19 views64 slides
PMU Launch - Guaranteed Slides by
PMU Launch - Guaranteed SlidesPMU Launch - Guaranteed Slides
PMU Launch - Guaranteed Slidespmulaunch
16 views64 slides
terms_2.pdf by
terms_2.pdfterms_2.pdf
terms_2.pdfJAWADIQBAL40
18 views8 slides
Bloomerang Thank Yous Dec 2023.pdf by
Bloomerang Thank Yous Dec 2023.pdfBloomerang Thank Yous Dec 2023.pdf
Bloomerang Thank Yous Dec 2023.pdfBloomerang
106 views66 slides
case study of Insertion Type Magnetic Flowmeter exports to Australia_ (1).docx by
case study of Insertion Type Magnetic Flowmeter exports to Australia_ (1).docxcase study of Insertion Type Magnetic Flowmeter exports to Australia_ (1).docx
case study of Insertion Type Magnetic Flowmeter exports to Australia_ (1).docxDalian Zero Instrument Technology Co., Ltd China
26 views5 slides

Recently uploaded(20)

bookmyshow-1.pptx by 125071035
bookmyshow-1.pptxbookmyshow-1.pptx
bookmyshow-1.pptx
12507103513 views
PMU Launch - Guaranteed Slides by pmulaunch
PMU Launch - Guaranteed SlidesPMU Launch - Guaranteed Slides
PMU Launch - Guaranteed Slides
pmulaunch16 views
Bloomerang Thank Yous Dec 2023.pdf by Bloomerang
Bloomerang Thank Yous Dec 2023.pdfBloomerang Thank Yous Dec 2023.pdf
Bloomerang Thank Yous Dec 2023.pdf
Bloomerang106 views
Integrating Talent Management Practices by Seta Wicaksana
Integrating Talent Management PracticesIntegrating Talent Management Practices
Integrating Talent Management Practices
Seta Wicaksana29 views
The 10 Most Iconic Leaders in Supply Chain 2023_compressed.pdf by ciolook1
The 10 Most Iconic Leaders in Supply Chain 2023_compressed.pdfThe 10 Most Iconic Leaders in Supply Chain 2023_compressed.pdf
The 10 Most Iconic Leaders in Supply Chain 2023_compressed.pdf
ciolook19 views
Assignment 4: Reporting to Management.pptx by BethanyAline
Assignment 4: Reporting to Management.pptxAssignment 4: Reporting to Management.pptx
Assignment 4: Reporting to Management.pptx
BethanyAline18 views
The Truth About Customer Journey Mapping by Aggregage
The Truth About Customer Journey MappingThe Truth About Customer Journey Mapping
The Truth About Customer Journey Mapping
Aggregage82 views
Coomes Consulting Business Profile by Chris Coomes
Coomes Consulting Business ProfileCoomes Consulting Business Profile
Coomes Consulting Business Profile
Chris Coomes50 views
Top 10 IT Tasks Small Businesses Can Entrust to Offshore Professionals by altafhsayyednimetler
Top 10 IT Tasks Small Businesses Can Entrust to Offshore ProfessionalsTop 10 IT Tasks Small Businesses Can Entrust to Offshore Professionals
Top 10 IT Tasks Small Businesses Can Entrust to Offshore Professionals
2023 Photo Contest.pptx by culhama
2023 Photo Contest.pptx2023 Photo Contest.pptx
2023 Photo Contest.pptx
culhama30 views
See the new MTN tariffs effected November 28, 2023 by Kweku Zurek
See the new MTN tariffs effected November 28, 2023See the new MTN tariffs effected November 28, 2023
See the new MTN tariffs effected November 28, 2023
Kweku Zurek29.5K views

MySQL Tuning

  • 1. MySQL Tuning Ford AntiTrust
  • 2. What ? “Managing performance of the memory and processing resources of the computer running the DBMS
  • 3. Why ? Default settings are for toy databases
  • 4. Why ? Maximum performance (or Optimal between other services) and Maximum speed
  • 5. How ? | today • I/O tuning • Optimize Queries • Maintenances • Configurations on DBMS
  • 6. How ? | today • I/O tuning • Configurations on DBMS
  • 7. I/O tuning The first bottleneck in database performance encountered.
  • 8. I/O tuning | effect • Transaction logs • Files associated – Temporary file storage – Table file storage – Index file storage
  • 9. I/O tuning | recommended • CPU : Disabling HyperThreading • Used different physical storage – Transaction logs Transaction logs and – Temporary file storage temporary spaces are heavy – Table file storage consumers of I/O, and affect – Index file storage performance for all users of • Hard Drive the database. – 7,200+ rpm – SATA/SCSI • RAID levels : 5 + – With battery backed up cache may be important. – Not use NAS.
  • 11. How ? | today • I/O tuning • Configurations on DBMS
  • 12. In Architecture • Caches • Connections • Thread • Buffer • Temp tables • Index • Storage Engine • File System • Network I/O • Client Library http://dev.mysql.com/doc/
  • 13. General • Set ‘sql-mode’ – STRICT_TRANS_TABLES – NO_AUTO_CREATE_USER – NO_ENGINE_SUBSTITUTION“ • Set ‘default-storage-engine’ – to INNODB • Not used ‘old_passwords’ • Use ‘big-tables’ • Use ‘skip-name-resolve’
  • 14. Log • Use ‘log-slow-queries’ and ‘log-warnings’ – For monitor long time queries and warning messages. • Set ‘long_query_time’ – For log all queries that have taken more than ‘long_query_time’ seconds
  • 15. Key Buffer Key blocks unused 27683 Key blocks used 1312 Key read requests 1318393 Key reads 1344 Key Buffer = (Key read requests - Key reads) * 100 / Key read requests
  • 16. Sort / Read / Join Buffer • Set ‘sort_buffer_size’ – Dynamic by number of ‘ORDER BY’ query • Set ‘read_buffer_size’ – Dynamic by traffic and b/w • Set ‘read_rnd_buffer_size’ – Dynamic by ‘GROUP BY’ or ‘ORDER BY’ • Set ‘join_buffer_size’ – Dynamic by join table not use indexes
  • 17. Query Cache • Set ‘query_cache_size’ – to 10% RAM • Set ‘query_cache_type’ – to 1, Cache all query results except for those that begin with SELECT SQL_NO_CACHE • Set ‘query_cache_limit’ – to 5-10% RAM
  • 18. Temp Table • Set ‘tmp_table_size’ – to 5-10% RAM • Set ‘max_tmp_tables’ – to 5-10% number of table in all databases • Set ‘tmpdir’ to different physical drive
  • 19. Thread • Use ‘skip-thread-priority’ • Set ‘thread_concurrency’ – number of Core CPU * 2 • Set ‘thread_cache_size’ – to 100 - ((threads_created / max_connections) * 100)
  • 20. Table Cache Open tables 1024 Opened tables 1120 table_cache =1024
  • 21. for InnoDB • Set ‘innodb_buffer_pool_size’ – Typical value 60-80% of memory (If Innodb is only your storage engine) • Use ‘innodb_file_per_table’ • Set ‘innodb_additional_mem_pool_size’ – Do not set too high, avoid memory waste • Set ‘innodb_flush_log_at_trx_commit’ = 2 – Control by OS • Set ‘innodb_thread_concurrency’ – 2*(NumCPUs+NumDisks) – in theory
  • 22. Never ending in tune-up theory
  • 23. References • Optimizing the mysqld variables, June 15, 2004 (www.databasejournal.com/features/mysql/article.php/3367871) • MySQL Database Design and Tuning, Robert D. Schneider, Sams Publishing, ISBN: 0-672-32765-1 • InnoDB Architecture and Performance Optimization (OS-DB- CON2006), Peter Zaitsev, Percona Ltd • InnoDB Performance Optimization Heikki Tuuri, Innobase Oy/Oracle Corp. Peter Zaitsev, Percona Ltd, uc2007 (April 23-26 2007) • MySQL/Innodb performance optimization Peter Zaitsev, MySQL AB, O'Reilly Open Source Convention 2004 Portland,OR July 26-30