반응형

MariaDB와 Mysql 성능을 테스트하기 위해

 

HammerDB를 사용하다가

 

보니...

 

정작 중요한 my.cnf 설정이 정상적인가? 물음에 도달하게 되었습니다.

 

정확한 설정값을 위해 자동 튜닝 스크립트를 제공하는 사이트를 발견하였습니다.

 

보통 정상적으로 튜닝 범주라고 체크 할려면 48시간이상 이용해야 한다는 사실은 존재합니다.

 


 

virtualbox 상에서 실행한 결과 (OK : 정상 / !! 설정 이상 / -- SKIP)

 

 >>  MySQLTuner 1.7.15 - 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
[OK] Logged in using credentials passed on the command line
[OK] Currently running supported MySQL version 10.3.17-MariaDB
[OK] Operating on 64-bit architecture

-------- Log file Recommendations ------------------------------------------------------------------
[--] Log file: /var/lib/mysql/hammerdb.err(0B)
[!!] Log file /var/lib/mysql/hammerdb.err doesn't exist
[!!] Log file /var/lib/mysql/hammerdb.err isn't readable.

-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +Aria +CSV +InnoDB +MEMORY +MRG_MyISAM +MyISAM +PERFORMANCE_SCHEMA +SEQUENCE
[--] Data in InnoDB tables: 999.9M (Tables: 9)
[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
[!!] User 'root@%' does not specify hostname restrictions.
[!!] There is no basic password file list!

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

-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 34m 1s (279K q [136.873 qps], 133 conn, TX: 74M, RX: 38M)
[--] Reads / Writes: 50% / 50%
[--] Binary logging is disabled
[--] Physical Memory     : 1.8G
[--] Max MySQL memory    : 15.2G
[--] Other process memory: 0B
[--] Total buffers: 1.4G global + 28.2M per thread (500 max threads)
[--] P_S Max memory usage: 0B
[--] Galera GCache Max memory usage: 0B
[!!] Maximum reached memory usage: 1.7G (94.00% of installed RAM)
[!!] Maximum possible memory usage: 15.2G (845.58% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory
[OK] Slow queries: 0% (0/279K)
[OK] Highest usage of available connections: 2% (11/500)
[OK] Aborted connections: 1.50%  (2/133)
[!!] 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 / 1M selects)
[OK] Query cache prunes per day: 0
[OK] No Sort requiring temporary tables
[OK] No joins without indexes
[OK] Temporary tables created on disk: 0% (22 on disk / 37K total)
[OK] Thread cache hit rate: 90% (13 created / 133 connections)
[OK] Table cache hit rate: 95% (141 open / 147 opened)
[OK] Open file limit used: 1% (59/4K)
[OK] Table locks acquired immediately: 100% (108 immediate / 108 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: 2 thread(s).
[--] Using default value is good enough for your version (10.3.17-MariaDB)

-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.2% (24M used / 134M cache)
[OK] Key buffer size / total MyISAM indexes: 128.0M/123.0K
[OK] Read Key buffer hit rate: 98.9% (180 cached / 2 reads)

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 4
[OK] InnoDB File per table is activated
[OK] InnoDB buffer pool / data size: 1.0G/999.9M
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (99.609375 %): 340.0M * 3/1.0G should be equal to 25%
[!!] InnoDB buffer pool <= 1G and Innodb_buffer_pool_instances(!=1).
[--] Number of InnoDB Buffer Pool Chunk : 8 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: 99.84% (26160668 hits/ 26202270 total)
[!!] InnoDB Write Log efficiency: 83.1% (617680 hits/ 743341 total)
[OK] InnoDB log waits: 0.00% (0 waits / 125661 writes)

-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is enabled.
[OK] Aria pagecache size / total Aria indexes: 128.0M/1B

-------- 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:
    Restrict Host for user@% to user@SpecificDNSorIp
    MySQL was started within the last 24 hours - recommendations may be inaccurate
    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
    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/good-dba/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:
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***
    query_cache_size (=0)
    query_cache_type (=0)
    query_cache_limit (> 1M, or use smaller result sets)
    performance_schema = ON enable PFS
    innodb_log_file_size should be (=85M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
    innodb_buffer_pool_instances (=1)

 


Perl로 작성된 쉘이 아래 주소에 있으며,

 

https://github.com/major/MySQLTuner-perl

 

major/MySQLTuner-perl

MySQLTuner is a script written in Perl that will assist you with your MySQL configuration and make recommendations for increased performance and stability. - major/MySQLTuner-perl

github.com

 

2019.08.14 

mysqltuner.pl
0.22MB

 

실행법

#> perl mysqltuner.pl --user root --pass='root'

 

지원하는 DB는

 

Test result are available here: Travis CI/MySQLTuner-perl

  • MySQL 8 (partial support, password checks don't work)
  • MySQL 5.7 (full support)
  • MySQL 5.6 (full support)
  • MariaDB 10.3 (full support)
  • MariaDB 10.2 (full support)
  • MariaDB 10.1 (full support)
  • MariaDB 10.0 (full support, 6 last month support)
  • Percona Server 5.7 (full support)
  • Percona Server 5.6 (full support)
  • Percona XtraDB cluster (full support)
  • MySQL 3.23, 4.0, 4.1, 5.0, 5.1, 5.5 (partial support - deprecated version)
  • Perl 5.6 or later (with perl-doc package)
  • Unix/Linux based operating system (tested on Linux, BSD variants, and Solaris variants)
  • Windows is not supported at this time (Help wanted !!!!!)
  • Unrestricted read access to the MySQL server (OS root access recommended for MySQL < 5.1)
  • CVE vulnerabilities detection support from https://cve.mitre.org

 

반응형

+ Recent posts