SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler offline
Maximizing
Performance via Tuning
and Optimization
Getting the most from MariaDB
Server
Jens Bollmann Consultant/Instructor
Ulrich Moser Consultant/Instructor
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
– keep 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
jens@mariadb.com
ulrich.moser@mariadb.com
Appendix
Backup Slides and More

Mais conteúdo relacionado

Mais procurados

PPCD_And_AmazonRDS
PPCD_And_AmazonRDSPPCD_And_AmazonRDS
PPCD_And_AmazonRDS
Vibhor Kumar
 

Mais procurados (20)

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®
 
Deploying MariaDB databases with containers at Nokia Networks
Deploying MariaDB databases with containers at Nokia NetworksDeploying MariaDB databases with containers at Nokia Networks
Deploying MariaDB databases with containers at Nokia Networks
 
Using all of the high availability options in MariaDB
Using all of the high availability options in MariaDBUsing all of the high availability options in MariaDB
Using all of the high availability options in MariaDB
 
CCV: migrating our payment processing system to MariaDB
CCV: migrating our payment processing system to MariaDBCCV: migrating our payment processing system to MariaDB
CCV: migrating our payment processing system to MariaDB
 
Hochverfügbarkeit mit MariaDB Enterprise - MariaDB Roadshow Summer 2014 Hambu...
Hochverfügbarkeit mit MariaDB Enterprise - MariaDB Roadshow Summer 2014 Hambu...Hochverfügbarkeit mit MariaDB Enterprise - MariaDB Roadshow Summer 2014 Hambu...
Hochverfügbarkeit mit MariaDB Enterprise - MariaDB Roadshow Summer 2014 Hambu...
 
M|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
M|18 Migrating from Oracle and Handling PL/SQL Stored ProceduresM|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
M|18 Migrating from Oracle and Handling PL/SQL Stored Procedures
 
Best practices: running high-performance databases on Kubernetes
Best practices: running high-performance databases on KubernetesBest practices: running high-performance databases on Kubernetes
Best practices: running high-performance databases on Kubernetes
 
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimization
 
How we switched to columnar at SpendHQ
How we switched to columnar at SpendHQHow we switched to columnar at SpendHQ
How we switched to columnar at SpendHQ
 
Welcome: MariaDB today and our vision for the future
Welcome: MariaDB today and our vision for the futureWelcome: MariaDB today and our vision for the future
Welcome: MariaDB today and our vision for the future
 
How Pixid dropped Oracle and went hybrid with MariaDB
How Pixid dropped Oracle and went hybrid with MariaDBHow Pixid dropped Oracle and went hybrid with MariaDB
How Pixid dropped Oracle and went hybrid with MariaDB
 
How Orwell built a geo-distributed Bank-as-a-Service with microservices
How Orwell built a geo-distributed Bank-as-a-Service with microservicesHow Orwell built a geo-distributed Bank-as-a-Service with microservices
How Orwell built a geo-distributed Bank-as-a-Service with microservices
 
Cloud Design Pattern part2
Cloud Design Pattern part2Cloud Design Pattern part2
Cloud Design Pattern part2
 
Cloud design principles
Cloud design principlesCloud design principles
Cloud design principles
 
M|18 User Defined Function
M|18 User Defined FunctionM|18 User Defined Function
M|18 User Defined Function
 
Cloud Design Pattern part1
Cloud Design Pattern part1Cloud Design Pattern part1
Cloud Design Pattern part1
 
Caching for Microservices Architectures: Session II - Caching Patterns
Caching for Microservices Architectures: Session II - Caching PatternsCaching for Microservices Architectures: Session II - Caching Patterns
Caching for Microservices Architectures: Session II - Caching Patterns
 
PPCD_And_AmazonRDS
PPCD_And_AmazonRDSPPCD_And_AmazonRDS
PPCD_And_AmazonRDS
 
What to expect from MariaDB Platform X5, part 1
What to expect from MariaDB Platform X5, part 1What to expect from MariaDB Platform X5, part 1
What to expect from MariaDB Platform X5, part 1
 
Azure reference architectures
Azure reference architecturesAzure reference architectures
Azure reference architectures
 

Semelhante a Maximizing performance via tuning and optimization

Semelhante a 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
 
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
 
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
 
MongoDB Deployment Checklist
MongoDB Deployment ChecklistMongoDB Deployment Checklist
MongoDB Deployment Checklist
 
MySQL and MariaDB
MySQL and MariaDBMySQL and MariaDB
MySQL and MariaDB
 
Running database infrastructure on containers
Running database infrastructure on containersRunning database infrastructure on containers
Running database infrastructure on containers
 
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 ...
 
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
 
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...
 
SQL Server Reporting Services Disaster Recovery webinar
SQL Server Reporting Services Disaster Recovery webinarSQL Server Reporting Services Disaster Recovery webinar
SQL Server Reporting Services Disaster Recovery webinar
 
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
 
Migrate from Oracle to Aurora PostgreSQL: Best Practices, Design Patterns, & ...
Migrate from Oracle to Aurora PostgreSQL: Best Practices, Design Patterns, & ...Migrate from Oracle to Aurora PostgreSQL: Best Practices, Design Patterns, & ...
Migrate from Oracle to Aurora PostgreSQL: Best Practices, Design Patterns, & ...
 
Data Server Manager for DB2 for z/OS
Data Server Manager for DB2 for z/OS Data Server Manager for DB2 for z/OS
Data Server Manager for DB2 for z/OS
 
SQL Server Reporting Services Disaster Recovery Webinar
SQL Server Reporting Services Disaster Recovery WebinarSQL Server Reporting Services Disaster Recovery Webinar
SQL Server Reporting Services Disaster Recovery Webinar
 
Bases de datos en la nube con AWS
Bases de datos en la nube con AWSBases de datos en la nube con AWS
Bases de datos en la nube con AWS
 
Modern MySQL Monitoring and Dashboards.
Modern MySQL Monitoring and Dashboards.Modern MySQL Monitoring and Dashboards.
Modern MySQL Monitoring and Dashboards.
 
MySQL and MariaDB
MySQL and MariaDBMySQL and MariaDB
MySQL and MariaDB
 

Mais de MariaDB plc

Mais de 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
 
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
 
What to expect from MariaDB Platform X5, part 2
What to expect from MariaDB Platform X5, part 2What to expect from MariaDB Platform X5, part 2
What to expect from MariaDB Platform X5, part 2
 

Último

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Último (20)

Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 

Maximizing performance via tuning and optimization

  • 1. Maximizing Performance via Tuning and Optimization Getting the most from MariaDB Server Jens Bollmann Consultant/Instructor Ulrich Moser Consultant/Instructor
  • 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 – keep 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