SlideShare a Scribd company logo
MYSQL Performance Tuning



Philip Zhong



© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   1
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   2
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   3
• Types of I/O schedulers (introduced in 2.6.10: RHEL5)

        – noop: Sorting incoming i/o requests by logical block
       address, that’s all
        – deadlilne: Prioritize read (sync) requests rather than write
       requests (async) to some extent (to avoid “write-starving-reads”
       problem)
         – cfq(default): Fairly scheduling i/o requests per i/o thread
         – anticipatory: Removed in 2.6.33 (bad scheduler. Don’t use it)
• Default is cfq, but noop / deadline is better in many cases

         # echo noop > /sys/block/sdX/queue/scheduler


© 2011 Cisco and/or its affiliates. All rights reserved.                 Cisco Confidential   4
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   5
• Make sure to use Flash Back Write Cache(FBWC) or
        Battery Backed up Write Cache (BBWC) on raid cards
            – 10,000+ fsync() per second, without BBWC less than 200 on HDD
            – Disable write cache on disks for safety reasons
• Do not set “write barrier” on file systems (enabled by default in some cases)
            – Write-through to disks even though BBWC is enabled (very slow)
            – ext3: mount -o barrier=0
            – xfs: mount -o nobarrier
            – drbd: no-disk-barrier in drbd.conf
• Consider disabling atime updates on files and directories
            – mount -o noatime,nodiratime

© 2011 Cisco and/or its affiliates. All rights reserved.                       Cisco Confidential   6
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   7
• Put sequentially written files on HDD
          – ibdata, ib_logfile, binary log files
          – HDD is fast enough for sequential writes
          – Write performance deterioration can be mitigated
          – Life expectancy of SSD will be longer
• Put randomly accessed files on SSD
          – *ibd files, index files(MYI), data files(MYD)
          – SSD is 10x -100x faster for random reads than HDD
          – Archive less active tables/records to HDD
          – SSD is still much expensive than HDD
• Use 5.1 InnoDB Plugin
          – Higher scalability & concurrency matters on faster storage
© 2011 Cisco and/or its affiliates. All rights reserved.                 Cisco Confidential   8
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   9
• RAM access speed is much faster than HDD/SSD

       RAM: -60ns
       HDD: -5ms
       SSD: 100-500us
• 16-100+GB RAM is now pretty common

• Sharding hot application data is important

• Do not create unnecessary indexes

• Delete records or move to archived tables, to keep hot tables
       smaller


© 2011 Cisco and/or its affiliates. All rights reserved.     Cisco Confidential   10
• Network

• CPU

• ……




© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   11
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   12
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   13
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   14
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   15
• EXPLAIN SELECT

         – Tells you what MYSQL is thinking
         – Which keys (indexes) can it use
         – Which keys will it use
         – How many rows must it examine (roughly)




© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   16
• EXPLAIN doesn’t tell you anything about how triggers, stored
       functions, or UDFs will affect your query.
• It doesn’t work for stored procedures, although you can extract
       the queries manually and EXPLAIN them individually.
• Some of the statistics it shows are estimates and can be very
       inaccurate.
• It doesn’t show you everything there is to know about a query’s
       execution plan.
• It doesn’t distinguish between some things with the same name.
       For example, it uses “file sort” for in-memory sorts and for
       temporary files, and it displays “Using temporary” for temporary
       tables on disk and in memory. It can be misleading

© 2011 Cisco and/or its affiliates. All rights reserved.          Cisco Confidential   17
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   18
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   19
SIMPLE:Simple SELECT (not using UNION or subqueries)
                     PRIMARY: outer select.
                     UNION:Second or later SELECT statement in a UNION
                     DEPENDENT UNION:Second or later SELECT statement in a UNION,
                     dependent on outer query
                     UNION RESULT:Result of a UNION.
                     SUBQUERY:First SELECT in subquery
                     DEPENDENT SUBQUERY: First SELECT in subquery, dependent on outer query
                     DERIVED:Derived table SELECT (subquery in FROM clause)
                     UNCACHEABLE SUBQUERY:A subquery for which the result cannot be cached and
                     must be reevaluated for each row of the outer query
                     UNCACHEABLE UNION:The second or later select in a UNION that belongs to an
                       uncacheable subquery (see UNCACHEABLE SUBQUERY)


© 2011 Cisco and/or its affiliates. All rights reserved.                                 Cisco Confidential   20
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   21
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   22
• Mysql>SET profiling = 1;

• Mysql>SHOW PROFILES;

• Mysql>SHOW PROFILE CPU FOR QUERY 1;




© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   23
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   24
select tag_id,tag_text from Tags where tag_id+1>1 and tag_id+1<11;




© 2011 Cisco and/or its affiliates. All rights reserved.            Cisco Confidential   25
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   26
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   27
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   28
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   29
© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   30
Thank you.




© 2011 Cisco and/or its affiliates. All rights reserved.   Cisco Confidential   31

More Related Content

Viewers also liked

MySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsMySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 Tips
OSSCube
 
MySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerMySQL Performance Tuning für Entwickler
MySQL Performance Tuning für Entwickler
FromDual GmbH
 
MySQL Server Settings Tuning
MySQL Server Settings TuningMySQL Server Settings Tuning
MySQL Server Settings Tuningguest5ca94b
 
浅析My sql事务隔离级别与锁 seanlook
浅析My sql事务隔离级别与锁 seanlook浅析My sql事务隔离级别与锁 seanlook
浅析My sql事务隔离级别与锁 seanlook
晓 周
 
Perf Tuning Short
Perf Tuning ShortPerf Tuning Short
Perf Tuning Short
Ligaya Turmelle
 
MySQL Performance Tuning Variables
MySQL Performance Tuning VariablesMySQL Performance Tuning Variables
MySQL Performance Tuning Variables
FromDual GmbH
 
MySQL Performance Tuning
MySQL Performance TuningMySQL Performance Tuning
MySQL Performance TuningFromDual GmbH
 
Performance Tuning Best Practices
Performance Tuning Best PracticesPerformance Tuning Best Practices
Performance Tuning Best Practiceswebhostingguy
 
Join-fu: The Art of SQL Tuning for MySQL
Join-fu: The Art of SQL Tuning for MySQLJoin-fu: The Art of SQL Tuning for MySQL
Join-fu: The Art of SQL Tuning for MySQL
ZendCon
 
MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MYXPLAIN
 
MySQL查询优化浅析
MySQL查询优化浅析MySQL查询优化浅析
MySQL查询优化浅析
frogd
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
Mark Swarbrick
 
Mysql Explain Explained
Mysql Explain ExplainedMysql Explain Explained
Mysql Explain Explained
Jeremy Coates
 
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
 
How to Design Indexes, Really
How to Design Indexes, ReallyHow to Design Indexes, Really
How to Design Indexes, Really
Karwin Software Solutions LLC
 
Assessing enablers and constrainers of graduation
Assessing enablers and constrainers of graduationAssessing enablers and constrainers of graduation
Assessing enablers and constrainers of graduationfutureagricultures
 
Adore global pvt ltd
Adore global pvt ltdAdore global pvt ltd
Adore global pvt ltd
Adore Global Pvt. Ltd
 
Новогодний счастливый купон
Новогодний счастливый купонНовогодний счастливый купон
Новогодний счастливый купон
Елена Шальнова
 
Ig1 assignment 2011_to_2012_updated_17.01.12
Ig1 assignment 2011_to_2012_updated_17.01.12Ig1 assignment 2011_to_2012_updated_17.01.12
Ig1 assignment 2011_to_2012_updated_17.01.12FirstClassProductions
 

Viewers also liked (20)

MySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 TipsMySQL Performance Tuning: Top 10 Tips
MySQL Performance Tuning: Top 10 Tips
 
MySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerMySQL Performance Tuning für Entwickler
MySQL Performance Tuning für Entwickler
 
MySQL Server Settings Tuning
MySQL Server Settings TuningMySQL Server Settings Tuning
MySQL Server Settings Tuning
 
浅析My sql事务隔离级别与锁 seanlook
浅析My sql事务隔离级别与锁 seanlook浅析My sql事务隔离级别与锁 seanlook
浅析My sql事务隔离级别与锁 seanlook
 
Perf Tuning Short
Perf Tuning ShortPerf Tuning Short
Perf Tuning Short
 
MySQL Performance Tuning Variables
MySQL Performance Tuning VariablesMySQL Performance Tuning Variables
MySQL Performance Tuning Variables
 
MySQL Performance Tuning
MySQL Performance TuningMySQL Performance Tuning
MySQL Performance Tuning
 
Performance Tuning Best Practices
Performance Tuning Best PracticesPerformance Tuning Best Practices
Performance Tuning Best Practices
 
Join-fu: The Art of SQL Tuning for MySQL
Join-fu: The Art of SQL Tuning for MySQLJoin-fu: The Art of SQL Tuning for MySQL
Join-fu: The Art of SQL Tuning for MySQL
 
MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6MySQL Indexing - Best practices for MySQL 5.6
MySQL Indexing - Best practices for MySQL 5.6
 
MySQL查询优化浅析
MySQL查询优化浅析MySQL查询优化浅析
MySQL查询优化浅析
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
 
Mysql Explain Explained
Mysql Explain ExplainedMysql Explain Explained
Mysql Explain Explained
 
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)
 
How to Design Indexes, Really
How to Design Indexes, ReallyHow to Design Indexes, Really
How to Design Indexes, Really
 
Assessing enablers and constrainers of graduation
Assessing enablers and constrainers of graduationAssessing enablers and constrainers of graduation
Assessing enablers and constrainers of graduation
 
affTA03 - BAB III
affTA03 - BAB IIIaffTA03 - BAB III
affTA03 - BAB III
 
Adore global pvt ltd
Adore global pvt ltdAdore global pvt ltd
Adore global pvt ltd
 
Новогодний счастливый купон
Новогодний счастливый купонНовогодний счастливый купон
Новогодний счастливый купон
 
Ig1 assignment 2011_to_2012_updated_17.01.12
Ig1 assignment 2011_to_2012_updated_17.01.12Ig1 assignment 2011_to_2012_updated_17.01.12
Ig1 assignment 2011_to_2012_updated_17.01.12
 

Similar to Mysql performance tuning

DEFCON 23 - Etienne Martineau - inter vm data exfiltration
DEFCON 23 - Etienne Martineau - inter vm data exfiltrationDEFCON 23 - Etienne Martineau - inter vm data exfiltration
DEFCON 23 - Etienne Martineau - inter vm data exfiltration
Felipe Prado
 
Puppet for Production in WebEx - PuppetConf 2013
Puppet for Production in WebEx - PuppetConf 2013Puppet for Production in WebEx - PuppetConf 2013
Puppet for Production in WebEx - PuppetConf 2013
Puppet
 
Cisco UCS Application acceleration data optimization
Cisco UCS Application acceleration data optimizationCisco UCS Application acceleration data optimization
Cisco UCS Application acceleration data optimization
solarisyougood
 
BigData Clusters Redefined
BigData Clusters RedefinedBigData Clusters Redefined
BigData Clusters RedefinedDataWorks Summit
 
Considerations for Operating An OpenStack Cloud
Considerations for Operating An OpenStack CloudConsiderations for Operating An OpenStack Cloud
Considerations for Operating An OpenStack Cloud
Mark Voelker
 
Devicemgmt
DevicemgmtDevicemgmt
Devicemgmt
xyxz
 
Oracle Solaris 11.1 New Features
Oracle Solaris 11.1 New FeaturesOracle Solaris 11.1 New Features
Oracle Solaris 11.1 New FeaturesOrgad Kimchi
 
Chapter 2 Configure a Network Operating System
Chapter 2 Configure a Network Operating SystemChapter 2 Configure a Network Operating System
Chapter 2 Configure a Network Operating System
newbie2019
 
Brandon-Ellis-Showcase-PPT
Brandon-Ellis-Showcase-PPTBrandon-Ellis-Showcase-PPT
Brandon-Ellis-Showcase-PPTBrandon Ellis
 
BRKINI-3287.pdf
BRKINI-3287.pdfBRKINI-3287.pdf
BRKINI-3287.pdf
tuancq77
 
제3회난공불락 오픈소스 인프라세미나 - lustre
제3회난공불락 오픈소스 인프라세미나 - lustre제3회난공불락 오픈소스 인프라세미나 - lustre
제3회난공불락 오픈소스 인프라세미나 - lustre
Tommy Lee
 
Cisco UCS (Unified Computing System)
Cisco UCS (Unified Computing System)Cisco UCS (Unified Computing System)
Cisco UCS (Unified Computing System)
NetWize
 
I can\'t believe this is butter - A Tour of btrfs
I can\'t believe this is butter - A Tour of btrfsI can\'t believe this is butter - A Tour of btrfs
I can\'t believe this is butter - A Tour of btrfs
Avi Miller
 
I/O Microbenchmarking with Oracle in Mind
I/O Microbenchmarking with Oracle in MindI/O Microbenchmarking with Oracle in Mind
I/O Microbenchmarking with Oracle in Mind
Bob Sneed
 
Поиск и устранение неисправностей в вычислительной системе Cisco UCS
Поиск и устранение неисправностей в вычислительной системе Cisco UCSПоиск и устранение неисправностей в вычислительной системе Cisco UCS
Поиск и устранение неисправностей в вычислительной системе Cisco UCSCisco Russia
 
Managing Your Cisco Datacenter Network with Ansible
Managing Your Cisco Datacenter Network with AnsibleManaging Your Cisco Datacenter Network with Ansible
Managing Your Cisco Datacenter Network with Ansible
fmaccioni
 
AnsibleFest London 2016 - managing your cisco datacenter network with ansible
AnsibleFest London 2016 - managing your cisco datacenter network with ansibleAnsibleFest London 2016 - managing your cisco datacenter network with ansible
AnsibleFest London 2016 - managing your cisco datacenter network with ansible
fmaccioni
 
Considerations for Operating an OpenStack Cloud
Considerations for Operating an OpenStack CloudConsiderations for Operating an OpenStack Cloud
Considerations for Operating an OpenStack Cloud
All Things Open
 
Cisco DCACI
Cisco DCACICisco DCACI
Cisco DCACI
abdelilahBoumendil
 

Similar to Mysql performance tuning (20)

DEFCON 23 - Etienne Martineau - inter vm data exfiltration
DEFCON 23 - Etienne Martineau - inter vm data exfiltrationDEFCON 23 - Etienne Martineau - inter vm data exfiltration
DEFCON 23 - Etienne Martineau - inter vm data exfiltration
 
Puppet for Production in WebEx - PuppetConf 2013
Puppet for Production in WebEx - PuppetConf 2013Puppet for Production in WebEx - PuppetConf 2013
Puppet for Production in WebEx - PuppetConf 2013
 
Cisco UCS Application acceleration data optimization
Cisco UCS Application acceleration data optimizationCisco UCS Application acceleration data optimization
Cisco UCS Application acceleration data optimization
 
BigData Clusters Redefined
BigData Clusters RedefinedBigData Clusters Redefined
BigData Clusters Redefined
 
Considerations for Operating An OpenStack Cloud
Considerations for Operating An OpenStack CloudConsiderations for Operating An OpenStack Cloud
Considerations for Operating An OpenStack Cloud
 
Devicemgmt
DevicemgmtDevicemgmt
Devicemgmt
 
Oracle Solaris 11.1 New Features
Oracle Solaris 11.1 New FeaturesOracle Solaris 11.1 New Features
Oracle Solaris 11.1 New Features
 
Chapter 2 Configure a Network Operating System
Chapter 2 Configure a Network Operating SystemChapter 2 Configure a Network Operating System
Chapter 2 Configure a Network Operating System
 
Brandon-Ellis-Showcase-PPT
Brandon-Ellis-Showcase-PPTBrandon-Ellis-Showcase-PPT
Brandon-Ellis-Showcase-PPT
 
BRKINI-3287.pdf
BRKINI-3287.pdfBRKINI-3287.pdf
BRKINI-3287.pdf
 
제3회난공불락 오픈소스 인프라세미나 - lustre
제3회난공불락 오픈소스 인프라세미나 - lustre제3회난공불락 오픈소스 인프라세미나 - lustre
제3회난공불락 오픈소스 인프라세미나 - lustre
 
Cisco UCS (Unified Computing System)
Cisco UCS (Unified Computing System)Cisco UCS (Unified Computing System)
Cisco UCS (Unified Computing System)
 
I can\'t believe this is butter - A Tour of btrfs
I can\'t believe this is butter - A Tour of btrfsI can\'t believe this is butter - A Tour of btrfs
I can\'t believe this is butter - A Tour of btrfs
 
I/O Microbenchmarking with Oracle in Mind
I/O Microbenchmarking with Oracle in MindI/O Microbenchmarking with Oracle in Mind
I/O Microbenchmarking with Oracle in Mind
 
Nagios-yating
Nagios-yatingNagios-yating
Nagios-yating
 
Поиск и устранение неисправностей в вычислительной системе Cisco UCS
Поиск и устранение неисправностей в вычислительной системе Cisco UCSПоиск и устранение неисправностей в вычислительной системе Cisco UCS
Поиск и устранение неисправностей в вычислительной системе Cisco UCS
 
Managing Your Cisco Datacenter Network with Ansible
Managing Your Cisco Datacenter Network with AnsibleManaging Your Cisco Datacenter Network with Ansible
Managing Your Cisco Datacenter Network with Ansible
 
AnsibleFest London 2016 - managing your cisco datacenter network with ansible
AnsibleFest London 2016 - managing your cisco datacenter network with ansibleAnsibleFest London 2016 - managing your cisco datacenter network with ansible
AnsibleFest London 2016 - managing your cisco datacenter network with ansible
 
Considerations for Operating an OpenStack Cloud
Considerations for Operating an OpenStack CloudConsiderations for Operating an OpenStack Cloud
Considerations for Operating an OpenStack Cloud
 
Cisco DCACI
Cisco DCACICisco DCACI
Cisco DCACI
 

More from Philip Zhong

How to Implement Distributed Data Store
How to Implement Distributed Data Store How to Implement Distributed Data Store
How to Implement Distributed Data Store
Philip Zhong
 
MongoDB Knowledge Shareing
MongoDB Knowledge ShareingMongoDB Knowledge Shareing
MongoDB Knowledge ShareingPhilip Zhong
 
Adapter Poxy Pattern
Adapter Poxy PatternAdapter Poxy Pattern
Adapter Poxy PatternPhilip Zhong
 
How to estimate_oracle_cost
How to estimate_oracle_costHow to estimate_oracle_cost
How to estimate_oracle_costPhilip Zhong
 
Mongo db program_installation_guide
Mongo db program_installation_guideMongo db program_installation_guide
Mongo db program_installation_guidePhilip Zhong
 
Mongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guideMongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guidePhilip Zhong
 
Vitess percona 2012
Vitess percona 2012Vitess percona 2012
Vitess percona 2012Philip Zhong
 
Distributed_Database_System
Distributed_Database_SystemDistributed_Database_System
Distributed_Database_SystemPhilip Zhong
 
Mysql5.1 character set testing
Mysql5.1 character set testingMysql5.1 character set testing
Mysql5.1 character set testing
Philip Zhong
 
Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8
Philip Zhong
 
Mysql handle socket
Mysql handle socketMysql handle socket
Mysql handle socket
Philip Zhong
 

More from Philip Zhong (11)

How to Implement Distributed Data Store
How to Implement Distributed Data Store How to Implement Distributed Data Store
How to Implement Distributed Data Store
 
MongoDB Knowledge Shareing
MongoDB Knowledge ShareingMongoDB Knowledge Shareing
MongoDB Knowledge Shareing
 
Adapter Poxy Pattern
Adapter Poxy PatternAdapter Poxy Pattern
Adapter Poxy Pattern
 
How to estimate_oracle_cost
How to estimate_oracle_costHow to estimate_oracle_cost
How to estimate_oracle_cost
 
Mongo db program_installation_guide
Mongo db program_installation_guideMongo db program_installation_guide
Mongo db program_installation_guide
 
Mongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guideMongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guide
 
Vitess percona 2012
Vitess percona 2012Vitess percona 2012
Vitess percona 2012
 
Distributed_Database_System
Distributed_Database_SystemDistributed_Database_System
Distributed_Database_System
 
Mysql5.1 character set testing
Mysql5.1 character set testingMysql5.1 character set testing
Mysql5.1 character set testing
 
Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8
 
Mysql handle socket
Mysql handle socketMysql handle socket
Mysql handle socket
 

Recently uploaded

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 

Recently uploaded (20)

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 

Mysql performance tuning

  • 1. MYSQL Performance Tuning Philip Zhong © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 1
  • 2. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 2
  • 3. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 3
  • 4. • Types of I/O schedulers (introduced in 2.6.10: RHEL5) – noop: Sorting incoming i/o requests by logical block address, that’s all – deadlilne: Prioritize read (sync) requests rather than write requests (async) to some extent (to avoid “write-starving-reads” problem) – cfq(default): Fairly scheduling i/o requests per i/o thread – anticipatory: Removed in 2.6.33 (bad scheduler. Don’t use it) • Default is cfq, but noop / deadline is better in many cases # echo noop > /sys/block/sdX/queue/scheduler © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 4
  • 5. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 5
  • 6. • Make sure to use Flash Back Write Cache(FBWC) or Battery Backed up Write Cache (BBWC) on raid cards – 10,000+ fsync() per second, without BBWC less than 200 on HDD – Disable write cache on disks for safety reasons • Do not set “write barrier” on file systems (enabled by default in some cases) – Write-through to disks even though BBWC is enabled (very slow) – ext3: mount -o barrier=0 – xfs: mount -o nobarrier – drbd: no-disk-barrier in drbd.conf • Consider disabling atime updates on files and directories – mount -o noatime,nodiratime © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 6
  • 7. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 7
  • 8. • Put sequentially written files on HDD – ibdata, ib_logfile, binary log files – HDD is fast enough for sequential writes – Write performance deterioration can be mitigated – Life expectancy of SSD will be longer • Put randomly accessed files on SSD – *ibd files, index files(MYI), data files(MYD) – SSD is 10x -100x faster for random reads than HDD – Archive less active tables/records to HDD – SSD is still much expensive than HDD • Use 5.1 InnoDB Plugin – Higher scalability & concurrency matters on faster storage © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 8
  • 9. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 9
  • 10. • RAM access speed is much faster than HDD/SSD RAM: -60ns HDD: -5ms SSD: 100-500us • 16-100+GB RAM is now pretty common • Sharding hot application data is important • Do not create unnecessary indexes • Delete records or move to archived tables, to keep hot tables smaller © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 10
  • 11. • Network • CPU • …… © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 11
  • 12. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 12
  • 13. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 13
  • 14. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 14
  • 15. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 15
  • 16. • EXPLAIN SELECT – Tells you what MYSQL is thinking – Which keys (indexes) can it use – Which keys will it use – How many rows must it examine (roughly) © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 16
  • 17. • EXPLAIN doesn’t tell you anything about how triggers, stored functions, or UDFs will affect your query. • It doesn’t work for stored procedures, although you can extract the queries manually and EXPLAIN them individually. • Some of the statistics it shows are estimates and can be very inaccurate. • It doesn’t show you everything there is to know about a query’s execution plan. • It doesn’t distinguish between some things with the same name. For example, it uses “file sort” for in-memory sorts and for temporary files, and it displays “Using temporary” for temporary tables on disk and in memory. It can be misleading © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 17
  • 18. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 18
  • 19. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 19
  • 20. SIMPLE:Simple SELECT (not using UNION or subqueries) PRIMARY: outer select. UNION:Second or later SELECT statement in a UNION DEPENDENT UNION:Second or later SELECT statement in a UNION, dependent on outer query UNION RESULT:Result of a UNION. SUBQUERY:First SELECT in subquery DEPENDENT SUBQUERY: First SELECT in subquery, dependent on outer query DERIVED:Derived table SELECT (subquery in FROM clause) UNCACHEABLE SUBQUERY:A subquery for which the result cannot be cached and must be reevaluated for each row of the outer query UNCACHEABLE UNION:The second or later select in a UNION that belongs to an uncacheable subquery (see UNCACHEABLE SUBQUERY) © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 20
  • 21. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 21
  • 22. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 22
  • 23. • Mysql>SET profiling = 1; • Mysql>SHOW PROFILES; • Mysql>SHOW PROFILE CPU FOR QUERY 1; © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 23
  • 24. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 24
  • 25. select tag_id,tag_text from Tags where tag_id+1>1 and tag_id+1<11; © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 25
  • 26. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 26
  • 27. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 27
  • 28. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 28
  • 29. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 29
  • 30. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 30
  • 31. Thank you. © 2011 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 31

Editor's Notes

  1. 1)AnticipatoryThe anticipatory I/O elevator was created based on the assumption of a block device withonly one physical seek head (for example a single SATA drive). The anticipatory elevatoruses the deadline mechanism described in more detail below plus an anticipationheuristic. As the name suggests, the anticipatory I/O elevator “anticipates” I/O andattempts to write it in single, bigger streams to the disk instead of multiple very smallrandom disk accesses. The anticipation heuristic may cause latency for write I/O. It isclearly tuned for high throughput on general purpose systems such as the averagepersonal computer. Up to kernel release 2.6.18 the anticipatory elevator is the standardI/O scheduler. However most Enterprise Linux distributions default to the CFQ elevator.2)Complete Fair Queuing (CFQ)The CFQ elevator implements a QoS (Quality of Service) policy for processes bymaintaining per-process I/O queues. The CFQ elevator is well suited for large multiusersystems with a lot of competing processes. It aggressively attempts to avoid starvation ofprocesses and features low latency. Starting with kernel release 2.6.18 the improved CFQelevator is the default I/O scheduler.Depending on the system setup and the workload characteristics, the CFQ scheduler canslowdown a single main application, for example a massive database with its fairnessoriented algorithms. The default configuration handles the fairness based on processgroups which compete against each other. For example a single database and all writesthrough the page cache (all pdflush instances are in one pgroup) are considered as asingle application by CFQ that could compete against many background processes. It canbe useful to experiment with I/O scheduler subconfigurations and/or the deadlinescheduler in such cases.3)DeadlineThe deadline elevator is a cyclic elevator (round robin) with a deadline algorithm thatprovides a near real-time behavior of the I/O subsystem. The deadline elevator offersexcellent request latency while maintaining good disk throughput. The implementation ofthe deadline algorithm ensures that starvation of a process cannot occur.4)NOOPNOOP stands for No Operation, and the name explains most of its functionality. TheNOOP elevator is simple and lean. It is a simple FIFO queue that does not perform anydata ordering. NOOP simply merges adjacent data requests, so it adds very low processoroverhead to disk I/O. The NOOP elevator assumes that a block device either features itsown elevator algorithm such as TCQ for SCSI, or that the block device has no seek latencysuch as a flash card.
  2. A write barrier is a kernel mechanism used to ensure that file system metadata is correctly written and ordered on persistent storage, even when storage devices with volatile write caches lose power.The disk contains all the data. No re-ordering has occurred. With barriers enabled, an fsync() call will also issue a storage cache flushWhen a write hits in a cache, two possible policy choices exist. First, the data can be writtenboth into the cache and passed on to the next lower level in the memory hierarchy. This policy iscalled write-through. A second possible policy on write hits is to only write the data to thefirst-level cache. Only when a dirty line (i.e., a line that has been written to) is replaced in thecache is the data transferred to a lower level in the memory hierarchy. This policy is calledwrite-back.