Title says it all I am running a MariaDB/MySQL server on a Rocky Linux VM hosted on a Proxmox server. VM is dedicated to the DB server and has the following specs:
-4 Cores (2 cores x 2 sockets)
-32GB DDR3 RAM
-DB storage is on an older RAID0 pair of Hitachi 15k600 SAS hard drives (will be upgraded soon to PCIE SSD or simnilar)
I ran this DB server for many years with the same config but in the last year or so, its gotten progressively slower and slower. I tried playing with the variables in my.cnf and letting it run for weeks at the time only to run mysqltuner.pl and see what recommendations it gave me...
Today I decided to give it another try because refreshing a webpage or a program that relies on this DB server shouldn't take 40+ seconds. FYI, after a fresh start of MariaDB, everything is lightning fast so clearly something is misconfigured and is causing mariadb to bloat itself up...
Overall, I think its a matter of improper buffer sizing and innodb pool size VS available RAM.... Here's the mysqltuner output:
I would be very grateful is someone could help me get some sort of performance out of this....
Thanks!
-4 Cores (2 cores x 2 sockets)
-32GB DDR3 RAM
-DB storage is on an older RAID0 pair of Hitachi 15k600 SAS hard drives (will be upgraded soon to PCIE SSD or simnilar)
I ran this DB server for many years with the same config but in the last year or so, its gotten progressively slower and slower. I tried playing with the variables in my.cnf and letting it run for weeks at the time only to run mysqltuner.pl and see what recommendations it gave me...
Today I decided to give it another try because refreshing a webpage or a program that relies on this DB server shouldn't take 40+ seconds. FYI, after a fresh start of MariaDB, everything is lightning fast so clearly something is misconfigured and is causing mariadb to bloat itself up...
Overall, I think its a matter of improper buffer sizing and innodb pool size VS available RAM.... Here's the mysqltuner output:
Code:
perl mysqltuner.pl
>> MySQLTuner 2.0.1
* Jean-Marie Renouard <jmrenouard@gmail.com>
* Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.pl/
>> Run with '--help' for additional options and output filtering
[--] Skipped version check for MySQLTuner script
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password: [OK] Currently
running supported MySQL version 10.3.35-MariaDB-log
[OK] Operating on 64-bit architecture
-------- Log file Recommendations
------------------------------------------------------------------
[OK] Log file /var/log/mariadb/mariadb.log exists
[--] Log file: /var/log/mariadb/mariadb.log (263B)
[OK] Log file /var/log/mariadb/mariadb.log is not empty
[OK] Log file /var/log/mariadb/mariadb.log is smaller than 32 Mb
[OK] Log file /var/log/mariadb/mariadb.log is readable.
[!!] /var/log/mariadb/mariadb.log contains 2 warning(s).
[OK] /var/log/mariadb/mariadb.log doesn't contain any error.
[--] 0 start(s) detected in /var/log/mariadb/mariadb.log
[--] 0 shutdown(s) detected in /var/log/mariadb/mariadb.log
-------- Storage Engine Statistics
-----------------------------------------------------------------
[--] Status: +ARCHIVE +Aria +BLACKHOLE +CSV +FEDERATED +InnoDB +MEMORY
+MRG_MyISAM +MyISAM +PERFORMANCE_SCHEMA +SEQUENCE
[--] Data in InnoDB tables: 748.4M (Tables: 761)
[--] Data in MyISAM tables: 10.2M (Tables: 44)
[OK] Total fragmented tables: 0
-------- Analysis Performance Metrics
--------------------------------------------------------------
[--] innodb_stats_on_metadata: OFF
[OK] No stat updates during querying INFORMATION_SCHEMA.
-------- Views Metrics
-----------------------------------------------------------------------------
-------- Triggers Metrics
--------------------------------------------------------------------------
-------- Routines Metrics
--------------------------------------------------------------------------
-------- Security Recommendations
------------------------------------------------------------------
[OK] There are no anonymous accounts for any database users
[OK] All database users have passwords assigned
[--] There are 620 basic passwords in the list.
-------- CVE Security Recommendations
--------------------------------------------------------------
[OK] NO SECURITY CVE FOUND FOR YOUR VERSION
-------- Performance Metrics
-----------------------------------------------------------------------
[--] Up for: 9d 2h 55m 30s (34M q [43.387 qps], 390K conn, TX: 19G, RX: 3G)
[--] Reads / Writes: 80% / 20%
[--] Binary logging is disabled
[--] Physical Memory : 31.4G
[--] Max MySQL memory : 43.2G
[--] Other process memory: 0B
[--] Total buffers: 24.9G global + 186.2M per thread (100 max threads)
[--] P_S Max memory usage: 95M
[--] Galera GCache Max memory usage: 0B
[!!] Maximum reached memory usage: 29.5G (94.11% of installed RAM)
[!!] Maximum possible memory usage: 43.2G (137.55% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory
[OK] Slow queries: 0% (0/34M)
[OK] Highest usage of available connections: 25% (25/100)
[OK] Aborted connections: 0.00% (1/390706)
[!!] Name resolution is active: a reverse name resolution is made for
each new connection and can reduce performance
[!!] Query cache may be disabled by default due to mutex contention.
[!!] Query cache efficiency: 18.2% (4M cached / 24M selects)
[!!] Query cache prunes per day: 10993
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 1M sorts)
[!!] Joins performed without indexes: 12889
[OK] Temporary tables created on disk: 5% (54K on disk / 1M total)
[OK] Thread cache hit rate: 99% (187 created / 390K connections)
[OK] Table cache hit rate: 99% (21M hits / 21M requests)
[!!] table_definition_cache (400) is less than number of tables (968)
[OK] Open file limit used: 0% (148/128K)
[OK] Table locks acquired immediately: 100% (5K immediate / 5K locks)
-------- Performance schema
------------------------------------------------------------------------
[--] Performance_schema is activated.
[--] Memory used by P_S: 95.1M
[--] Sys schema isn't installed.
-------- ThreadPool Metrics
------------------------------------------------------------------------
[--] ThreadPool stat is disabled.
-------- MyISAM Metrics
----------------------------------------------------------------------------
[!!] Key buffer used: 18.3% (23.4M used / 128.0M cache)
[OK] Key buffer size / total MyISAM indexes: 128.0M/610.0K
[OK] Read Key buffer hit rate: 97.4% (21K cached / 545 reads)
[!!] Write Key buffer hit rate: 49.3% (408 cached / 201 writes)
-------- InnoDB Metrics
----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[OK] InnoDB buffer pool / data size: 24.0G/748.4M
[OK] Ratio InnoDB log file size / InnoDB Buffer pool size: 2.0G *
3/24.0G should be equal to 25%
[!!] InnoDB buffer pool instances: 8
[--] Number of InnoDB Buffer Pool Chunk: 192 for 8 Buffer Pool Instance(s)
[OK] Innodb_buffer_pool_size aligned with
Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
[OK] InnoDB Read buffer efficiency: 100.00% (5511951044 hits/
5512010134 total)
[!!] InnoDB Write Log efficiency: 88.47% (2723033 hits/ 3077843 total)
[OK] InnoDB log waits: 0.00% (0 waits / 354810 writes)
-------- Aria Metrics
------------------------------------------------------------------------------
[--] Aria Storage Engine is enabled.
[OK] Aria pagecache size / total Aria indexes: 128.0M/0B
[OK] Aria pagecache hit rate: 98.9% (4M cached / 54K reads)
-------- TokuDB Metrics
----------------------------------------------------------------------------
[--] TokuDB is disabled.
-------- XtraDB Metrics
----------------------------------------------------------------------------
[--] XtraDB is disabled.
-------- Galera Metrics
----------------------------------------------------------------------------
[--] Galera is disabled.
-------- Replication Metrics
-----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] Binlog format: MIXED
[--] XA support enabled: ON
[--] Semi synchronous replication Master: OFF
[--] Semi synchronous replication Slave: OFF
[--] This is a standalone server
-------- Recommendations
---------------------------------------------------------------------------
General recommendations:
Check warning line(s) in /var/log/mariadb/mariadb.log file
Reduce your overall MySQL memory footprint for system stability
Dedicate this server to your database for highest performance.
Configure your accounts with ip or subnets only, then update your
configuration with skip-name-resolve=1
Increasing the query_cache size over 128M may reduce performance
We will suggest raising the 'join_buffer_size' until JOINs not
using indexes are found.
See https://dev.mysql.com/doc/internals/en/join-buffer-size.html
(specially the conclusions at the bottom of the page).
Consider installing Sys schema from
https://github.com/mysql/mysql-sys for MySQL
Variables to adjust:
*** MySQL's maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables ***
skip-name-resolve=1
query_cache_size (=0)
query_cache_type (=0)
query_cache_limit (> 12M, or use smaller result sets)
query_cache_size (> 128M) [see warning above]
join_buffer_size (> 16.0M, or always use indexes with JOINs)
table_definition_cache(400) > 968 or -1 (autosizing if supported)
key_buffer_size (~ 24M)
innodb_buffer_pool_instances(=24)
Code:
free -m
total used free shared buff/cache
available
Mem: 32146 4260 24489 19 3397
27455
Swap: 1023 0 1023
Thanks!