Optimizing MARIADB for Maximum Performance Manjot Singh Enterprise Architect MariaDB Corporation
What to Examine? System MariaDB Server Storage Engines Data and Query Design Applications and Users
Business Problems Applications and Users
Application Problems Applications and Users MariaDbDataSource vs MariaDbPoolDataSource maxPoolSize and minPoolSize COMMIT or ROLLBACK
Hardware System
Operating System System # sysctl -w vm.swappiness=1 # echo "vm.swappiness=1" >> /etc/sysctl.conf # echo noop > /sys/block/sda/queue/scheduler
Operating System System # cat /etc/security/limits.conf mysql soft nofile 65535 mysql hard nofile 65535 # cat /etc/fstab ... rw,noatime,nodiratime,data=writeback ...
Carefully Adjusting Flavors In Multiple Dishes MariaDB Server
Server Variables MariaDB Server max_allowed_packet = e.g. 128G-256G thread_handling = pool-of-threads thread_pool_size = # of cpu cores thread_pool_max_threads = 65536 thread_pool_min_threads = e.g. 8 thread_pool_idle_timeout = 60 max_connections = e.g. 2000-10000
Server Variables MariaDB Server query_cache_size = 0 query_cache_type = 0 skip_name_resolv = ON thread_cache_size = DON'T SET (Auto) sync_binlog = e.g. 1000
PURPOSE-BUILT STORAGE
InnoDB Multipurpose Storage Storage Engines
InnoDB Multipurpose Storage Storage Engines innodb_buffer_pool_size = e.g. 256M-900G ((Total RAM - (OS + Apps) - (mysqld memory + query buffers) - caches for things like binary log - other possible buffers and caches - memory tables) / 105% ) | ROUND_DOWN() ROUND(192G - ~10G - ~4G - ~1G - ~2G - ~3G) = 168G
InnoDB Multipurpose Storage Storage Engines innodb_buffer_pool_size = e.g. 256M-900G innodb_log_file_size = e.g. 2G-16G innodb_stats_on_metadata = 0 innodb_flush_log_at_trx_commit = e.g. 0? (IFLATC)
InnoDB Multipurpose Storage Storage Engines innodb_flush_method = O_DIRECT innodb_io_capacity = e.g. 2000 innodb_adaptive_hash_index_parts = e.g. 2-8 btr0sea.c
InnoDB Multipurpose Storage Storage Engines innodb_autoinc_lock_mode = e.g. 2 innodb_flush_neighbors = e.g. 0 w/SSD innodb_lru_scan_depth = e.g. 4096 innodb_sync_array_size = e.g. 16-32 (but < # of cpu cores)
InnoDB Multipurpose Storage Storage Engines innodb_read_io_threads = 4 innodb_write_io_threads = 4 History list length ROW_FORMAT=DYNAMIC OR COMPRESSED
MyRocks Writes and Compression Storage Engines
MyRocks Writes and Compression Storage Engines rocksdb_block_cache_size = e.g. 256M-900G Rocksdb_default_cf_options = "compaction_pri=kMinOverlappingRatio; level_compaction_dynamic_level_bytes=true;" rocksdb_max_background_jobs = (# cpu cores / 4)
MyRocks Writes and Compression Storage Engines Rocksdb_default_cf_options = "block_based_table_factory= {cache_index_and_filter_blocks=1; filter_policy=bloomfilter:10:false; whole_key_filtering=1};"
MyRocks Writes and Compression Storage Engines log-bin = 1 rocksdb_flush_log_at_trx_commit = e.g. 0?
MyRocks Writes and Compression Storage Engines latin1_bin, utf8_bin, binary INDEX index_name(col1, ...) COMMENT 'family_name' rocksdb_max_open_files = -1
MyRocks Writes and Compression Storage Engines SET session sql_log_bin=0; SET session rocksdb_bulk_load_allow_unsorted=1; SET session rocksdb_bulk_load=1; SET session rocksdb_commit_in_the_middle=1; ... SET session rocksdb_bulk_load=0; SET session rocksdb_bulk_load_allow_unsorted=0;
Aria System and Temp Storage Engines
Aria System and Temp Storage Engines aria_pagecache_buffer_size = e.g. 256M-64G aria_block_size = e.g. 2048-8096 aria_group_commit = "hard" aria_group_commit_interval = 0
Aria System and Temp Storage Engines aria_pagecache_file_hash_size = e.g. 10% open files aria_repair_threads = e.g. 4
Schema Schmema Data and Query Design SELECT col1 FROM t1 PROCEDURE ANALYSE() G
What the Query? Data and Query Design
Look it Up Data and Query Design
Place Image HereTake Another Look
THANK YOU!
Questions
THANK YOU!

Optimizing MariaDB for maximum performance