{"id":13726,"date":"2025-12-20T10:21:04","date_gmt":"2025-12-20T04:51:04","guid":{"rendered":"https:\/\/www.youstable.com\/blog\/?p=13726"},"modified":"2025-12-20T10:21:06","modified_gmt":"2025-12-20T04:51:06","slug":"how-to-optimize-mariadb-on-linux-server","status":"publish","type":"post","link":"https:\/\/www.youstable.com\/blog\/how-to-optimize-mariadb-on-linux-server","title":{"rendered":"How to Optimize MariaDB on Linux Server &#8211; Easy Guide"},"content":{"rendered":"\n<p><strong>To optimize MariaDB on Linux server<\/strong>, update to the latest stable MariaDB build, tune the OS for I\/O and memory, configure core InnoDB settings (buffer pool, log files, flush method), enable and analyze the slow query log, fix indexes and queries, right-size connection\/buffer limits, and continuously monitor with PMM\/Prometheus to iterate based on workload.<\/p>\n\n\n\n<p>Optimizing MariaDB on a Linux server is a structured process: prepare the OS, tune MariaDB\u2019s configuration for InnoDB, profile queries, and monitor continuously. In this guide, I\u2019ll show you how to optimize MariaDB on Linux server step-by-step, using settings and processes that work reliably in production environments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"why-mariadb-performance-tuning-matters\"><strong>Why MariaDB Performance Tuning Matters<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"886\" height=\"862\" src=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/image-81.png\" alt=\"  Why MariaDB Performance Tuning Matters\" class=\"wp-image-13964\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/image-81.png 886w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/image-81-150x146.png 150w\" sizes=\"auto, (max-width: 886px) 100vw, 886px\" \/><\/figure>\n\n\n\n<p>MariaDB powers critical web applications and WordPress sites. Poor defaults, unindexed queries, and OS bottlenecks lead to latency, timeouts, and resource waste. Tuning improves throughput, reduces CPU and disk pressure, and safeguards stability during traffic spikes. Whether you run a single VPS or a cluster, small adjustments often deliver big wins.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"quick-checklist-optimize-mariadb-on-linux-server\"><strong>Quick Checklist: Optimize MariaDB on Linux Server<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install the latest stable MariaDB from official repos<\/li>\n\n\n\n<li>Disable Transparent Huge Pages (THP), set swappiness, and tune I\/O scheduler<\/li>\n\n\n\n<li>Right-size <code>innodb_buffer_pool_size<\/code>, logs, and flush settings<\/li>\n\n\n\n<li>Set realistic <code>max_connections<\/code> and per-thread buffers<\/li>\n\n\n\n<li>Enable the <a href=\"https:\/\/www.youstable.com\/blog\/fix-slow-wordpress-site\/\">slow query log and fix<\/a> the top offenders<\/li>\n\n\n\n<li>Use <code>EXPLAIN<\/code> and proper indexing; avoid <code>SELECT *<\/code><\/li>\n\n\n\n<li>Monitor with PMM\/Prometheus; test with sysbench<\/li>\n\n\n\n<li>Iterate safely (staging first), document changes, and back up<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"prepare-the-linux-server\"><strong>Prepare the Linux Server<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"os-updates-filesystem-and-i-o-basics\"><strong>OS updates, filesystem, and I\/O basics<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Update packages and kernel for performance and security.<\/li>\n\n\n\n<li>Use XFS or ext4 with <code>noatime<\/code> on database volumes to reduce write amplification.<\/li>\n\n\n\n<li>Place data on fast SSD\/NVMe with consistent IOPS; avoid noisy neighbors on shared storage.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code># Ubuntu\/Debian\nsudo apt update &amp;&amp; sudo apt -y upgrade\n\n# CentOS\/Rocky\/Alma\nsudo dnf -y update\n\n# Example fstab noatime (verify device and path before applying)\nUUID=xxxx  \/var\/lib\/mysql  xfs  defaults,noatime  0 2<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"disable-thp-set-swappiness-and-raise-limits\"><strong>Disable THP, set swappiness, and raise limits<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Disable Transparent Huge Pages (reduces stalls for database workloads).<\/li>\n\n\n\n<li>Set <code>vm.swappiness<\/code> to 1\u201310 to minimize swapping under memory pressure.<\/li>\n\n\n\n<li>Increase file descriptors and process limits for the <code>mysql<\/code> user.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code># Disable THP (runtime; also <a href=\"https:\/\/www.youstable.com\/blog\/how-to-configure-ssh-backup-via-jetbackup-in-directadmin\/\">configure via<\/a> systemd for persistence)\necho never | sudo tee \/sys\/kernel\/mm\/transparent_hugepage\/enabled\necho never | sudo tee \/sys\/kernel\/mm\/transparent_hugepage\/defrag\n\n# Lower swappiness\necho \"vm.swappiness=10\" | sudo tee \/etc\/sysctl.d\/99-mariadb-tuning.conf\nsudo sysctl --system\n\n# Raise limits\necho -e \"* soft nofile 65536\\n* hard nofile 65536\\nmysql soft nofile 65536\\nmysql hard nofile 65536\" | sudo tee -a \/etc\/security\/limits.conf<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"install-or-upgrade-to-the-latest-mariadb\"><strong>Install or Upgrade to the Latest MariaDB<\/strong><\/h2>\n\n\n\n<p>Use the official MariaDB repository for current stable releases. Newer versions often include optimizer, InnoDB, and replication improvements that directly impact performance.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Example: <a href=\"https:\/\/www.youstable.com\/blog\/install-mariadb-on-linux-server\/\">Install MariaDB<\/a> 10.11 on Ubuntu (check https:\/\/mariadb.org\/download\/)\nsudo apt install -y software-properties-common curl\ncurl -LsS https:\/\/downloads.mariadb.com\/MariaDB\/mariadb_repo_setup | sudo bash\nsudo apt update &amp;&amp; sudo apt install -y mariadb-server mariadb-client\n\n# Verify version\nmariadb --version<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"configure-mariadb-for-innodb-workloads\"><strong>Configure MariaDB for InnoDB Workloads<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"core-innodb-settings-that-move-the-needle\"><strong>Core InnoDB settings that move the needle<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>innodb_buffer_pool_size<\/strong>: The biggest lever. For a <a href=\"https:\/\/www.youstable.com\/blog\/secure-dedicated-server\/\">dedicated DB server<\/a>, start at 60\u201375% of RAM. Example: 8 GB RAM \u2192 5\u20136 GB.<\/li>\n\n\n\n<li><strong>innodb_log_file_size<\/strong>: Larger logs reduce checkpoints. Start at 1\u20134 GB total log capacity. Ensure <code>innodb_log_files_in_group=2<\/code>.<\/li>\n\n\n\n<li><strong>innodb_flush_method=O_DIRECT<\/strong>: Avoid double-buffering to reduce fs cache pressure (especially on SSD\/NVMe).<\/li>\n\n\n\n<li><strong>innodb_flush_log_at_trx_commit<\/strong>: <code>1<\/code> for maximum durability; <code>2<\/code> for balanced performance; <code>0<\/code> for fastest but least durable. Most production OLTP: <code>1<\/code> or <code>2<\/code>.<\/li>\n\n\n\n<li><strong>innodb_io_capacity<\/strong>\/<strong>innodb_io_capacity_max<\/strong>: Match underlying disk. NVMe can use 2000\/4000; SATA SSD ~200\/400.<\/li>\n\n\n\n<li><strong>innodb_buffer_pool_instances<\/strong>: 4\u20138 instances help on larger pools (&gt;4 GB) to reduce contention.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"connections-and-thread-buffers\"><strong>Connections and thread buffers<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>max_connections<\/strong>: Set based on your app and RAM. Too high causes memory blow-ups under spikes. Start 150\u2013300; load test.<\/li>\n\n\n\n<li><strong>thread_cache_size<\/strong>: 50\u2013100 to reuse threads and reduce overhead.<\/li>\n\n\n\n<li><strong>Per-thread buffers<\/strong>: <code>sort_buffer_size<\/code>, <code>join_buffer_size<\/code>, <code>read_buffer_size<\/code>, <code>read_rnd_buffer_size<\/code> are allocated per connection. Keep modest (e.g., 1\u20134 MB) to prevent memory bloat.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"temporary-tables-and-joins\"><strong>Temporary tables and joins<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>tmp_table_size<\/strong> and <strong>max_heap_table_size<\/strong>: Match these (e.g., 64\u2013256 MB) to reduce on-disk temp tables. Watch <code>Created_tmp_disk_tables<\/code>.<\/li>\n\n\n\n<li>Optimize queries to avoid large implicit temporary tables; add indexes for sort\/group columns.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"logging-cache-and-durability-trade-offs\"><strong>Logging, cache, and durability trade-offs<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>slow_query_log=ON<\/strong> with <strong>long_query_time<\/strong> set to 0.2\u20131.0 sec to capture real offenders.<\/li>\n\n\n\n<li><strong>query cache<\/strong>: Often disabled by default on modern MariaDB and generally not recommended for write-heavy workloads. If you have a read-mostly workload, test carefully; otherwise leave it off (<code>query_cache_type=0<\/code>).<\/li>\n\n\n\n<li>Enable <strong>performance_schema<\/strong> if you use PMM\/advanced monitoring (minor overhead; worth it for visibility).<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"example-my-cnf-for-a-8-gb-dedicated-vm\"><strong>Example my.cnf for a 8 GB dedicated VM<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;mysqld]\nbind-address = 127.0.0.1\n\n# InnoDB\ninnodb_buffer_pool_size = 6G\ninnodb_buffer_pool_instances = 6\ninnodb_log_file_size = 1G\ninnodb_log_files_in_group = 2\ninnodb_flush_log_at_trx_commit = 1\ninnodb_flush_method = O_DIRECT\ninnodb_io_capacity = 800\ninnodb_io_capacity_max = 1600\ninnodb_file_per_table = 1\n\n# Connections &amp; threads\nmax_connections = 250\nthread_cache_size = 64\ntable_open_cache = 4096\nopen_files_limit = 65536\n\n# Per-thread buffers (keep modest)\nsort_buffer_size = 2M\njoin_buffer_size = 2M\nread_buffer_size = 1M\nread_rnd_buffer_size = 2M\n\n# Temp tables\ntmp_table_size = 128M\nmax_heap_table_size = 128M\n\n# Logging and analysis\nslow_query_log = ON\nslow_query_log_file = \/var\/log\/mysql\/mariadb-slow.log\nlong_query_time = 0.5\nlog_error = \/var\/log\/mysql\/error.log\n\n# Query cache (usually OFF)\nquery_cache_type = 0\nquery_cache_size = 0\n\n# Performance schema (for monitoring)\nperformance_schema = ON<\/code><\/pre>\n\n\n\n<p>Always backup your existing config and restart MariaDB gracefully after changes, then validate with <code>SHOW VARIABLES<\/code> and logs to confirm the server applied your settings.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"profile-and-tune-your-queries\"><strong>Profile and Tune Your Queries<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"enable-the-slow-query-log-and-analyze\"><strong>Enable the slow query log and analyze<\/strong><\/h3>\n\n\n\n<p>The fastest way to improve performance is to fix the worst queries first. Log them, then analyze.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Enable and set a practical threshold\nSET GLOBAL slow_query_log = 'ON';\nSET GLOBAL long_query_time = 0.5;\n\n# Use pt-query-digest to find top offenders\nsudo apt install -y percona-toolkit\nsudo pt-query-digest \/var\/log\/mysql\/mariadb-slow.log | less<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"use-explain-and-optimize-indexes\"><strong>Use EXPLAIN and optimize indexes<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add indexes for WHERE, JOIN, and ORDER BY columns.<\/li>\n\n\n\n<li>Prefer composite indexes matching your most selective filters in left-to-right order.<\/li>\n\n\n\n<li>Avoid <code>SELECT *<\/code>; select only needed columns to reduce I\/O.<\/li>\n\n\n\n<li>Keep data types compact; use <code>INT<\/code> over <code>BIGINT<\/code> where possible; avoid oversized <code>VARCHAR<\/code>.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>EXPLAIN ANALYZE\nSELECT o.id, o.created_at, c.email\nFROM orders o\nJOIN customers c ON c.id = o.customer_id\nWHERE o.created_at &gt; NOW() - INTERVAL 7 DAY\nAND c.status = 'active'\nORDER BY o.created_at DESC\nLIMIT 50;<\/code><\/pre>\n\n\n\n<p>Look for full table scans on large tables, filesorts, and <code>Using temporary<\/code>. Add or adjust indexes to achieve <code>ref<\/code>\/<code>range<\/code>\/<code>const<\/code> access with minimal rows examined.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"monitor-test-and-iterate\"><strong>Monitor, Test, and Iterate<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"key-metrics-to-watch\"><strong>Key metrics to watch<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Buffer pool hit ratio<\/strong>: High 99%+ for hot datasets; otherwise expect I\/O waits.<\/li>\n\n\n\n<li><strong>InnoDB row operations<\/strong> and <strong>log flushes<\/strong>: Gauge write pressure.<\/li>\n\n\n\n<li><strong>Threads_connected<\/strong>, <strong>Threads_running<\/strong>, and <strong>max_used_connections<\/strong>: Identify saturation and connection storms.<\/li>\n\n\n\n<li><strong>Created_tmp_disk_tables<\/strong>, <strong>Sort_merge_passes<\/strong>: Too many indicates buffer sizing or indexing issues.<\/li>\n\n\n\n<li>System metrics: CPU steal, I\/O latency, iowait, memory pressure.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"load-test-before-and-after-changes\"><strong>Load test before and after changes<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Example sysbench OLTP read\/write test\nsudo apt install -y sysbench\nsysbench \/usr\/share\/sysbench\/oltp_read_write.lua \\\n  --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=secret \\\n  --mysql-db=sbtest --tables=8 --table-size=100000 \\\n  prepare\n\nsysbench \/usr\/share\/sysbench\/oltp_read_write.lua \\\n  --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=secret \\\n  --mysql-db=sbtest --tables=8 --table-size=100000 \\\n  --threads=32 --time=60 --report-interval=10 run\n\nsysbench \/usr\/share\/sysbench\/oltp_read_write.lua \\\n  --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=secret \\\n  --mysql-db=sbtest --tables=8 --table-size=100000 \\\n  cleanup<\/code><\/pre>\n\n\n\n<p>Use a staging server to validate settings, compare TPS\/QPS, latency, and error rates, then promote changes to production during a low-traffic window.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"common-pitfalls-to-avoid\"><strong>Common Pitfalls to Avoid<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Oversizing per-thread buffers<\/strong>: With hundreds of connections, this can exhaust RAM.<\/li>\n\n\n\n<li><strong>Setting max_connections too high<\/strong>: Leads to swapping and lockups; prefer a sane cap and connection pooling.<\/li>\n\n\n\n<li><strong>Ignoring the slow query log<\/strong>: Configuration tuning <a href=\"https:\/\/www.youstable.com\/blog\/how-to-fix-this-site-cant-be-reached-error\/\">can\u2019t fix<\/a> bad SQL or missing indexes.<\/li>\n\n\n\n<li><strong>Leaving THP enabled<\/strong>: Causes latency spikes and stalls under load.<\/li>\n\n\n\n<li><strong>Chasing query cache gains<\/strong>: Usually hurts scalability on write-heavy workloads.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"when-to-scale-or-change-architecture\"><strong>When to Scale or Change Architecture<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Vertical scaling<\/strong>: More RAM\/CPU for growing datasets and concurrency.<\/li>\n\n\n\n<li><strong>Read replicas<\/strong>: Offload heavy reads; tune replication with <code>binlog_format=ROW<\/code> and appropriate parallel apply (<code>slave_parallel_threads<\/code>).<\/li>\n\n\n\n<li><strong>Sharding or partitioning<\/strong>: For very large tables or multi-tenant growth.<\/li>\n\n\n\n<li><strong>Caching layer<\/strong>: Add Redis\/Memcached for hot reads and sessions.<\/li>\n\n\n\n<li><strong>HA\/Clustering<\/strong>: MariaDB Galera for multi-master writes; test wsrep settings under real workloads.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"practical-commands-youll-use-often\"><strong>Practical Commands You\u2019ll Use Often<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># Verify applied settings\nSHOW VARIABLES LIKE 'innodb_buffer_pool_size';\nSHOW VARIABLES LIKE 'innodb_flush_log_at_trx_commit';\nSHOW VARIABLES LIKE 'max_connections';\n\n# Live load indicators\nSHOW GLOBAL STATUS LIKE 'Threads_running';\nSHOW GLOBAL STATUS LIKE 'Created_tmp_disk_tables';\nSHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_read_requests';\nSHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_reads';\n\n# Analyze a specific query\nEXPLAIN SELECT ...;\n\n# Check currently running queries\nSHOW FULL PROCESSLIST\\G<\/code><\/pre>\n\n\n\n<p>With the steps above, you can confidently optimize <a href=\"https:\/\/www.youstable.com\/blog\/what-is-mariadb-on-linux-server\/\">MariaDB on Linux server<\/a> for real-world workloads: tune the OS, configure InnoDB correctly, fix expensive queries, and monitor continuously. Start small, measure, and iterate\u2014and if you want a proven, managed approach, the YouStable team can help you implement it end-to-end.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"faqs-mariadb-optimization-on-linux\"><strong>FAQs: MariaDB Optimization on Linux<\/strong><\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1765867214716\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"what-is-the-best-value-for-innodb_buffer_pool_size\"><strong>What is the best value for innodb_buffer_pool_size?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>For a <a href=\"https:\/\/www.youstable.com\/blog\/operating-systems-is-best-for-dedicated-server\/\">dedicated database server<\/a>, start with 60\u201375% of RAM. If the OS and other services share the host, target 50\u201360%. Monitor buffer pool hit ratio and I\/O; if you see many disk reads on hot data and have free RAM, increase gradually.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765867223038\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"should-i-enable-the-query-cache-in-mariadb\"><strong>Should I enable the query cache in MariaDB?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Generally, no. The query cache can become a global contention point and hurt scalability on write-heavy workloads. It\u2019s often disabled by default in modern MariaDB. For read-mostly, stable datasets, you can test it carefully\u2014but most production stacks perform better with it off and an application-side cache like Redis.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765867230271\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-do-i-enable-and-use-the-slow-query-log\"><strong>How do I enable and use the slow query log?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Set <code>slow_query_log=ON<\/code> and <code>long_query_time=0.5<\/code> (or lower) in <code>my.cnf<\/code> or via <code>SET GLOBAL<\/code>, then analyze the log with <code>pt-query-digest<\/code>. Focus on queries with the highest total time and fix indexing and SQL patterns first.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765867238191\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"how-many-connections-should-i-allow\"><strong>How many connections should I allow?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Set <code>max_connections<\/code> to a realistic number your RAM can support with per-thread buffers (often 150\u2013300). Use connection pooling in the application and prefer faster queries over hundreds of concurrent sessions. Monitor <code>max_used_connections<\/code> to right-size over time.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1765867245604\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \" class=\"rank-math-question \" id=\"what-tools-should-i-use-to-monitor-mariadb-on-linux\"><strong>What tools should I use to monitor MariaDB on Linux?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Percona Monitoring and Management (PMM), Prometheus with mysqld_exporter, and Grafana dashboards provide deep visibility into buffer pool, waits, and queries. Complement with sysstat\/iostat atop and journald logs. YouStable\u2019s managed servers include these as part of our optimization stack.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To optimize MariaDB on Linux server, update to the latest stable MariaDB build, tune the OS for I\/O and memory, [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":15470,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[350],"tags":[],"class_list":["post-13726","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledgebase"],"acf":[],"featured_image_src":"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2025\/12\/How-to-Optimize-MariaDB-on-Linux-Server.jpg","author_info":{"display_name":"Prahlad Prajapati","author_link":"https:\/\/www.youstable.com\/blog\/author\/prahladblog"},"_links":{"self":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/13726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/comments?post=13726"}],"version-history":[{"count":6,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/13726\/revisions"}],"predecessor-version":[{"id":15471,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/13726\/revisions\/15471"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media\/15470"}],"wp:attachment":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media?parent=13726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/categories?post=13726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/tags?post=13726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}