SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
Maximizing
Performance via
Tuning and
Optimization
Getting the most from MariaDB
Server
Agenda • General Best Practices
• Server, Storage, Network and O/S
• Connections & Pooling
• MariaDB Config Settings
• Query Tuning
• Q&A
MariaDB Server + InnoDB
General Best Practices
Maybe obvious, but worth repeating
• Service Level Agreements (SLAs)
– Individual Biz/App Transactions
– Throughput
– Latency (at percentile)
– Peaks of peaks or favorable scheduling?
• Translate to Database Transactions
Define Target
Capture Metrics
• Biz/App Transactions
– Code Instrumentation
– Synthetic Transactions
– Compare to defined SLAs
• Database Transactions
• Sub-system level
– Servers (Web, App, DB, etc…)
– Storage
– Network
– Database
History
Alerts
Leverage your Metrics
Avoiding Cliffs • Understand expected business volumes
• Watch system-level stats for saturation
• Stress testing
– Sysbench
– HammerDB
– TPC
– Many others….
– Custom
Server, Storage, Network and O/S
Core Infrastructure
• Dedicated Server
• Memory
– More usually helps (up to ~dataset size)
– Important with read-heavy + slow disk
• More CPUs
– Highly concurrent use cases
– Usually favored over faster CPUs
• Faster CPUs
– Less concurrent use cases
– Dataset fits in memory
Database Server
• Local or SAN over NAS
– Performance
• SSD over HHD
– Performance and MTBF
– SSD wear not usually a factor
• SSDs
– Consumer
– Prosumer
– PCIe
– NVMe
Storage
• Can be Bandwidth Hungry
– Regular client traffic
– Replication Traffic
– Rebuilding replicas from snapshots
• Stability matters for Replication
• Sometimes overlooked as potential
bottleneck
• Efficient DNS setup*
Network
• vm.swappiness = 10
• ext4 or xfs for data files
• noatime for filesystem mounts
• ulimit changes
OS (Linux)
mariadb.com/kb/en/library/operating-system-optimizations/
Connections & Pooling
Applying Back Pressure
Back Pressure in the Full Stack
Firewall/LB Web Servers App Servers MaxScale MariaDB
Server(s)
MariaDB Connection Controls
App Servers MaxScale MariaDB
Server(s)
max_connections
wait_timeout
thread_handling
thread_pool_max_threads
thread_pool_min_threads
thread_pool_idle_timeout
...
MariaDBDataSource
MariaDBPoolDataSource
maxPoolSize
minPoolSize
...
Outbound
persistpoolmax
persistmaxtime
Inbound
max_connections
connection_timeout
Further Reading
• Java Connector Pooling
mariadb.com/kb/en/library/pool-datasource-implementation/
• MaxScale
mariadb.com/kb/en/mariadb-enterprise/mariadb-maxscale-22/maxscale-configuration-
usage-scenarios/#server
mariadb.com/kb/en/mariadb-enterprise/mariadb-maxscale-22/maxscale-configuration-
usage-scenarios/#server
• Server Thread Pools
mariadb.com/kb/en/library/thread-pool-in-mariadb/
mariadb.com/kb/en/library/thread-pool-system-and-status-variables/
Configuration Settings
Common Settings with Performance Impact
• Runtime changes via SET GLOBAL
• Make permanent with changes to my.cnf
– Make sure you have right my.cnf
– Verify with SHOW GLOBAL
• One change at a time
• Production changes
– tested, reviewed, version controlled
Changing Config
Settings
my.cnf
Config Settings (1 of 2)
innodb_buffer_pool_size
innodb_log_file_size
innodb_file_per_table
query_cache_size
max_connections
Config Settings (2 of 2)
tmp_table_size
max_heap_table_size
join_buffer_size
sort_buffer_size
Query Tuning
There are always more queries to tune
Finding Slow
Queries
slow_query_log = 1
slow_query_log-file = /var/lib/mysql/myslow.log
long_query_time = 10
Pay attention to similar queries and the
query count
Analyzing Slow
Queries
EXPLAIN
SELECT *
FROM employees
WHERE MONTH(birth_date) = 8 G
id: 1
select_type: SIMPLE
table: employees
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 299587
Extra: Using where
• Poor Indexing #1 Reason for poor
performance
• Basics of B-Tree Indexing same across
relational systems
• Space/Performance Tradeoff
• Write/Read Tradeoff
Indexing
• PRIMARY KEY = Clustered Index
• Secondary Indexes reference hold
primary key
– key PRIMARY KEY small
• InnoDB Table Stats
• Optimizer Hints
– https://mariadb.com/kb/en/library/optimizer-hints/
InnoDB
Indexing Tips
Query Tuning
SHOW STATUS
Global or Session
● Returns List of Internal Counters
● GLOBAL for System-Wide Status — Since
Start-Up
● SESSION for Local to Client Connection
● FLUSH STATUS Resets Local Counters
● Monitor Changes to Counters to Identify Hot
Spots
● Collect Periodically Status Snapshots to Profile
Traffic
Query Tuning
PERFORMANCE_SCHEMA
● Similar to INFORMATION_SCHEMA , but
Performance Tuning
● Monitors MariaDB Server Events
● Function Calls, Operating System Waits, Internal
Mutexes, I/O Calls
● Detailed Query Execution Stages (Parsing,
Statistics, Sorting)
● Some Features Storage Engine Specific
● Monitoring Lightweight and Requires No
Dedicated Thread
● Designed to be Used Iteratively with Successive
Refinement
Q&A
Thank you
james.mclaurin@mariadb.com.
Appendix
Backup Slides and More

Weitere ähnliche Inhalte

Was ist angesagt?

MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera Cluster
Abdul Manaf
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Dvir Volk
 
Achieve Extreme Simplicity and Superior Price/Performance with Greenplum Buil...
Achieve Extreme Simplicity and Superior Price/Performance with Greenplum Buil...Achieve Extreme Simplicity and Superior Price/Performance with Greenplum Buil...
Achieve Extreme Simplicity and Superior Price/Performance with Greenplum Buil...
VMware Tanzu
 

Was ist angesagt? (20)

Maxscale switchover, failover, and auto rejoin
Maxscale switchover, failover, and auto rejoinMaxscale switchover, failover, and auto rejoin
Maxscale switchover, failover, and auto rejoin
 
MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera Cluster
 
MariaDB MaxScale
MariaDB MaxScaleMariaDB MaxScale
MariaDB MaxScale
 
Optimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performanceOptimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performance
 
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestrator
 
Maria db 이중화구성_고민하기
Maria db 이중화구성_고민하기Maria db 이중화구성_고민하기
Maria db 이중화구성_고민하기
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Galera Cluster Best Practices for DBA's and DevOps Part 1
Galera Cluster Best Practices for DBA's and DevOps Part 1Galera Cluster Best Practices for DBA's and DevOps Part 1
Galera Cluster Best Practices for DBA's and DevOps Part 1
 
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
 
MariaDB Optimization
MariaDB OptimizationMariaDB Optimization
MariaDB Optimization
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
 
MySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.comMySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.com
 
MySQL Performance for DevOps
MySQL Performance for DevOpsMySQL Performance for DevOps
MySQL Performance for DevOps
 
MySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptxMySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptx
 
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Almost Perfect Service Discovery and Failover with ProxySQL and OrchestratorAlmost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
 
Load Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - SlidesLoad Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - Slides
 
MySQL GTID 시작하기
MySQL GTID 시작하기MySQL GTID 시작하기
MySQL GTID 시작하기
 
Achieve Extreme Simplicity and Superior Price/Performance with Greenplum Buil...
Achieve Extreme Simplicity and Superior Price/Performance with Greenplum Buil...Achieve Extreme Simplicity and Superior Price/Performance with Greenplum Buil...
Achieve Extreme Simplicity and Superior Price/Performance with Greenplum Buil...
 
Using galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wanUsing galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wan
 

Ähnlich wie Maximizing performance via tuning and optimization

PPCD_And_AmazonRDS
PPCD_And_AmazonRDSPPCD_And_AmazonRDS
PPCD_And_AmazonRDS
Vibhor Kumar
 

Ähnlich wie Maximizing performance via tuning and optimization (20)

Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimization
 
Höchste Datenbankleistung durch Anpassung und Optimierung
Höchste Datenbankleistung durch Anpassung und OptimierungHöchste Datenbankleistung durch Anpassung und Optimierung
Höchste Datenbankleistung durch Anpassung und Optimierung
 
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimization
 
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimization
 
Deep Dive on MySQL Databases on AWS - AWS Online Tech Talks
Deep Dive on MySQL Databases on AWS - AWS Online Tech TalksDeep Dive on MySQL Databases on AWS - AWS Online Tech Talks
Deep Dive on MySQL Databases on AWS - AWS Online Tech Talks
 
Migración desde BBDD propietarias a MariaDB
Migración desde BBDD propietarias a MariaDBMigración desde BBDD propietarias a MariaDB
Migración desde BBDD propietarias a MariaDB
 
Running database infrastructure on containers
Running database infrastructure on containersRunning database infrastructure on containers
Running database infrastructure on containers
 
Database Security Threats - MariaDB Security Best Practices
Database Security Threats - MariaDB Security Best PracticesDatabase Security Threats - MariaDB Security Best Practices
Database Security Threats - MariaDB Security Best Practices
 
MySQL and MariaDB
MySQL and MariaDBMySQL and MariaDB
MySQL and MariaDB
 
Open Source Databases on the Cloud - Peter Dachnowicz
Open Source Databases on the Cloud - Peter DachnowiczOpen Source Databases on the Cloud - Peter Dachnowicz
Open Source Databases on the Cloud - Peter Dachnowicz
 
MaxScale - The Pluggable Router
MaxScale - The Pluggable RouterMaxScale - The Pluggable Router
MaxScale - The Pluggable Router
 
Open Source Managed Databases: Database Week San Francisco
Open Source Managed Databases: Database Week San FranciscoOpen Source Managed Databases: Database Week San Francisco
Open Source Managed Databases: Database Week San Francisco
 
PPCD_And_AmazonRDS
PPCD_And_AmazonRDSPPCD_And_AmazonRDS
PPCD_And_AmazonRDS
 
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
 
MySQL and MariaDB
MySQL and MariaDBMySQL and MariaDB
MySQL and MariaDB
 
MySQL Transformation Case Study: 80% Cost Savings & Uninterrupted Availabilit...
MySQL Transformation Case Study: 80% Cost Savings & Uninterrupted Availabilit...MySQL Transformation Case Study: 80% Cost Savings & Uninterrupted Availabilit...
MySQL Transformation Case Study: 80% Cost Savings & Uninterrupted Availabilit...
 
Database Security Threats - MariaDB Security Best Practices
Database Security Threats - MariaDB Security Best PracticesDatabase Security Threats - MariaDB Security Best Practices
Database Security Threats - MariaDB Security Best Practices
 
Modern MySQL Monitoring and Dashboards.
Modern MySQL Monitoring and Dashboards.Modern MySQL Monitoring and Dashboards.
Modern MySQL Monitoring and Dashboards.
 
Configuring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web PerormanceConfiguring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web Perormance
 
Building and Deploying Large Scale SSRS using Lessons Learned from Customer D...
Building and Deploying Large Scale SSRS using Lessons Learned from Customer D...Building and Deploying Large Scale SSRS using Lessons Learned from Customer D...
Building and Deploying Large Scale SSRS using Lessons Learned from Customer D...
 

Mehr von MariaDB plc

Mehr von MariaDB plc (20)

MariaDB Paris Workshop 2023 - MaxScale 23.02.x
MariaDB Paris Workshop 2023 - MaxScale 23.02.xMariaDB Paris Workshop 2023 - MaxScale 23.02.x
MariaDB Paris Workshop 2023 - MaxScale 23.02.x
 
MariaDB Paris Workshop 2023 - Newpharma
MariaDB Paris Workshop 2023 - NewpharmaMariaDB Paris Workshop 2023 - Newpharma
MariaDB Paris Workshop 2023 - Newpharma
 
MariaDB Paris Workshop 2023 - Cloud
MariaDB Paris Workshop 2023 - CloudMariaDB Paris Workshop 2023 - Cloud
MariaDB Paris Workshop 2023 - Cloud
 
MariaDB Paris Workshop 2023 - MariaDB Enterprise
MariaDB Paris Workshop 2023 - MariaDB EnterpriseMariaDB Paris Workshop 2023 - MariaDB Enterprise
MariaDB Paris Workshop 2023 - MariaDB Enterprise
 
MariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance OptimizationMariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance Optimization
 
MariaDB Paris Workshop 2023 - MaxScale
MariaDB Paris Workshop 2023 - MaxScale MariaDB Paris Workshop 2023 - MaxScale
MariaDB Paris Workshop 2023 - MaxScale
 
MariaDB Paris Workshop 2023 - novadys presentation
MariaDB Paris Workshop 2023 - novadys presentationMariaDB Paris Workshop 2023 - novadys presentation
MariaDB Paris Workshop 2023 - novadys presentation
 
MariaDB Paris Workshop 2023 - DARVA presentation
MariaDB Paris Workshop 2023 - DARVA presentationMariaDB Paris Workshop 2023 - DARVA presentation
MariaDB Paris Workshop 2023 - DARVA presentation
 
MariaDB Tech und Business Update Hamburg 2023 - MariaDB Enterprise Server
MariaDB Tech und Business Update Hamburg 2023 - MariaDB Enterprise Server MariaDB Tech und Business Update Hamburg 2023 - MariaDB Enterprise Server
MariaDB Tech und Business Update Hamburg 2023 - MariaDB Enterprise Server
 
MariaDB SkySQL Autonome Skalierung, Observability, Cloud-Backup
MariaDB SkySQL Autonome Skalierung, Observability, Cloud-BackupMariaDB SkySQL Autonome Skalierung, Observability, Cloud-Backup
MariaDB SkySQL Autonome Skalierung, Observability, Cloud-Backup
 
Einführung : MariaDB Tech und Business Update Hamburg 2023
Einführung : MariaDB Tech und Business Update Hamburg 2023Einführung : MariaDB Tech und Business Update Hamburg 2023
Einführung : MariaDB Tech und Business Update Hamburg 2023
 
Hochverfügbarkeitslösungen mit MariaDB
Hochverfügbarkeitslösungen mit MariaDBHochverfügbarkeitslösungen mit MariaDB
Hochverfügbarkeitslösungen mit MariaDB
 
Die Neuheiten in MariaDB Enterprise Server
Die Neuheiten in MariaDB Enterprise ServerDie Neuheiten in MariaDB Enterprise Server
Die Neuheiten in MariaDB Enterprise Server
 
Global Data Replication with Galera for Ansell Guardian®
Global Data Replication with Galera for Ansell Guardian®Global Data Replication with Galera for Ansell Guardian®
Global Data Replication with Galera for Ansell Guardian®
 
Introducing workload analysis
Introducing workload analysisIntroducing workload analysis
Introducing workload analysis
 
Under the hood: SkySQL monitoring
Under the hood: SkySQL monitoringUnder the hood: SkySQL monitoring
Under the hood: SkySQL monitoring
 
Introducing the R2DBC async Java connector
Introducing the R2DBC async Java connectorIntroducing the R2DBC async Java connector
Introducing the R2DBC async Java connector
 
MariaDB Enterprise Tools introduction
MariaDB Enterprise Tools introductionMariaDB Enterprise Tools introduction
MariaDB Enterprise Tools introduction
 
Faster, better, stronger: The new InnoDB
Faster, better, stronger: The new InnoDBFaster, better, stronger: The new InnoDB
Faster, better, stronger: The new InnoDB
 
The architecture of SkySQL
The architecture of SkySQLThe architecture of SkySQL
The architecture of SkySQL
 

Kürzlich hochgeladen

Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
amitlee9823
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
amitlee9823
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
amitlee9823
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
JoseMangaJr1
 

Kürzlich hochgeladen (20)

Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
ELKO dropshipping via API with DroFx.pptx
ELKO dropshipping via API with DroFx.pptxELKO dropshipping via API with DroFx.pptx
ELKO dropshipping via API with DroFx.pptx
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
 
Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science Project
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 

Maximizing performance via tuning and optimization

  • 2. Agenda • General Best Practices • Server, Storage, Network and O/S • Connections & Pooling • MariaDB Config Settings • Query Tuning • Q&A
  • 4. General Best Practices Maybe obvious, but worth repeating
  • 5. • Service Level Agreements (SLAs) – Individual Biz/App Transactions – Throughput – Latency (at percentile) – Peaks of peaks or favorable scheduling? • Translate to Database Transactions Define Target
  • 6. Capture Metrics • Biz/App Transactions – Code Instrumentation – Synthetic Transactions – Compare to defined SLAs • Database Transactions • Sub-system level – Servers (Web, App, DB, etc…) – Storage – Network – Database
  • 8. Avoiding Cliffs • Understand expected business volumes • Watch system-level stats for saturation • Stress testing – Sysbench – HammerDB – TPC – Many others…. – Custom
  • 9. Server, Storage, Network and O/S Core Infrastructure
  • 10. • Dedicated Server • Memory – More usually helps (up to ~dataset size) – Important with read-heavy + slow disk • More CPUs – Highly concurrent use cases – Usually favored over faster CPUs • Faster CPUs – Less concurrent use cases – Dataset fits in memory Database Server
  • 11. • Local or SAN over NAS – Performance • SSD over HHD – Performance and MTBF – SSD wear not usually a factor • SSDs – Consumer – Prosumer – PCIe – NVMe Storage
  • 12. • Can be Bandwidth Hungry – Regular client traffic – Replication Traffic – Rebuilding replicas from snapshots • Stability matters for Replication • Sometimes overlooked as potential bottleneck • Efficient DNS setup* Network
  • 13. • vm.swappiness = 10 • ext4 or xfs for data files • noatime for filesystem mounts • ulimit changes OS (Linux) mariadb.com/kb/en/library/operating-system-optimizations/
  • 15. Back Pressure in the Full Stack Firewall/LB Web Servers App Servers MaxScale MariaDB Server(s)
  • 16. MariaDB Connection Controls App Servers MaxScale MariaDB Server(s) max_connections wait_timeout thread_handling thread_pool_max_threads thread_pool_min_threads thread_pool_idle_timeout ... MariaDBDataSource MariaDBPoolDataSource maxPoolSize minPoolSize ... Outbound persistpoolmax persistmaxtime Inbound max_connections connection_timeout
  • 17. Further Reading • Java Connector Pooling mariadb.com/kb/en/library/pool-datasource-implementation/ • MaxScale mariadb.com/kb/en/mariadb-enterprise/mariadb-maxscale-22/maxscale-configuration- usage-scenarios/#server mariadb.com/kb/en/mariadb-enterprise/mariadb-maxscale-22/maxscale-configuration- usage-scenarios/#server • Server Thread Pools mariadb.com/kb/en/library/thread-pool-in-mariadb/ mariadb.com/kb/en/library/thread-pool-system-and-status-variables/
  • 18. Configuration Settings Common Settings with Performance Impact
  • 19. • Runtime changes via SET GLOBAL • Make permanent with changes to my.cnf – Make sure you have right my.cnf – Verify with SHOW GLOBAL • One change at a time • Production changes – tested, reviewed, version controlled Changing Config Settings my.cnf
  • 20. Config Settings (1 of 2) innodb_buffer_pool_size innodb_log_file_size innodb_file_per_table query_cache_size max_connections
  • 21. Config Settings (2 of 2) tmp_table_size max_heap_table_size join_buffer_size sort_buffer_size
  • 22. Query Tuning There are always more queries to tune
  • 23. Finding Slow Queries slow_query_log = 1 slow_query_log-file = /var/lib/mysql/myslow.log long_query_time = 10 Pay attention to similar queries and the query count
  • 24. Analyzing Slow Queries EXPLAIN SELECT * FROM employees WHERE MONTH(birth_date) = 8 G id: 1 select_type: SIMPLE table: employees type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 299587 Extra: Using where
  • 25. • Poor Indexing #1 Reason for poor performance • Basics of B-Tree Indexing same across relational systems • Space/Performance Tradeoff • Write/Read Tradeoff Indexing
  • 26. • PRIMARY KEY = Clustered Index • Secondary Indexes reference hold primary key – key PRIMARY KEY small • InnoDB Table Stats • Optimizer Hints – https://mariadb.com/kb/en/library/optimizer-hints/ InnoDB Indexing Tips
  • 27. Query Tuning SHOW STATUS Global or Session ● Returns List of Internal Counters ● GLOBAL for System-Wide Status — Since Start-Up ● SESSION for Local to Client Connection ● FLUSH STATUS Resets Local Counters ● Monitor Changes to Counters to Identify Hot Spots ● Collect Periodically Status Snapshots to Profile Traffic
  • 28. Query Tuning PERFORMANCE_SCHEMA ● Similar to INFORMATION_SCHEMA , but Performance Tuning ● Monitors MariaDB Server Events ● Function Calls, Operating System Waits, Internal Mutexes, I/O Calls ● Detailed Query Execution Stages (Parsing, Statistics, Sorting) ● Some Features Storage Engine Specific ● Monitoring Lightweight and Requires No Dedicated Thread ● Designed to be Used Iteratively with Successive Refinement
  • 29. Q&A