SlideShare a Scribd company logo
InnoDB Performance Optimisation
Mydbops Database
Meetup
Presented by
Karthik P R
www.mydbops.com info@mydbops.com
Mydbops is into MySQL/MongoDB Support and Consulting. It is founded by experts
who have scaled database at Yahoo! ,Percona and Datavail. We are providing an
expert level support and 24*7 monitoring for MySQL databases and its related
technologies like MariaDB , Percona ( also clustering ) . We support modern
database technologies in MySQL which includes Galera ( Clustering ), Group
Replication , SQL aware Load balancers like Maxscale / ProxySQL.
About Mydbops
CEO / DB Architect
About Me
Agenda
● InnoDB History
● InnoDB Features
● InnoDB Architecture
● InnoDB Performance Tuning
● General Recommendations
InnoDB History
● Introduced in 1995 by Finland based company called Innobase
● In 2000, Innobase started collaboration with MySQL AB
● Oracle acquired Innobase in October 2005
● Become Default storage engine for Mysql 5.5 in 2010
● JSON Support introduced in MySQL 5.7
● Separated Undo Log in MySQL 8.0
InnoDB Features
● ACID transaction Engine
● B+Tree Based Indexing
● Index Organised tables
● MVCC Support.
● Efficiently designed for OLTP workload.
● Foreign Key Support.
● Virtual column and Full text search support
InnoDB Architecture
Why InnoDB Architecture ?
● Fine Tuning needs Architecture Knowledge
● Awareness about Internals
● Data Structures ( on disk / In Memory )
● Transaction , locking . MVCC
● Checkpoint , Flushing , Purging
InnoDB Architecture
InnoDB Architecture
InnoDB Architecture
InnoDB Architecture
InnoDB Performance Tuning
InnoDB Buffer Pool
● Global memory for InnoDB
● Caches the Index and data pages
● Locks and Dictionary cache
● Adaptive hash index
● Change buffering
InnoDB buffer pool can be resized online in MySQL 5.7
InnoDB Performance Tuning
InnoDB Buffer Pool
● LRU based Flushing
● Young and Old ( LRU )
● O_Direct is best flushing
● Compressed and Uncompressed
pages in memory
InnoDB Performance Tuning
InnoDB Buffer Pool Config
● InnoDB_buffer_pool_size (70%-80% of Memory)
● innodb_buffer_pool_instances ( No of CPU core )
● innodb_buffer_pool_dump_pct ( > 70 % is good )
● innodb_buffer_pool_chunk_size
InnoDB Performance Tuning
InnODB Change Buffer
InnoDB Performance Tuning
InnoDB Change Buffer
● Present on both Disk and in memory
● Buffer pool hold Change buffer
● B+tree writes are buffered
● Restrict the size of change buffer
Innodb_change_buffering=all
Innodb_change_buffer_max_size ( 20-30 )
InnoDB Performance Tuning
InnoDB Adaptive Hash Index
● Hash table lookup to B+tree
● Fasten the access inside buffer pool
● Works for Primary and Secondary keys ( OLTP )
● Do not work well with text or queries with multiple join
innodb_adaptive_hash_index
innodb_adaptive_hash_index_parts
InnoDB Performance Tuning
InnoDB Log Buffer
● Holds the data in memory before flushing to disk
● Larger log file reduce contention
● Can Flush on every commit ( for Durability )
● Defaults work pretty well for most workloads.
Innodb_log_buffer_size
InnoDB Performance Tuning
InnoDB flush log at trx commit
● Controls the flushing of data from log buffer to log file.
● Supports 3 different flush behaviour
● More durability set is as default value 1
● innodb_flush_log_at_timeout controls the flush frequency
InnoDB Performance Tuning
InnoDB Flush log at trx commit
InnoDB Performance Tuning
InnoDB log File Size
● Two physical log files of equal size.
● Records all changes to tablespace
● Helps in crash recovery
● Overwritten when the page is flushed from buffer pool ( Checkpoint )
● innodb_log_files_in_group controls the number of files
InnoDB Performance Tuning
InnoDB log File Size
● Two physical log files of equal size.
● Records all changes to tablespace
● Helps in crash recovery
● Overwritten when the page is flushed from buffer pool ( Checkpoint )
● innodb_log_files_in_group controls the number of redo log files
InnoDB Performance Tuning
InnoDB log File Size
● Larger log file better write performance
● Tradeoff longer recovery time
● Defaults is 48 MB is low for any production workload
innodb_log_file_size=(>512M) ( Size can be calculated by innodb_os_log_written)
innodb_log_files_in_group=2
Note : PMM calculates very efficiently co-relate with checkpoint
InnoDB Performance Tuning
Innodb Flush method
● How data to InnoDB data files and log files is flushed ?
● default is FSYNC
● It can be numeral in MySQL 8.0 ( 0,1,2,3,4,5)
innodb_flush_method=O_DIRECT(4)
InnoDB Performance Tuning
Isolation Level
● How transaction isolated from each other ?
● A major role in locking along with work load
● Default Repeatable read.
transaction_isolation=read_committed/repeatable_read
InnoDB Performance Tuning
innodb_dedicated_server (8.0)
● Manages major tuning parameter based on your system memory
○ innodb_buffer_pool_size
○ innodb_log_file_size
○ innodb_log_file_in_group
○ innodb_flush_method
● Enable it only on dedicated MySQL server.
InnoDB Performance Tuning
● innodb_io_capacity
● innodb_io_capacity_max
● innodb_doublewrite
● innodb_checksum_algorithm
● innodb_autoinc_lock_mode
● innodb_purge_threads
InnoDB Performance Tuning
● innodb_flush_neighbors
● innodb_stats_on_metadata
● innodb_stats_persistent_sample_pages
● innodb_max_dirty_pages_pct
● innodb_max_purge_lag
● innodb_max_purge_lag_delay
InnoDB Performance Tuning
● innodb_thread_concurrency
● innodb_concurrency_tickets
● innodb_file_format
● innodb_page_size
● innodb_write_io_threads
● innodb_read_io_threads
General Recommendations
● Ensure there is primary key or Unique key in all tables.
● Smaller the primary key better they will be.
● Avoid shared tablespace for innodb tables.
● Consider partition for huge tables ( query might need changes ).
● Do not make config changes without knowing its production impact.
● 80-90% of performance gain can be achieved by tweaking 4-6 variables.
info@mydbops.com
www.mydbops.com
080-48505683
Contact us
Thank You

More Related Content

What's hot (20)

PDF
Maxscale_메뉴얼
NeoClova
 
PDF
Redis
DaeMyung Kang
 
PDF
Histogram-in-Parallel-universe-of-MySQL-and-MariaDB
Mydbops
 
PDF
MySQL GTID Concepts, Implementation and troubleshooting
Mydbops
 
PDF
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
StreamNative
 
PDF
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
Jean-François Gagné
 
DOCX
MySQL_SQL_Tunning_v0.1.3.docx
NeoClova
 
PDF
쿠키런 1년, 서버개발 분투기
Brian Hong
 
PDF
DB2の使い方 管理ツール編
Akira Shimosako
 
PDF
InnoDB Locking Explained with Stick Figures
Karwin Software Solutions LLC
 
PPTX
MySQL Architecture and Engine
Abdul Manaf
 
PPTX
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
NAVER D2
 
PDF
How to set up orchestrator to manage thousands of MySQL servers
Simon J Mudd
 
PDF
MariaDB Administrator 교육
Sangmo Kim
 
PPTX
ここからはじめる SQL Server の状態取得
Masayuki Ozawa
 
PDF
Understanding Presto - Presto meetup @ Tokyo #1
Sadayuki Furuhashi
 
PDF
Wide Column Store NoSQL vs SQL Data Modeling
ScyllaDB
 
PDF
PostgreSQL WAL for DBAs
PGConf APAC
 
PDF
アクセスプラン(実行計画)の読み方入門
Akira Shimosako
 
PPTX
Maria db 이중화구성_고민하기
NeoClova
 
Maxscale_메뉴얼
NeoClova
 
Histogram-in-Parallel-universe-of-MySQL-and-MariaDB
Mydbops
 
MySQL GTID Concepts, Implementation and troubleshooting
Mydbops
 
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
StreamNative
 
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
Jean-François Gagné
 
MySQL_SQL_Tunning_v0.1.3.docx
NeoClova
 
쿠키런 1년, 서버개발 분투기
Brian Hong
 
DB2の使い方 管理ツール編
Akira Shimosako
 
InnoDB Locking Explained with Stick Figures
Karwin Software Solutions LLC
 
MySQL Architecture and Engine
Abdul Manaf
 
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
NAVER D2
 
How to set up orchestrator to manage thousands of MySQL servers
Simon J Mudd
 
MariaDB Administrator 교육
Sangmo Kim
 
ここからはじめる SQL Server の状態取得
Masayuki Ozawa
 
Understanding Presto - Presto meetup @ Tokyo #1
Sadayuki Furuhashi
 
Wide Column Store NoSQL vs SQL Data Modeling
ScyllaDB
 
PostgreSQL WAL for DBAs
PGConf APAC
 
アクセスプラン(実行計画)の読み方入門
Akira Shimosako
 
Maria db 이중화구성_고민하기
NeoClova
 

Similar to InnoDB Performance Optimisation (20)

PDF
InnoDB Architecture and Performance Optimization, Peter Zaitsev
Fuenteovejuna
 
PPT
jacobs_tuuri_performance
Hiroshi Ono
 
PDF
Innodb 和 XtraDB 结构和性能优化
YUCHENG HU
 
PDF
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Severalnines
 
PDF
InnoDB architecture and performance optimization (Пётр Зайцев)
Ontico
 
PPT
MySQL Performance Tuning at COSCUP 2014
Ryusuke Kajiyama
 
PDF
MySQL Performance Tuning London Meetup June 2017
Ivan Zoratti
 
PDF
The InnoDB Storage Engine for MySQL
Morgan Tocker
 
PPT
MySQL Performance Tuning - GNUnify 2010
OSSCube
 
PDF
Webinar slides: The Holy Grail Webinar: Become a MySQL DBA - Database Perform...
Severalnines
 
PDF
MySQL 5.5&5.6 new features summary
Louis liu
 
PDF
MySQL Performance - Best practices
Ted Wennmark
 
PPTX
MariaDB Performance Tuning Crash Course
Severalnines
 
PDF
MySQL Performance Metrics that Matter
Morgan Tocker
 
PDF
My sql innovation work -innosql
thinkinlamp
 
PDF
MySQL 5.6 Performance
MYXPLAIN
 
PDF
MySQL performance webinar
Abel Flórez
 
PDF
Inno Db Performance And Usability Patches
MySQLConference
 
PPTX
Оптимизация MySQL. Что должен знать каждый разработчик
Agnislav Onufrijchuk
 
ODP
MySQL Scaling Presentation
Tommy Falgout
 
InnoDB Architecture and Performance Optimization, Peter Zaitsev
Fuenteovejuna
 
jacobs_tuuri_performance
Hiroshi Ono
 
Innodb 和 XtraDB 结构和性能优化
YUCHENG HU
 
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Severalnines
 
InnoDB architecture and performance optimization (Пётр Зайцев)
Ontico
 
MySQL Performance Tuning at COSCUP 2014
Ryusuke Kajiyama
 
MySQL Performance Tuning London Meetup June 2017
Ivan Zoratti
 
The InnoDB Storage Engine for MySQL
Morgan Tocker
 
MySQL Performance Tuning - GNUnify 2010
OSSCube
 
Webinar slides: The Holy Grail Webinar: Become a MySQL DBA - Database Perform...
Severalnines
 
MySQL 5.5&5.6 new features summary
Louis liu
 
MySQL Performance - Best practices
Ted Wennmark
 
MariaDB Performance Tuning Crash Course
Severalnines
 
MySQL Performance Metrics that Matter
Morgan Tocker
 
My sql innovation work -innosql
thinkinlamp
 
MySQL 5.6 Performance
MYXPLAIN
 
MySQL performance webinar
Abel Flórez
 
Inno Db Performance And Usability Patches
MySQLConference
 
Оптимизация MySQL. Что должен знать каждый разработчик
Agnislav Onufrijchuk
 
MySQL Scaling Presentation
Tommy Falgout
 
Ad

More from Mydbops (20)

PDF
Scaling TiDB for Large-Scale Application
Mydbops
 
PDF
AWS MySQL Showdown - RDS vs RDS Multi AZ vs Aurora vs Serverless - Mydbops...
Mydbops
 
PDF
Mastering Vector Search with MongoDB Atlas - Manosh Malai - Mydbops MyWebinar 39
Mydbops
 
PDF
Migration Journey To TiDB - Kabilesh PR - Mydbops MyWebinar 38
Mydbops
 
PDF
AWS Blue Green Deployment for Databases - Mydbops
Mydbops
 
PDF
What's New In MySQL 8.4 LTS Mydbops MyWebinar Edition 36
Mydbops
 
PDF
What's New in PostgreSQL 17? - Mydbops MyWebinar Edition 35
Mydbops
 
PDF
What's New in MongoDB 8.0 - Mydbops MyWebinar Edition 34
Mydbops
 
PDF
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Mydbops
 
PDF
Read/Write Splitting using MySQL Router - Mydbops Meetup16
Mydbops
 
PDF
TiDB - From Data to Discovery: Exploring the Intersection of Distributed Dat...
Mydbops
 
PDF
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
Mydbops
 
PDF
Demystifying Real time Analytics with TiDB
Mydbops
 
PDF
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
PDF
Efficient MySQL Indexing and what's new in MySQL Explain
Mydbops
 
PDF
Scale your database traffic with Read & Write split using MySQL Router
Mydbops
 
PDF
PostgreSQL Schema Changes with pg-osc - Mydbops @ PGConf India 2024
Mydbops
 
PDF
Choosing the Right Database: Exploring MySQL Alternatives for Modern Applicat...
Mydbops
 
PDF
Mastering Aurora PostgreSQL Clusters for Disaster Recovery
Mydbops
 
PDF
Navigating Transactions: ACID Complexity in Modern Databases- Mydbops Open So...
Mydbops
 
Scaling TiDB for Large-Scale Application
Mydbops
 
AWS MySQL Showdown - RDS vs RDS Multi AZ vs Aurora vs Serverless - Mydbops...
Mydbops
 
Mastering Vector Search with MongoDB Atlas - Manosh Malai - Mydbops MyWebinar 39
Mydbops
 
Migration Journey To TiDB - Kabilesh PR - Mydbops MyWebinar 38
Mydbops
 
AWS Blue Green Deployment for Databases - Mydbops
Mydbops
 
What's New In MySQL 8.4 LTS Mydbops MyWebinar Edition 36
Mydbops
 
What's New in PostgreSQL 17? - Mydbops MyWebinar Edition 35
Mydbops
 
What's New in MongoDB 8.0 - Mydbops MyWebinar Edition 34
Mydbops
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Mydbops
 
Read/Write Splitting using MySQL Router - Mydbops Meetup16
Mydbops
 
TiDB - From Data to Discovery: Exploring the Intersection of Distributed Dat...
Mydbops
 
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
Mydbops
 
Demystifying Real time Analytics with TiDB
Mydbops
 
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
Efficient MySQL Indexing and what's new in MySQL Explain
Mydbops
 
Scale your database traffic with Read & Write split using MySQL Router
Mydbops
 
PostgreSQL Schema Changes with pg-osc - Mydbops @ PGConf India 2024
Mydbops
 
Choosing the Right Database: Exploring MySQL Alternatives for Modern Applicat...
Mydbops
 
Mastering Aurora PostgreSQL Clusters for Disaster Recovery
Mydbops
 
Navigating Transactions: ACID Complexity in Modern Databases- Mydbops Open So...
Mydbops
 
Ad

Recently uploaded (20)

PPTX
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
PPTX
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
PPTX
Research Design - Report on seminar in thesis writing. PPTX
arvielobos1
 
PPTX
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
PDF
Web Hosting for Shopify WooCommerce etc.
Harry_Phoneix Harry_Phoneix
 
PPT
Agilent Optoelectronic Solutions for Mobile Application
andreashenniger2
 
PPTX
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
PPT
introduction to networking with basics coverage
RamananMuthukrishnan
 
PPT
introductio to computers by arthur janry
RamananMuthukrishnan
 
PDF
DevOps Design for different deployment options
henrymails
 
PPTX
西班牙武康大学毕业证书{UCAMOfferUCAM成绩单水印}原版制作
Taqyea
 
PDF
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
PDF
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
PPTX
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
PPTX
Orchestrating things in Angular application
Peter Abraham
 
PPT
Computer Securityyyyyyyy - Chapter 2.ppt
SolomonSB
 
PPTX
Cost_of_Quality_Presentation_Software_Engineering.pptx
farispalayi
 
PPTX
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
PPTX
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
PPT
Computer Securityyyyyyyy - Chapter 1.ppt
SolomonSB
 
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
Research Design - Report on seminar in thesis writing. PPTX
arvielobos1
 
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
Web Hosting for Shopify WooCommerce etc.
Harry_Phoneix Harry_Phoneix
 
Agilent Optoelectronic Solutions for Mobile Application
andreashenniger2
 
英国假毕业证诺森比亚大学成绩单GPA修改UNN学生卡网上可查学历成绩单
Taqyea
 
introduction to networking with basics coverage
RamananMuthukrishnan
 
introductio to computers by arthur janry
RamananMuthukrishnan
 
DevOps Design for different deployment options
henrymails
 
西班牙武康大学毕业证书{UCAMOfferUCAM成绩单水印}原版制作
Taqyea
 
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
Orchestrating things in Angular application
Peter Abraham
 
Computer Securityyyyyyyy - Chapter 2.ppt
SolomonSB
 
Cost_of_Quality_Presentation_Software_Engineering.pptx
farispalayi
 
ONLINE BIRTH CERTIFICATE APPLICATION SYSYTEM PPT.pptx
ShyamasreeDutta
 
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
Computer Securityyyyyyyy - Chapter 1.ppt
SolomonSB
 

InnoDB Performance Optimisation

  • 1. InnoDB Performance Optimisation Mydbops Database Meetup Presented by Karthik P R www.mydbops.com [email protected]
  • 2. Mydbops is into MySQL/MongoDB Support and Consulting. It is founded by experts who have scaled database at Yahoo! ,Percona and Datavail. We are providing an expert level support and 24*7 monitoring for MySQL databases and its related technologies like MariaDB , Percona ( also clustering ) . We support modern database technologies in MySQL which includes Galera ( Clustering ), Group Replication , SQL aware Load balancers like Maxscale / ProxySQL. About Mydbops
  • 3. CEO / DB Architect About Me
  • 4. Agenda ● InnoDB History ● InnoDB Features ● InnoDB Architecture ● InnoDB Performance Tuning ● General Recommendations
  • 5. InnoDB History ● Introduced in 1995 by Finland based company called Innobase ● In 2000, Innobase started collaboration with MySQL AB ● Oracle acquired Innobase in October 2005 ● Become Default storage engine for Mysql 5.5 in 2010 ● JSON Support introduced in MySQL 5.7 ● Separated Undo Log in MySQL 8.0
  • 6. InnoDB Features ● ACID transaction Engine ● B+Tree Based Indexing ● Index Organised tables ● MVCC Support. ● Efficiently designed for OLTP workload. ● Foreign Key Support. ● Virtual column and Full text search support
  • 7. InnoDB Architecture Why InnoDB Architecture ? ● Fine Tuning needs Architecture Knowledge ● Awareness about Internals ● Data Structures ( on disk / In Memory ) ● Transaction , locking . MVCC ● Checkpoint , Flushing , Purging
  • 12. InnoDB Performance Tuning InnoDB Buffer Pool ● Global memory for InnoDB ● Caches the Index and data pages ● Locks and Dictionary cache ● Adaptive hash index ● Change buffering InnoDB buffer pool can be resized online in MySQL 5.7
  • 13. InnoDB Performance Tuning InnoDB Buffer Pool ● LRU based Flushing ● Young and Old ( LRU ) ● O_Direct is best flushing ● Compressed and Uncompressed pages in memory
  • 14. InnoDB Performance Tuning InnoDB Buffer Pool Config ● InnoDB_buffer_pool_size (70%-80% of Memory) ● innodb_buffer_pool_instances ( No of CPU core ) ● innodb_buffer_pool_dump_pct ( > 70 % is good ) ● innodb_buffer_pool_chunk_size
  • 16. InnoDB Performance Tuning InnoDB Change Buffer ● Present on both Disk and in memory ● Buffer pool hold Change buffer ● B+tree writes are buffered ● Restrict the size of change buffer Innodb_change_buffering=all Innodb_change_buffer_max_size ( 20-30 )
  • 17. InnoDB Performance Tuning InnoDB Adaptive Hash Index ● Hash table lookup to B+tree ● Fasten the access inside buffer pool ● Works for Primary and Secondary keys ( OLTP ) ● Do not work well with text or queries with multiple join innodb_adaptive_hash_index innodb_adaptive_hash_index_parts
  • 18. InnoDB Performance Tuning InnoDB Log Buffer ● Holds the data in memory before flushing to disk ● Larger log file reduce contention ● Can Flush on every commit ( for Durability ) ● Defaults work pretty well for most workloads. Innodb_log_buffer_size
  • 19. InnoDB Performance Tuning InnoDB flush log at trx commit ● Controls the flushing of data from log buffer to log file. ● Supports 3 different flush behaviour ● More durability set is as default value 1 ● innodb_flush_log_at_timeout controls the flush frequency
  • 20. InnoDB Performance Tuning InnoDB Flush log at trx commit
  • 21. InnoDB Performance Tuning InnoDB log File Size ● Two physical log files of equal size. ● Records all changes to tablespace ● Helps in crash recovery ● Overwritten when the page is flushed from buffer pool ( Checkpoint ) ● innodb_log_files_in_group controls the number of files
  • 22. InnoDB Performance Tuning InnoDB log File Size ● Two physical log files of equal size. ● Records all changes to tablespace ● Helps in crash recovery ● Overwritten when the page is flushed from buffer pool ( Checkpoint ) ● innodb_log_files_in_group controls the number of redo log files
  • 23. InnoDB Performance Tuning InnoDB log File Size ● Larger log file better write performance ● Tradeoff longer recovery time ● Defaults is 48 MB is low for any production workload innodb_log_file_size=(>512M) ( Size can be calculated by innodb_os_log_written) innodb_log_files_in_group=2 Note : PMM calculates very efficiently co-relate with checkpoint
  • 24. InnoDB Performance Tuning Innodb Flush method ● How data to InnoDB data files and log files is flushed ? ● default is FSYNC ● It can be numeral in MySQL 8.0 ( 0,1,2,3,4,5) innodb_flush_method=O_DIRECT(4)
  • 25. InnoDB Performance Tuning Isolation Level ● How transaction isolated from each other ? ● A major role in locking along with work load ● Default Repeatable read. transaction_isolation=read_committed/repeatable_read
  • 26. InnoDB Performance Tuning innodb_dedicated_server (8.0) ● Manages major tuning parameter based on your system memory ○ innodb_buffer_pool_size ○ innodb_log_file_size ○ innodb_log_file_in_group ○ innodb_flush_method ● Enable it only on dedicated MySQL server.
  • 27. InnoDB Performance Tuning ● innodb_io_capacity ● innodb_io_capacity_max ● innodb_doublewrite ● innodb_checksum_algorithm ● innodb_autoinc_lock_mode ● innodb_purge_threads
  • 28. InnoDB Performance Tuning ● innodb_flush_neighbors ● innodb_stats_on_metadata ● innodb_stats_persistent_sample_pages ● innodb_max_dirty_pages_pct ● innodb_max_purge_lag ● innodb_max_purge_lag_delay
  • 29. InnoDB Performance Tuning ● innodb_thread_concurrency ● innodb_concurrency_tickets ● innodb_file_format ● innodb_page_size ● innodb_write_io_threads ● innodb_read_io_threads
  • 30. General Recommendations ● Ensure there is primary key or Unique key in all tables. ● Smaller the primary key better they will be. ● Avoid shared tablespace for innodb tables. ● Consider partition for huge tables ( query might need changes ). ● Do not make config changes without knowing its production impact. ● 80-90% of performance gain can be achieved by tweaking 4-6 variables.