-3

Hello i have MariaDB 10.5 on a Centos 8 Server configuration 18cores 32 threads and 32gb ram

I have plenty of free ram but I am trying to optimize for CPU less CPU work and more ram usage

How I do that in my.cnf ?

Also I don't know where i should add this changes to /etc/my.cnf or /etc/my.cnf.d/server.cnf

I heard that increase innodb_buffer_pool_size can help since i have enough ram, but i dont know how to do it and specially how on mariadb 10.5.

Please help.

here is mysql tunner

 >>  MySQLTuner 1.7.19 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering

[--] Skipped version check for MySQLTuner script
[!!] Successfully authenticated with no password - SECURITY RISK!
[!!] Your MySQL version 10.5.0-MariaDB is EOL software!  Upgrade soon!
[OK] Operating on 64-bit architecture

-------- Log file Recommendations ------------------------------------------------------------------
[!!] Log file  doesn't exist

-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +Aria +CSV +InnoDB +MEMORY +MRG_MyISAM +MyISAM +PERFORMANCE_SCHEMA +SEQUENCE
[--] Data in InnoDB tables: 4.4G (Tables: 227)
[OK] Total fragmented tables: 0

-------- Analysis Performance Metrics --------------------------------------------------------------
[--] innodb_stats_on_metadata: OFF
[OK] No stat updates during querying INFORMATION_SCHEMA.

-------- Security Recommendations ------------------------------------------------------------------
[OK] There are no anonymous accounts for any database users
[OK] All database users have passwords assigned
[!!] There is no basic password file list!

-------- CVE Security Recommendations --------------------------------------------------------------
[--] Skipped due to --cvefile option undefined

-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 17m 33s (333K q [316.542 qps], 855 conn, TX: 1G, RX: 36M)
[--] Reads / Writes: 99% / 1%
[--] Binary logging is disabled
[--] Physical Memory     : 31.2G
[--] Max MySQL memory    : 3.2G
[--] Other process memory: 0B
[--] Total buffers: 417.0M global + 18.9M per thread (151 max threads)
[--] P_S Max memory usage: 0B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 587.2M (1.84% of installed RAM)
[OK] Maximum possible memory usage: 3.2G (10.24% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (0/333K)
[OK] Highest usage of available connections: 5% (9/151)
[OK] Aborted connections: 0.00%  (0/855)
[!!] 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: 0.0% (0 cached / 325K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (1 temp sorts / 15K sorts)
[!!] Joins performed without indexes: 6
[!!] Temporary tables created on disk: 82% (4K on disk / 5K total)
[OK] Thread cache hit rate: 98% (9 created / 855 connections)
[OK] Table cache hit rate: 94% (94 open / 100 opened)
[OK] table_definition_cache(400) is upper than number of tables(391)
[OK] Open file limit used: 0% (30/4K)
[OK] Table locks acquired immediately: 100% (119 immediate / 119 locks)

-------- Performance schema ------------------------------------------------------------------------
[--] Performance schema is disabled.
[--] Memory used by P_S: 0B
[--] Sys schema isn't installed.

-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is enabled.
[--] Thread Pool Size: 32 thread(s).
[--] Using default value is good enough for your version (10.5.0-MariaDB)

-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.2% (24M used / 134M cache)
[!!] Cannot calculate MyISAM index size - re-run script as root user

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[!!] InnoDB buffer pool / data size: 128.0M/4.4G
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (75 %): 96.0M * 1/128.0M should be equal to 25%
[OK] InnoDB buffer pool instances: 1
[--] Number of InnoDB Buffer Pool Chunk : 1 for 1 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: 95.74% (313581438 hits/ 327537414 total)
[!!] InnoDB Write Log efficiency: 3.28% (92 hits/ 2808 total)
[OK] InnoDB log waits: 0.00% (0 waits / 2900 writes)

-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is enabled.
[OK] Aria pagecache size / total Aria indexes: 128.0M/320.0K
[OK] Aria pagecache hit rate: 98.5% (273K cached / 4K 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:
    MySQL was started within the last 24 hours - recommendations may be inaccurate
    Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
    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).
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries which have no LIMIT clause
    Performance schema should be activated for better diagnostics
    Consider installing Sys schema from https://github.com/mysql/mysql-sys for MySQL
    Consider installing Sys schema from https://github.com/FromDual/mariadb-sys for MariaDB
    Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: https://bit.ly/2TcGgtU
Variables to adjust:
    query_cache_size (=0)
    query_cache_type (=0)
    query_cache_limit (> 1M, or use smaller result sets)
    join_buffer_size (> 256.0K, or always use indexes with JOINs)
    tmp_table_size (> 16M)
    max_heap_table_size (> 16M)
    performance_schema = ON enable PFS
    innodb_buffer_pool_size (>= 4.4G) if possible.
    innodb_log_file_size should be (=32M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
  • I'm no expert, but should that not be 18 cores and 36 threads or 16 cores and 32 threads? Search for mysqltuner - run it and post the results here. Check out other questions which mention it here and on StackExchange. Post the contents of my.cnf. Now, the important question: WHY do you want to do this? What are the metrics leading you to want to "optimise for CPU" and "more RAM" even though they do different jobs? Are your end-users complaining? Are you having performance problems? When did they start? Has anything changed (HW/SWare) recently? We need more data to give a good answer! – Vérace Jan 14 at 7:16
  • 1
    You might wish to reconsider using 10.5.n anything for 6 months - unless you are in a position to find and report bugs - then WAIT. It appears 10.5.1 became ALPHA release about Dec 19, 2019. Try a version that is posted Stable more than 6 months ago, unless you have spare time. Allow someone else the privilege of finding and report bugs/anomalies. – Wilson Hauck Jan 14 at 17:28
  • This url should help you with the question about which configuration file to modify. mariadb.com/kb/en/configuring-mariadb-with-option-files Short answer edit /etc/my.cnf and in the [mysqld] section either change or add a line innodb_buffer_pool_size=nnM or G for mega or giga BYTES. stop/start or restart your instance. – Wilson Hauck Jan 14 at 17:33
1

If you are just starting to use MariaDB, your Question is premature. For small, casual, usage MariaDB will work fine "out of the box".

For 32GB of RAM on a server dedicated to MySQL/MariaDB, set

innodb_buffer_pool_size = 24G

Does /etc/my.cnf already exist? Look at it. If there is already a setting, then change it. If not, does the file have an "includedir" in it?

If you have other applications running on the same machine, then decrease that to make room for them. Do not allow swapping to occur.

Everything else can be left alone until you have an issue. That is, there is no "magic".

However, if you are worried about CPU usage, then watch for "slow" queries and tackle them. Tweaking queries, not tuning, is what to do for high CPU or load average.

More on the SlowLog for this purpose: http://mysql.rjweb.org/doc.php/mysql_analysis#slow_queries_and_slowlog

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.