SlideShare a Scribd company logo
Copyright © 2019 Oracle and/or its affiliates.
MySQL Performance Tuning:
The Perfect Scalability
(HOL3025)
MySQL Principal Technical Support Engineer
Oracle MySQL Support
September 17, 2019
Mirko Ortensi
The following is intended to outline our general product direction. It is intended for information purposes
only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code,
or functionality, and should not be relied upon in making purchasing decisions. The development,
release, timing, and pricing of any features or functionality described for Oracle’s products may change
and remains at the sole discretion of Oracle Corporation.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and
prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed
discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and
Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q
under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website
at http://www.oracle.com/investor. All information in this presentation is current as of September 2019
and Oracle undertakes no duty to update any statement in light of new information or future events.
Safe Harbor
Copyright © 2019 Oracle and/or its affiliates.
Our Goal
When dataset and concurrency increase,
horizontal and vertical scaling can address
service growth. But in order to achieve
perfect scalability, I/O, CPU and Network
bound workloads can meet additional
improvements at no expense to get the
most out of MySQL Server.
Copyright © 2019 Oracle and/or its affiliates.
Why This Matters
Scaling up and out a database implies more
performing storage, more processing
capacity, additional memory and higher
bandwidth. Keeping adjustements to
infrastructure as little as possible helps
keeping operational expenditure limited.
Copyright © 2019 Oracle and/or its affiliates.
“Query is slow
Copyright © 2019 Oracle and/or its affiliates.
Anonymous
Copyright © 2019 Oracle and/or its affiliates.
Mirko Ortensi
MySQL Principal Technical Support Engineer
Agenda
• Horizontal vs Vertical scaling
• I/O Bound Workload
• CPU Bound Workload
• Network Bound Workload
• OS-wise
• Conclusions
Copyright © 2019 Oracle and/or its affiliates.
Data and Concurrency grow
Service is growing: more data
and more active connections
will grow the database «old»
Copyright © 2019 Oracle and/or its affiliates.
THREAD
THREAD
THREAD
THREAD
CLIENT
CLIENT
CLIENT
CLIENT
THREAD
THREAD
I/O, CPU and NETWORK bound
More locks + scans Buffer pool should be
increased
More connections
threads
I/O throughput
Copyright © 2019 Oracle and/or its affiliates.
Agenda
• Horizontal vs Vertical scaling
• I/O Bound Workload
• CPU Bound Workload
• Network Bound Workload
• OS-wise
• Conclusions
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
Scaling out READS
With additional slaves
MySQL Router
WRITE
READ
REPL
Copyright © 2019 Oracle and/or its affiliates.
Scaling out READS
With additional slaves
• Create slave server (clone(), MEB, mysqldump)
• Distribute read and write operations accordingly
• Slaves can be delayed
Copyright © 2019 Oracle and/or its affiliates.
Scaling out READS
With InnoDB Cluster
MySQL Router
WRITE
READ
REPL
Copyright © 2019 Oracle and/or its affiliates.
Scaling out READS
With InnoDB Cluster
• Highly available with automatic failover
• Integrated solution to scale and balance reads
• Up to 9 replicas
• Writes do not scale (single or multi master)
• Read your own writes
Copyright © 2019 Oracle and/or its affiliates.
Scaling out WRITES
Sharding
• MySQL Server does not support sharding
• Only auto-sharding solution is NDB Cluster
• Custom / third party
ID SERVICE DATA
1773467253 chat xxx
6257346892 location xxx
1773467253 chat xxx
7234782739 photos xxx
8437829249 location xxx
Copyright © 2019 Oracle and/or its affiliates.
Scaling Up?
• More sockets / cores
• Faster disks / SSD
• More memory
• More bandwidth
MySQL Multiplies!
Take advantage of:
• Multiple storages
• Thread pooling
• Parallel slave
And tune as usual:
• Configuration
• Queries
Copyright © 2019 Oracle and/or its affiliates.
CLIENT
CLIENT
CLIENT
CLIENT
THREAD
THREAD
THREAD
CLIENT
CLIENT
WORKER
WORKER
MASTER
1 2 3
Copyright © 2019 Oracle and/or its affiliates.
If Data and Concurrency grows, "MySQL multiplies"
IO bound
• Single storage
• Temporary tables
• Set to prevent
data loss
• Insufficient
Buffer pool
• Write workload
CPU bound
• Active
connections
• Redundant
indexes
• sort/ joins
• Scans
• Background tasks
Network bound
• Uncompressed
• Huge recordsets
• Linux (native/VM)
• MySQL 8
• sysstat
• world.sql https://bit.ly/2kO70nY
HOL3025
Copyright © 2019 Oracle and/or its affiliates.
Agenda
• Horizontal vs Vertical scaling
• I/O Bound Workload
• CPU Bound Workload
• Network Bound Workload
• OS-wise
• Conclusions
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
I/O Bound
Monitoring
• iostat
• SHOW ENGINE INNODB STATUS
• Performance schema (MEM)
• SYS schema
select * from sys.io_by_thread_by_latency;
select * from sys.io_global_by_file_by_bytes;
select * from sys.io_global_by_file_by_latency;
select * from sys.waits_global_by_latency;
select * from sys.statements_with_temp_tables;
Reconfigure Move ib_logfile files Permissions START MySQL
Copyright © 2019 Oracle and/or its affiliates.
I/O Bound
REDO Log
Stop the instance, edit
Custom
innodb_log_group_ho
me_dir and save
changes.
From data directory to
the new directory, The
files are usually
ib_logfile0 and
ib_logfile1, but they
could be more,
depending on the
value of
innodb_log_files_in_g
roup
Make sure that the
MySQL server has the
proper access rights
to read/create files in
the log directory.
It will read the
configuration file with
the new location.
On storage devices with cache, data loss is possible if data files
and redo log files reside on different storage devices, and a crash
occurs before data file writes are flushed from the device cache.
If you use or intend to use different storage devices for redo logs and
data files, use O_DIRECT instead.
I/O Bound
REDO Log
Copyright © 2019 Oracle and/or its affiliates.
I/O Bound
Binary Logs
Copyright © 2019 Oracle and/or its affiliates.
Custom log-bin
1. Stop: systemctl stop mysqld
2. Create: /opt/mysql/binlog
3. Edit my.cnf: log_bin=/opt/mysql/binlog/binlog
4. Move binlog.* to /opt/mysql/binlog
5. Edit: binlog.index to adopt absolute paths
(e.g. /opt/mysql/binlog/binlog.000011)
6. Start: systemctl start mysqld
I/O Bound
Binary Logs
Copyright © 2019 Oracle and/or its affiliates.
TEST
1. FLUSH BINARY LOGS;
2. SELECT @@log_bin_basename;
3. RESET MASTER;
I/O Bound
UNDO Logs
Copyright © 2019 Oracle and/or its affiliates.
Custom innodb_undo_directory
1. Stop: systemctl stop mysqld
2. Create: /opt/mysql/undo
3. Relocate undo_00*
4. Start: systemctl start mysqld
5. Check:
1. select @@innodb_undo_directory
I/O Bound
EXTERNAL tablespace
Copyright © 2019 Oracle and/or its affiliates.
• Creating a file-per-table tablespace outside of the data directory.
• The DATA DIRECTORY clause cannot be used with ALTER TABLE
to change the location later.
• CREATE TABLE..DATA DIRECTORY
TEST
mysql> USE test;
Database changed
mysql> CREATE TABLE t1 (c1 INT PRIMARY KEY) DATA
DIRECTORY = '/opt/mysql/tablespaces';
I/O Bound
GENERAL tablespace
Copyright © 2019 Oracle and/or its affiliates.
• Acts as a container of tablespaces, same as system tablespace
• Can be located outside of the data directory
• From file-per-table or system to general tablespace (ALTER)
• From system or general (shared) to file-per-table (ALTER)
• Directory must be known: set innodb_directories (read-only)
TEST
CREATE TABLESPACE `ts1` ADD DATAFILE
'/opt/mysql/tablespaces/ts1.ibd' Engine=InnoDB;
CREATE TABLE t1 (c1 INT PRIMARY KEY) TABLESPACE ts1;
I/O Bound
Partitioning
Copyright © 2019 Oracle and/or its affiliates.
• Horizontal partitioning—that is, different rows of a table may be assigned to
different physical partitions.
• Partitioning makes it possible to store more data in one table than can be held
on a single disk or file system partition.
TEST
CREATE TABLE th (id INT, name VARCHAR(30), adate DATE)
PARTITION BY LIST(YEAR(adate))
(
PARTITION p1999 VALUES IN (1995, 1999, 2003)
DATA DIRECTORY = '/opt/mysql/tablespaces/',
PARTITION p2000 VALUES IN (1996, 2000, 2004)
DATA DIRECTORY = '/opt/mysql/tablespaces/'
);
I/O Bound
Session and Global Temporary Tablespace
Copyright © 2019 Oracle and/or its affiliates.
• If no value is specified for innodb_temp_data_file_path, the default behavior is
to create an auto-extending data file named ibtmp1 in the
innodb_data_home_dir (system tablespace location)
• Not a dynamic setting
• At database start a pool of session 10 temporary tables is created
• At database start, ibtmp1 is created to
• Temp tables rollback segments in ibtmp1
• Example:
--innodb-temp-data-file-
path=../../../tmp/ibtmp1:12M:autoextend
I/O Bound
Session and Global Temporary Tablespace
Copyright © 2019 Oracle and/or its affiliates.
TEST
• mysql> select @@innodb_temp_data_file_path;
• mysql> SELECT * FROM INFORMATION_SCHEMA.FILES
WHERE TABLESPACE_NAME='innodb_temporary'G
• shell> ls –l <location>
• Stop Server and list directory again
I/O Bound
Logging
General log
general_log_file
Slow Query Log
slow_query_log_file
Audit Log
audit_log_file
Copyright © 2019 Oracle and/or its affiliates.
I/O Bound
Flush method
Copyright © 2019 Oracle and/or its affiliates.
Data can travel through different layer before reaching the
durable storage.
I/O Bound
Flush method
Copyright © 2019 Oracle and/or its affiliates.
Flush method: innodb_flush_method (not dynamic)
• fsync is default: fsync is used for both data and log file
• O_DIRECT can help to avoid double buffering between the InnoDB buffer
pool and the operating system file system cache. But is buffer pool is not
enough, buffer cache won’t come to help. fsync is used for both data and log
file
• O_DIRECT_NO_FSYNC same as before, but skips fsyncs
• O_DSYNC: InnoDB uses O_SYNC to open and flush the log files, and fsync()
to flush the data files, only. Based on O_SYNC: nfsync(), write() calls go to
buffer cache, blocks until writes are into the physical storage.
I/O Bound
Flush method monitoring
Copyright © 2019 Oracle and/or its affiliates.
TEST 1
1. sync; echo 1 > /proc/sys/vm/drop_caches
2. vmstat 1 30
3. mysqlslap -uroot -h127.0.0.1 -uroot -p --auto-generate-sql --
concurrency=20 --iterations=100 —number-of-queries=10
TEST 2
At different innodb_flush_method:
• mysql> show status like "Innodb_data_fsyncs";
• mysql> show status like "Innodb_data_pending_fsyncs";
• bash> free -m
I/O Bound
Miscellaneous
Copyright © 2019 Oracle and/or its affiliates.
An all-comprehensive discussion in our official online documentation.
• Disable logging of compressed pages
• Act on I/O capacity for background tasks: innodb_io_capacity and
innodb_flush_sync
• Threshold on write buffer before fsync(): innodb_fsync_threshold
• Data size
• ...
Agenda
• Horizontal vs Vertical scaling
• I/O Bound Workload
• CPU Bound Workload
• Network Bound Workload
• OS-wise
• Conclusions
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
CPU Bound
Monitoring
• vmstat / mpstat
• Status
SHOW STATUS LIKE "Handler%";
SHOW STATUS LIKE "select_full_join";
• sys schema
select * from sys.schema_redundant_indexes;
select * from sys.schema_unused_indexes;
select * from sys.statements_with_sorting;
CALL sys.diagnostics(60, 60, 'current');
Copyright © 2019 Oracle and/or its affiliates.
CPU Bound
Thread Pool
High CPU may also be a good sign, no long IO wait or heavy locking. But
can also be for context switches by CPU scheduler.
1. Too many thread stacks make CPU caches almost useless in highly
parallel execution workloads
2. With too many threads executing in parallel, context switching
overhead is high
Thread pool promotes thread stack reuse
The thread pool controls when transactions start to ensure that not too
many execute in parallel.
Copyright © 2019 Oracle and/or its affiliates.
CPU Bound
Query Tuning
TEST
1. Import world.sql
2. Monitor: mpstat 1 30
3. mysqlslap -uroot -p --no-drop --create-schema=world --
query="select * from world.city where Name='Kabul';" --
concurrency=10 --iterations=1000
4. EXPLAIN SELECT * FROM world.city WHERE Name='Kabul';
5. SELECT * FROM sys.schema_tables_with_full_table_scans;
6. CREATE INDEX city_idx ON world.city(Name);
7. Repeat the test
Copyright © 2019 Oracle and/or its affiliates.
CPU Bound
Replication
• In 5.6 we introduced parallel slave, that could run load for different
databases in parallel. With operations split on several DBs, this
could be a simple option.
• In 5.7 we introduced LOGICAL_CLOCK algorithm, that allows
running many transactions in parallel if they were run in parallel on
master.
• In 8.0 version we have introduced write sets, that allows to run
some statements in parallel, even if they were executed by the
same thread on master.
Copyright © 2019 Oracle and/or its affiliates.
CPU Bound
Miscellaneous
• Tablespace compression
• Protocol compression
• Thread cache
• SSL
• Background
Checkpoint
Purge
Automatic Statistics Calculation
Agenda
• Horizontal vs Vertical scaling
• I/O Bound Workload
• CPU Bound Workload
• Network Bound Workload
• OS-wise
• Conclusions
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
NETWORK Bound
Compression
--compress: Compress all information sent between the client and the server if
possible
TEST
• mysql –uroot –compress –p
• mysqlslap -uroot -h127.0.0.1 -uroot -p --auto-generate-sql --
concurrency=20 --iterations=100 —number-of-queries=10 –compress
• sar -n DEV 3 30
• mpstat 1 30
Look at averages
Agenda
• Horizontal vs Vertical scaling
• I/O Bound Workload
• CPU Bound Workload
• Network Bound Workload
• OS-wise
• Conclusions
Copyright © 2019 Oracle and/or its affiliates.
Copyright © 2019 Oracle and/or its affiliates.
OS-wise
SWAP, SWAPPINESS and AFFINITY
SWAP & SWAPPINESS
cat /proc/sys/vm/swappiness
AFFINITY
At the linux OS level, you can limit the number of processors that the
kernel will utilize for a user space process using numactl, or more
commonly taskset.
Copyright © 2019 Oracle and/or its affiliates.
OS-wise
SWAP, SWAPPINESS and AFFINITY
TEST
• Identify systemd configuration file:
/etc/systemd/system/multi-user.target.wants/mysqld.service
• Modify:
[Service]
CPUAffinity=1
• bash> systemctl daemon-reload
CPU monitor Press f Last CPU used Esc
OS-wise
AFFINITY
top -H -p <pid> To get the list of
options
Scroll down and select
"P = Last Used Cpu
(SMP)", press space
bar
Column on the right
side will show what
CPU has just been
used
Copyright © 2019 Oracle and/or its affiliates.
Agenda
• Horizontal vs Vertical scaling
• I/O Bound Workload
• CPU Bound Workload
• Network Bound Workload
• OS-wise
• Conclusions
Copyright © 2019 Oracle and/or its affiliates.
Conclusion
Setup the most
reliable
production-like
traffic generator
Test and monitor
at different
concurrencies
Experiment!
Copyright © 2019 Oracle and/or its affiliates.
Thank You
Copyright © 2019 Oracle and/or its affiliates.
MySQL Principal Technical Support Engineer
Oracle MySQL Support
September 17, 2019
Mirko Ortensi
Session Survey
Help us make the content
even better. Please complete
the session survey in the
Mobile App.
Copyright © 2019 Oracle and/or its affiliates.
What’s Ahead
Tuesday
5pm-5.45pm
Thursday
Copyright © 2019 Oracle and/or its affiliates.
NDB, Simply the World’s Highest-
Throughput Transactional Datastore
[DEV2554]
Moscone South - Room 205
10am-10:45am What’s New in MySQL Optimizer and
Executor? [DEV2077]
Moscone South - Room 205
The preceding is intended to outline our general product direction. It is intended for information purposes
only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code,
or functionality, and should not be relied upon in making purchasing decisions. The development,
release, timing, and pricing of any features or functionality described for Oracle’s products may change
and remains at the sole discretion of Oracle Corporation.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and
prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed
discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and
Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q
under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website
at http://www.oracle.com/investor. All information in this presentation is current as of September 2019
and Oracle undertakes no duty to update any statement in light of new information or future events.
Safe Harbor
Copyright © 2019 Oracle and/or its affiliates.
Ad

More Related Content

What's hot (20)

2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015 2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
Geir Høydalsvik
 
MySQL 5.7 in a Nutshell
MySQL 5.7 in a NutshellMySQL 5.7 in a Nutshell
MySQL 5.7 in a Nutshell
Emily Ikuta
 
MySQL :What's New #GIDS16
MySQL :What's New #GIDS16MySQL :What's New #GIDS16
MySQL :What's New #GIDS16
Sanjay Manwani
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQL
Morgan Tocker
 
MySQL configuration - The most important Variables
MySQL configuration - The most important VariablesMySQL configuration - The most important Variables
MySQL configuration - The most important Variables
FromDual GmbH
 
New awesome features in MySQL 5.7
New awesome features in MySQL 5.7New awesome features in MySQL 5.7
New awesome features in MySQL 5.7
Zhaoyang Wang
 
MySQL Performance Metrics that Matter
MySQL Performance Metrics that MatterMySQL Performance Metrics that Matter
MySQL Performance Metrics that Matter
Morgan Tocker
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
Mark Swarbrick
 
MySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big DataMySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big Data
Morgan Tocker
 
MySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware companyMySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware company
Continuent
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New Features
Tarique Saleem
 
MySQL 5.6 Performance
MySQL 5.6 PerformanceMySQL 5.6 Performance
MySQL 5.6 Performance
MYXPLAIN
 
What's new in my sql smug
What's new in my sql smugWhat's new in my sql smug
What's new in my sql smug
Ted Wennmark
 
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Ted Wennmark
 
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 Enterprise Backup
MySQL Enterprise BackupMySQL Enterprise Backup
MySQL Enterprise Backup
Mario Beck
 
Database as a Service on the Oracle Database Appliance Platform
Database as a Service on the Oracle Database Appliance PlatformDatabase as a Service on the Oracle Database Appliance Platform
Database as a Service on the Oracle Database Appliance Platform
Maris Elsins
 
MySQL 5.7 - What's new and How to upgrade
MySQL 5.7 - What's new and How to upgradeMySQL 5.7 - What's new and How to upgrade
MySQL 5.7 - What's new and How to upgrade
Abel Flórez
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
Ted Wennmark
 
Running E-Business Suite Database on Oracle Database Appliance
Running E-Business Suite Database on Oracle Database ApplianceRunning E-Business Suite Database on Oracle Database Appliance
Running E-Business Suite Database on Oracle Database Appliance
Maris Elsins
 
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015 2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
Geir Høydalsvik
 
MySQL 5.7 in a Nutshell
MySQL 5.7 in a NutshellMySQL 5.7 in a Nutshell
MySQL 5.7 in a Nutshell
Emily Ikuta
 
MySQL :What's New #GIDS16
MySQL :What's New #GIDS16MySQL :What's New #GIDS16
MySQL :What's New #GIDS16
Sanjay Manwani
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQL
Morgan Tocker
 
MySQL configuration - The most important Variables
MySQL configuration - The most important VariablesMySQL configuration - The most important Variables
MySQL configuration - The most important Variables
FromDual GmbH
 
New awesome features in MySQL 5.7
New awesome features in MySQL 5.7New awesome features in MySQL 5.7
New awesome features in MySQL 5.7
Zhaoyang Wang
 
MySQL Performance Metrics that Matter
MySQL Performance Metrics that MatterMySQL Performance Metrics that Matter
MySQL Performance Metrics that Matter
Morgan Tocker
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT  - Performance TuningMySQL Manchester TT  - Performance Tuning
MySQL Manchester TT - Performance Tuning
Mark Swarbrick
 
MySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big DataMySQL: From Single Instance to Big Data
MySQL: From Single Instance to Big Data
Morgan Tocker
 
MySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware companyMySQL High Availability and Disaster Recovery with Continuent, a VMware company
MySQL High Availability and Disaster Recovery with Continuent, a VMware company
Continuent
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New Features
Tarique Saleem
 
MySQL 5.6 Performance
MySQL 5.6 PerformanceMySQL 5.6 Performance
MySQL 5.6 Performance
MYXPLAIN
 
What's new in my sql smug
What's new in my sql smugWhat's new in my sql smug
What's new in my sql smug
Ted Wennmark
 
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Ted Wennmark
 
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 Enterprise Backup
MySQL Enterprise BackupMySQL Enterprise Backup
MySQL Enterprise Backup
Mario Beck
 
Database as a Service on the Oracle Database Appliance Platform
Database as a Service on the Oracle Database Appliance PlatformDatabase as a Service on the Oracle Database Appliance Platform
Database as a Service on the Oracle Database Appliance Platform
Maris Elsins
 
MySQL 5.7 - What's new and How to upgrade
MySQL 5.7 - What's new and How to upgradeMySQL 5.7 - What's new and How to upgrade
MySQL 5.7 - What's new and How to upgrade
Abel Flórez
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
Ted Wennmark
 
Running E-Business Suite Database on Oracle Database Appliance
Running E-Business Suite Database on Oracle Database ApplianceRunning E-Business Suite Database on Oracle Database Appliance
Running E-Business Suite Database on Oracle Database Appliance
Maris Elsins
 

Similar to MySQL Performance Tuning: The Perfect Scalability (OOW2019) (20)

Confoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSetConfoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSet
Dave Stokes
 
TechEvent 2019: Create a Private Database Cloud in the Public Cloud using the...
TechEvent 2019: Create a Private Database Cloud in the Public Cloud using the...TechEvent 2019: Create a Private Database Cloud in the Public Cloud using the...
TechEvent 2019: Create a Private Database Cloud in the Public Cloud using the...
Trivadis
 
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019
Dave Stokes
 
Why to Use an Oracle Database?
Why to Use an Oracle Database? Why to Use an Oracle Database?
Why to Use an Oracle Database?
Markus Michalewicz
 
Oracle Database Availability & Scalability Across Versions & Editions
Oracle Database Availability & Scalability Across Versions & EditionsOracle Database Availability & Scalability Across Versions & Editions
Oracle Database Availability & Scalability Across Versions & Editions
Markus Michalewicz
 
MySQL-InnoDB
MySQL-InnoDBMySQL-InnoDB
MySQL-InnoDB
Mayank Prasad
 
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL ShellMySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
Miguel Araújo
 
A Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreA Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document Store
Dave Stokes
 
Oracle Autonomous Database - introducción técnica y hands on lab
Oracle Autonomous Database  - introducción técnica y hands on labOracle Autonomous Database  - introducción técnica y hands on lab
Oracle Autonomous Database - introducción técnica y hands on lab
"Diego \"Perico\"" Sanchez
 
DevTalks.ro 2019 What's New in MySQL 8.0 Security
DevTalks.ro 2019 What's New in MySQL 8.0 SecurityDevTalks.ro 2019 What's New in MySQL 8.0 Security
DevTalks.ro 2019 What's New in MySQL 8.0 Security
Georgi Kodinov
 
Node.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development TechniquesNode.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development Techniques
Christopher Jones
 
Oracle Cloud is Best for Oracle Database - High Availability
Oracle Cloud is Best for Oracle Database - High AvailabilityOracle Cloud is Best for Oracle Database - High Availability
Oracle Cloud is Best for Oracle Database - High Availability
Markus Michalewicz
 
Best Practices for the Most Impactful Oracle Database 18c and 19c Features
Best Practices for the Most Impactful Oracle Database 18c and 19c FeaturesBest Practices for the Most Impactful Oracle Database 18c and 19c Features
Best Practices for the Most Impactful Oracle Database 18c and 19c Features
Markus Michalewicz
 
MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014) MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014)
Frazer Clement
 
Oracle MAA Best Practices - Applications Considerations
Oracle MAA Best Practices - Applications ConsiderationsOracle MAA Best Practices - Applications Considerations
Oracle MAA Best Practices - Applications Considerations
Markus Michalewicz
 
Simplify IT: Oracle SuperCluster
Simplify IT: Oracle SuperCluster Simplify IT: Oracle SuperCluster
Simplify IT: Oracle SuperCluster
Fran Navarro
 
Boston_sql_kegorman_highIO.pptx
Boston_sql_kegorman_highIO.pptxBoston_sql_kegorman_highIO.pptx
Boston_sql_kegorman_highIO.pptx
Kellyn Pot'Vin-Gorman
 
Exadata z pohledu zákazníka a novinky generace X8M - 1. část
Exadata z pohledu zákazníka a novinky generace X8M - 1. částExadata z pohledu zákazníka a novinky generace X8M - 1. část
Exadata z pohledu zákazníka a novinky generace X8M - 1. část
MarketingArrowECS_CZ
 
Oracle NoSQL
Oracle NoSQLOracle NoSQL
Oracle NoSQL
Oracle Korea
 
MongoDB World 2019: Implementation and Operationalization of MongoDB Sharding...
MongoDB World 2019: Implementation and Operationalization of MongoDB Sharding...MongoDB World 2019: Implementation and Operationalization of MongoDB Sharding...
MongoDB World 2019: Implementation and Operationalization of MongoDB Sharding...
MongoDB
 
Confoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSetConfoo 202 - MySQL Group Replication and ReplicaSet
Confoo 202 - MySQL Group Replication and ReplicaSet
Dave Stokes
 
TechEvent 2019: Create a Private Database Cloud in the Public Cloud using the...
TechEvent 2019: Create a Private Database Cloud in the Public Cloud using the...TechEvent 2019: Create a Private Database Cloud in the Public Cloud using the...
TechEvent 2019: Create a Private Database Cloud in the Public Cloud using the...
Trivadis
 
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019
Dave Stokes
 
Why to Use an Oracle Database?
Why to Use an Oracle Database? Why to Use an Oracle Database?
Why to Use an Oracle Database?
Markus Michalewicz
 
Oracle Database Availability & Scalability Across Versions & Editions
Oracle Database Availability & Scalability Across Versions & EditionsOracle Database Availability & Scalability Across Versions & Editions
Oracle Database Availability & Scalability Across Versions & Editions
Markus Michalewicz
 
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL ShellMySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
Miguel Araújo
 
A Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document StoreA Step by Step Introduction to the MySQL Document Store
A Step by Step Introduction to the MySQL Document Store
Dave Stokes
 
Oracle Autonomous Database - introducción técnica y hands on lab
Oracle Autonomous Database  - introducción técnica y hands on labOracle Autonomous Database  - introducción técnica y hands on lab
Oracle Autonomous Database - introducción técnica y hands on lab
"Diego \"Perico\"" Sanchez
 
DevTalks.ro 2019 What's New in MySQL 8.0 Security
DevTalks.ro 2019 What's New in MySQL 8.0 SecurityDevTalks.ro 2019 What's New in MySQL 8.0 Security
DevTalks.ro 2019 What's New in MySQL 8.0 Security
Georgi Kodinov
 
Node.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development TechniquesNode.js and Oracle Database: New Development Techniques
Node.js and Oracle Database: New Development Techniques
Christopher Jones
 
Oracle Cloud is Best for Oracle Database - High Availability
Oracle Cloud is Best for Oracle Database - High AvailabilityOracle Cloud is Best for Oracle Database - High Availability
Oracle Cloud is Best for Oracle Database - High Availability
Markus Michalewicz
 
Best Practices for the Most Impactful Oracle Database 18c and 19c Features
Best Practices for the Most Impactful Oracle Database 18c and 19c FeaturesBest Practices for the Most Impactful Oracle Database 18c and 19c Features
Best Practices for the Most Impactful Oracle Database 18c and 19c Features
Markus Michalewicz
 
MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014) MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014)
Frazer Clement
 
Oracle MAA Best Practices - Applications Considerations
Oracle MAA Best Practices - Applications ConsiderationsOracle MAA Best Practices - Applications Considerations
Oracle MAA Best Practices - Applications Considerations
Markus Michalewicz
 
Simplify IT: Oracle SuperCluster
Simplify IT: Oracle SuperCluster Simplify IT: Oracle SuperCluster
Simplify IT: Oracle SuperCluster
Fran Navarro
 
Exadata z pohledu zákazníka a novinky generace X8M - 1. část
Exadata z pohledu zákazníka a novinky generace X8M - 1. částExadata z pohledu zákazníka a novinky generace X8M - 1. část
Exadata z pohledu zákazníka a novinky generace X8M - 1. část
MarketingArrowECS_CZ
 
MongoDB World 2019: Implementation and Operationalization of MongoDB Sharding...
MongoDB World 2019: Implementation and Operationalization of MongoDB Sharding...MongoDB World 2019: Implementation and Operationalization of MongoDB Sharding...
MongoDB World 2019: Implementation and Operationalization of MongoDB Sharding...
MongoDB
 
Ad

Recently uploaded (20)

03 Daniel 2-notes.ppt seminario escatologia
03 Daniel 2-notes.ppt seminario escatologia03 Daniel 2-notes.ppt seminario escatologia
03 Daniel 2-notes.ppt seminario escatologia
Alexander Romero Arosquipa
 
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
James Francis Paradigm Asset Management
 
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjks
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjksPpt. Nikhil.pptxnshwuudgcudisisshvehsjks
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjks
panchariyasahil
 
How iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost FundsHow iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost Funds
ireneschmid345
 
md-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptx
md-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptxmd-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptx
md-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptx
fatimalazaar2004
 
Shotgun detailed overview my this ppt formate
Shotgun detailed overview my this ppt formateShotgun detailed overview my this ppt formate
Shotgun detailed overview my this ppt formate
freefreefire0998
 
Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..
yuvarajreddy2002
 
Geometry maths presentation for begginers
Geometry maths presentation for begginersGeometry maths presentation for begginers
Geometry maths presentation for begginers
zrjacob283
 
Template_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Template_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnTemplate_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Template_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
cegiver630
 
Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...
Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...
Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...
Abodahab
 
LLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bertLLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bert
ChadapornK
 
Call illuminati Agent in uganda+256776963507/0741506136
Call illuminati Agent in uganda+256776963507/0741506136Call illuminati Agent in uganda+256776963507/0741506136
Call illuminati Agent in uganda+256776963507/0741506136
illuminati Agent uganda call+256776963507/0741506136
 
History of Science and Technologyandits source.pptx
History of Science and Technologyandits source.pptxHistory of Science and Technologyandits source.pptx
History of Science and Technologyandits source.pptx
balongcastrojo
 
Thingyan is now a global treasure! See how people around the world are search...
Thingyan is now a global treasure! See how people around the world are search...Thingyan is now a global treasure! See how people around the world are search...
Thingyan is now a global treasure! See how people around the world are search...
Pixellion
 
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
gmuir1066
 
Digilocker under workingProcess Flow.pptx
Digilocker  under workingProcess Flow.pptxDigilocker  under workingProcess Flow.pptx
Digilocker under workingProcess Flow.pptx
satnamsadguru491
 
Data Science Courses in India iim skills
Data Science Courses in India iim skillsData Science Courses in India iim skills
Data Science Courses in India iim skills
dharnathakur29
 
EDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbb
EDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbbEDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbb
EDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbb
JessaMaeEvangelista2
 
04302025_CCC TUG_DataVista: The Design Story
04302025_CCC TUG_DataVista: The Design Story04302025_CCC TUG_DataVista: The Design Story
04302025_CCC TUG_DataVista: The Design Story
ccctableauusergroup
 
Defense Against LLM Scheming 2025_04_28.pptx
Defense Against LLM Scheming 2025_04_28.pptxDefense Against LLM Scheming 2025_04_28.pptx
Defense Against LLM Scheming 2025_04_28.pptx
Greg Makowski
 
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
James Francis Paradigm Asset Management
 
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjks
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjksPpt. Nikhil.pptxnshwuudgcudisisshvehsjks
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjks
panchariyasahil
 
How iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost FundsHow iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost Funds
ireneschmid345
 
md-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptx
md-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptxmd-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptx
md-presentHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHation.pptx
fatimalazaar2004
 
Shotgun detailed overview my this ppt formate
Shotgun detailed overview my this ppt formateShotgun detailed overview my this ppt formate
Shotgun detailed overview my this ppt formate
freefreefire0998
 
Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..
yuvarajreddy2002
 
Geometry maths presentation for begginers
Geometry maths presentation for begginersGeometry maths presentation for begginers
Geometry maths presentation for begginers
zrjacob283
 
Template_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Template_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnTemplate_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Template_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
cegiver630
 
Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...
Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...
Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...
Abodahab
 
LLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bertLLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bert
ChadapornK
 
History of Science and Technologyandits source.pptx
History of Science and Technologyandits source.pptxHistory of Science and Technologyandits source.pptx
History of Science and Technologyandits source.pptx
balongcastrojo
 
Thingyan is now a global treasure! See how people around the world are search...
Thingyan is now a global treasure! See how people around the world are search...Thingyan is now a global treasure! See how people around the world are search...
Thingyan is now a global treasure! See how people around the world are search...
Pixellion
 
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
gmuir1066
 
Digilocker under workingProcess Flow.pptx
Digilocker  under workingProcess Flow.pptxDigilocker  under workingProcess Flow.pptx
Digilocker under workingProcess Flow.pptx
satnamsadguru491
 
Data Science Courses in India iim skills
Data Science Courses in India iim skillsData Science Courses in India iim skills
Data Science Courses in India iim skills
dharnathakur29
 
EDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbb
EDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbbEDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbb
EDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbb
JessaMaeEvangelista2
 
04302025_CCC TUG_DataVista: The Design Story
04302025_CCC TUG_DataVista: The Design Story04302025_CCC TUG_DataVista: The Design Story
04302025_CCC TUG_DataVista: The Design Story
ccctableauusergroup
 
Defense Against LLM Scheming 2025_04_28.pptx
Defense Against LLM Scheming 2025_04_28.pptxDefense Against LLM Scheming 2025_04_28.pptx
Defense Against LLM Scheming 2025_04_28.pptx
Greg Makowski
 
Ad

MySQL Performance Tuning: The Perfect Scalability (OOW2019)

  • 1. Copyright © 2019 Oracle and/or its affiliates. MySQL Performance Tuning: The Perfect Scalability (HOL3025) MySQL Principal Technical Support Engineer Oracle MySQL Support September 17, 2019 Mirko Ortensi
  • 2. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website at http://www.oracle.com/investor. All information in this presentation is current as of September 2019 and Oracle undertakes no duty to update any statement in light of new information or future events. Safe Harbor Copyright © 2019 Oracle and/or its affiliates.
  • 3. Our Goal When dataset and concurrency increase, horizontal and vertical scaling can address service growth. But in order to achieve perfect scalability, I/O, CPU and Network bound workloads can meet additional improvements at no expense to get the most out of MySQL Server. Copyright © 2019 Oracle and/or its affiliates.
  • 4. Why This Matters Scaling up and out a database implies more performing storage, more processing capacity, additional memory and higher bandwidth. Keeping adjustements to infrastructure as little as possible helps keeping operational expenditure limited. Copyright © 2019 Oracle and/or its affiliates.
  • 5. “Query is slow Copyright © 2019 Oracle and/or its affiliates. Anonymous
  • 6. Copyright © 2019 Oracle and/or its affiliates. Mirko Ortensi MySQL Principal Technical Support Engineer
  • 7. Agenda • Horizontal vs Vertical scaling • I/O Bound Workload • CPU Bound Workload • Network Bound Workload • OS-wise • Conclusions Copyright © 2019 Oracle and/or its affiliates.
  • 8. Data and Concurrency grow Service is growing: more data and more active connections will grow the database «old» Copyright © 2019 Oracle and/or its affiliates. THREAD THREAD THREAD THREAD CLIENT CLIENT CLIENT CLIENT THREAD THREAD
  • 9. I/O, CPU and NETWORK bound More locks + scans Buffer pool should be increased More connections threads I/O throughput Copyright © 2019 Oracle and/or its affiliates.
  • 10. Agenda • Horizontal vs Vertical scaling • I/O Bound Workload • CPU Bound Workload • Network Bound Workload • OS-wise • Conclusions Copyright © 2019 Oracle and/or its affiliates.
  • 11. Copyright © 2019 Oracle and/or its affiliates. Scaling out READS With additional slaves MySQL Router WRITE READ REPL
  • 12. Copyright © 2019 Oracle and/or its affiliates. Scaling out READS With additional slaves • Create slave server (clone(), MEB, mysqldump) • Distribute read and write operations accordingly • Slaves can be delayed
  • 13. Copyright © 2019 Oracle and/or its affiliates. Scaling out READS With InnoDB Cluster MySQL Router WRITE READ REPL
  • 14. Copyright © 2019 Oracle and/or its affiliates. Scaling out READS With InnoDB Cluster • Highly available with automatic failover • Integrated solution to scale and balance reads • Up to 9 replicas • Writes do not scale (single or multi master) • Read your own writes
  • 15. Copyright © 2019 Oracle and/or its affiliates. Scaling out WRITES Sharding • MySQL Server does not support sharding • Only auto-sharding solution is NDB Cluster • Custom / third party ID SERVICE DATA 1773467253 chat xxx 6257346892 location xxx 1773467253 chat xxx 7234782739 photos xxx 8437829249 location xxx
  • 16. Copyright © 2019 Oracle and/or its affiliates. Scaling Up? • More sockets / cores • Faster disks / SSD • More memory • More bandwidth
  • 17. MySQL Multiplies! Take advantage of: • Multiple storages • Thread pooling • Parallel slave And tune as usual: • Configuration • Queries Copyright © 2019 Oracle and/or its affiliates. CLIENT CLIENT CLIENT CLIENT THREAD THREAD THREAD CLIENT CLIENT WORKER WORKER MASTER
  • 18. 1 2 3 Copyright © 2019 Oracle and/or its affiliates. If Data and Concurrency grows, "MySQL multiplies" IO bound • Single storage • Temporary tables • Set to prevent data loss • Insufficient Buffer pool • Write workload CPU bound • Active connections • Redundant indexes • sort/ joins • Scans • Background tasks Network bound • Uncompressed • Huge recordsets
  • 19. • Linux (native/VM) • MySQL 8 • sysstat • world.sql https://bit.ly/2kO70nY HOL3025 Copyright © 2019 Oracle and/or its affiliates.
  • 20. Agenda • Horizontal vs Vertical scaling • I/O Bound Workload • CPU Bound Workload • Network Bound Workload • OS-wise • Conclusions Copyright © 2019 Oracle and/or its affiliates.
  • 21. Copyright © 2019 Oracle and/or its affiliates. I/O Bound Monitoring • iostat • SHOW ENGINE INNODB STATUS • Performance schema (MEM) • SYS schema select * from sys.io_by_thread_by_latency; select * from sys.io_global_by_file_by_bytes; select * from sys.io_global_by_file_by_latency; select * from sys.waits_global_by_latency; select * from sys.statements_with_temp_tables;
  • 22. Reconfigure Move ib_logfile files Permissions START MySQL Copyright © 2019 Oracle and/or its affiliates. I/O Bound REDO Log Stop the instance, edit Custom innodb_log_group_ho me_dir and save changes. From data directory to the new directory, The files are usually ib_logfile0 and ib_logfile1, but they could be more, depending on the value of innodb_log_files_in_g roup Make sure that the MySQL server has the proper access rights to read/create files in the log directory. It will read the configuration file with the new location.
  • 23. On storage devices with cache, data loss is possible if data files and redo log files reside on different storage devices, and a crash occurs before data file writes are flushed from the device cache. If you use or intend to use different storage devices for redo logs and data files, use O_DIRECT instead. I/O Bound REDO Log Copyright © 2019 Oracle and/or its affiliates.
  • 24. I/O Bound Binary Logs Copyright © 2019 Oracle and/or its affiliates. Custom log-bin 1. Stop: systemctl stop mysqld 2. Create: /opt/mysql/binlog 3. Edit my.cnf: log_bin=/opt/mysql/binlog/binlog 4. Move binlog.* to /opt/mysql/binlog 5. Edit: binlog.index to adopt absolute paths (e.g. /opt/mysql/binlog/binlog.000011) 6. Start: systemctl start mysqld
  • 25. I/O Bound Binary Logs Copyright © 2019 Oracle and/or its affiliates. TEST 1. FLUSH BINARY LOGS; 2. SELECT @@log_bin_basename; 3. RESET MASTER;
  • 26. I/O Bound UNDO Logs Copyright © 2019 Oracle and/or its affiliates. Custom innodb_undo_directory 1. Stop: systemctl stop mysqld 2. Create: /opt/mysql/undo 3. Relocate undo_00* 4. Start: systemctl start mysqld 5. Check: 1. select @@innodb_undo_directory
  • 27. I/O Bound EXTERNAL tablespace Copyright © 2019 Oracle and/or its affiliates. • Creating a file-per-table tablespace outside of the data directory. • The DATA DIRECTORY clause cannot be used with ALTER TABLE to change the location later. • CREATE TABLE..DATA DIRECTORY TEST mysql> USE test; Database changed mysql> CREATE TABLE t1 (c1 INT PRIMARY KEY) DATA DIRECTORY = '/opt/mysql/tablespaces';
  • 28. I/O Bound GENERAL tablespace Copyright © 2019 Oracle and/or its affiliates. • Acts as a container of tablespaces, same as system tablespace • Can be located outside of the data directory • From file-per-table or system to general tablespace (ALTER) • From system or general (shared) to file-per-table (ALTER) • Directory must be known: set innodb_directories (read-only) TEST CREATE TABLESPACE `ts1` ADD DATAFILE '/opt/mysql/tablespaces/ts1.ibd' Engine=InnoDB; CREATE TABLE t1 (c1 INT PRIMARY KEY) TABLESPACE ts1;
  • 29. I/O Bound Partitioning Copyright © 2019 Oracle and/or its affiliates. • Horizontal partitioning—that is, different rows of a table may be assigned to different physical partitions. • Partitioning makes it possible to store more data in one table than can be held on a single disk or file system partition. TEST CREATE TABLE th (id INT, name VARCHAR(30), adate DATE) PARTITION BY LIST(YEAR(adate)) ( PARTITION p1999 VALUES IN (1995, 1999, 2003) DATA DIRECTORY = '/opt/mysql/tablespaces/', PARTITION p2000 VALUES IN (1996, 2000, 2004) DATA DIRECTORY = '/opt/mysql/tablespaces/' );
  • 30. I/O Bound Session and Global Temporary Tablespace Copyright © 2019 Oracle and/or its affiliates. • If no value is specified for innodb_temp_data_file_path, the default behavior is to create an auto-extending data file named ibtmp1 in the innodb_data_home_dir (system tablespace location) • Not a dynamic setting • At database start a pool of session 10 temporary tables is created • At database start, ibtmp1 is created to • Temp tables rollback segments in ibtmp1 • Example: --innodb-temp-data-file- path=../../../tmp/ibtmp1:12M:autoextend
  • 31. I/O Bound Session and Global Temporary Tablespace Copyright © 2019 Oracle and/or its affiliates. TEST • mysql> select @@innodb_temp_data_file_path; • mysql> SELECT * FROM INFORMATION_SCHEMA.FILES WHERE TABLESPACE_NAME='innodb_temporary'G • shell> ls –l <location> • Stop Server and list directory again
  • 32. I/O Bound Logging General log general_log_file Slow Query Log slow_query_log_file Audit Log audit_log_file Copyright © 2019 Oracle and/or its affiliates.
  • 33. I/O Bound Flush method Copyright © 2019 Oracle and/or its affiliates. Data can travel through different layer before reaching the durable storage.
  • 34. I/O Bound Flush method Copyright © 2019 Oracle and/or its affiliates. Flush method: innodb_flush_method (not dynamic) • fsync is default: fsync is used for both data and log file • O_DIRECT can help to avoid double buffering between the InnoDB buffer pool and the operating system file system cache. But is buffer pool is not enough, buffer cache won’t come to help. fsync is used for both data and log file • O_DIRECT_NO_FSYNC same as before, but skips fsyncs • O_DSYNC: InnoDB uses O_SYNC to open and flush the log files, and fsync() to flush the data files, only. Based on O_SYNC: nfsync(), write() calls go to buffer cache, blocks until writes are into the physical storage.
  • 35. I/O Bound Flush method monitoring Copyright © 2019 Oracle and/or its affiliates. TEST 1 1. sync; echo 1 > /proc/sys/vm/drop_caches 2. vmstat 1 30 3. mysqlslap -uroot -h127.0.0.1 -uroot -p --auto-generate-sql -- concurrency=20 --iterations=100 —number-of-queries=10 TEST 2 At different innodb_flush_method: • mysql> show status like "Innodb_data_fsyncs"; • mysql> show status like "Innodb_data_pending_fsyncs"; • bash> free -m
  • 36. I/O Bound Miscellaneous Copyright © 2019 Oracle and/or its affiliates. An all-comprehensive discussion in our official online documentation. • Disable logging of compressed pages • Act on I/O capacity for background tasks: innodb_io_capacity and innodb_flush_sync • Threshold on write buffer before fsync(): innodb_fsync_threshold • Data size • ...
  • 37. Agenda • Horizontal vs Vertical scaling • I/O Bound Workload • CPU Bound Workload • Network Bound Workload • OS-wise • Conclusions Copyright © 2019 Oracle and/or its affiliates.
  • 38. Copyright © 2019 Oracle and/or its affiliates. CPU Bound Monitoring • vmstat / mpstat • Status SHOW STATUS LIKE "Handler%"; SHOW STATUS LIKE "select_full_join"; • sys schema select * from sys.schema_redundant_indexes; select * from sys.schema_unused_indexes; select * from sys.statements_with_sorting; CALL sys.diagnostics(60, 60, 'current');
  • 39. Copyright © 2019 Oracle and/or its affiliates. CPU Bound Thread Pool High CPU may also be a good sign, no long IO wait or heavy locking. But can also be for context switches by CPU scheduler. 1. Too many thread stacks make CPU caches almost useless in highly parallel execution workloads 2. With too many threads executing in parallel, context switching overhead is high Thread pool promotes thread stack reuse The thread pool controls when transactions start to ensure that not too many execute in parallel.
  • 40. Copyright © 2019 Oracle and/or its affiliates. CPU Bound Query Tuning TEST 1. Import world.sql 2. Monitor: mpstat 1 30 3. mysqlslap -uroot -p --no-drop --create-schema=world -- query="select * from world.city where Name='Kabul';" -- concurrency=10 --iterations=1000 4. EXPLAIN SELECT * FROM world.city WHERE Name='Kabul'; 5. SELECT * FROM sys.schema_tables_with_full_table_scans; 6. CREATE INDEX city_idx ON world.city(Name); 7. Repeat the test
  • 41. Copyright © 2019 Oracle and/or its affiliates. CPU Bound Replication • In 5.6 we introduced parallel slave, that could run load for different databases in parallel. With operations split on several DBs, this could be a simple option. • In 5.7 we introduced LOGICAL_CLOCK algorithm, that allows running many transactions in parallel if they were run in parallel on master. • In 8.0 version we have introduced write sets, that allows to run some statements in parallel, even if they were executed by the same thread on master.
  • 42. Copyright © 2019 Oracle and/or its affiliates. CPU Bound Miscellaneous • Tablespace compression • Protocol compression • Thread cache • SSL • Background Checkpoint Purge Automatic Statistics Calculation
  • 43. Agenda • Horizontal vs Vertical scaling • I/O Bound Workload • CPU Bound Workload • Network Bound Workload • OS-wise • Conclusions Copyright © 2019 Oracle and/or its affiliates.
  • 44. Copyright © 2019 Oracle and/or its affiliates. NETWORK Bound Compression --compress: Compress all information sent between the client and the server if possible TEST • mysql –uroot –compress –p • mysqlslap -uroot -h127.0.0.1 -uroot -p --auto-generate-sql -- concurrency=20 --iterations=100 —number-of-queries=10 –compress • sar -n DEV 3 30 • mpstat 1 30 Look at averages
  • 45. Agenda • Horizontal vs Vertical scaling • I/O Bound Workload • CPU Bound Workload • Network Bound Workload • OS-wise • Conclusions Copyright © 2019 Oracle and/or its affiliates.
  • 46. Copyright © 2019 Oracle and/or its affiliates. OS-wise SWAP, SWAPPINESS and AFFINITY SWAP & SWAPPINESS cat /proc/sys/vm/swappiness AFFINITY At the linux OS level, you can limit the number of processors that the kernel will utilize for a user space process using numactl, or more commonly taskset.
  • 47. Copyright © 2019 Oracle and/or its affiliates. OS-wise SWAP, SWAPPINESS and AFFINITY TEST • Identify systemd configuration file: /etc/systemd/system/multi-user.target.wants/mysqld.service • Modify: [Service] CPUAffinity=1 • bash> systemctl daemon-reload
  • 48. CPU monitor Press f Last CPU used Esc OS-wise AFFINITY top -H -p <pid> To get the list of options Scroll down and select "P = Last Used Cpu (SMP)", press space bar Column on the right side will show what CPU has just been used Copyright © 2019 Oracle and/or its affiliates.
  • 49. Agenda • Horizontal vs Vertical scaling • I/O Bound Workload • CPU Bound Workload • Network Bound Workload • OS-wise • Conclusions Copyright © 2019 Oracle and/or its affiliates.
  • 50. Conclusion Setup the most reliable production-like traffic generator Test and monitor at different concurrencies Experiment! Copyright © 2019 Oracle and/or its affiliates.
  • 51. Thank You Copyright © 2019 Oracle and/or its affiliates. MySQL Principal Technical Support Engineer Oracle MySQL Support September 17, 2019 Mirko Ortensi
  • 52. Session Survey Help us make the content even better. Please complete the session survey in the Mobile App. Copyright © 2019 Oracle and/or its affiliates.
  • 53. What’s Ahead Tuesday 5pm-5.45pm Thursday Copyright © 2019 Oracle and/or its affiliates. NDB, Simply the World’s Highest- Throughput Transactional Datastore [DEV2554] Moscone South - Room 205 10am-10:45am What’s New in MySQL Optimizer and Executor? [DEV2077] Moscone South - Room 205
  • 54. The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website at http://www.oracle.com/investor. All information in this presentation is current as of September 2019 and Oracle undertakes no duty to update any statement in light of new information or future events. Safe Harbor Copyright © 2019 Oracle and/or its affiliates.