RyoMiyashita / 42HoursTuning2023

42 Tokyoで開催するイベント管理
MIT License
0 stars 0 forks source link

mysql設定見直し #2

Open RyoMiyashita opened 1 year ago

YoshimotoK commented 1 year ago

ローカルで起動したMySQLコンテナに対して、MySQL Tunerを実行した結果↓

 >>  MySQLTuner 2.2.8
     * 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
[--] Performing tests on 127.0.0.1:33060
[OK] Logged in using credentials passed on the command line
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM -ndbcluster -ndbinfo +PERFORMANCE_SCHEMA
[--] Data in InnoDB tables: 2.7G (Tables: 12)
[OK] Total fragmented tables: 0

[OK] Currently running supported MySQL version 8.0.34

-------- Log file Recommendations ------------------------------------------------------------------
[!!] log_error is set to stderr, but this script can't read stderr

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

-------- Views Metrics -----------------------------------------------------------------------------

-------- Triggers Metrics --------------------------------------------------------------------------

-------- Routines Metrics --------------------------------------------------------------------------

-------- Security Recommendations ------------------------------------------------------------------
[--] Skipped due to unsupported feature for MySQL 8.0+

-------- CVE Security Recommendations --------------------------------------------------------------
[OK] NO SECURITY CVE FOUND FOR YOUR VERSION

-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 4m 47s (2K q [7.815 qps], 28 conn, TX: 1M, RX: 195K)
[--] Reads / Writes: 19% / 81%
[--] Binary logging is enabled (GTID MODE: OFF)
[--] Physical Memory     : 16.0G
[--] Max MySQL memory    : 685.6M
[--] Other process memory: 0B
[--] Total buffers: 168.0M global + 1.9M per thread (151 max threads)
[--] Performance_schema Max memory usage: 229M
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 418.7M (2.56% of installed RAM)
[OK] Maximum possible memory usage: 685.6M (4.18% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (14/2K)
[OK] Highest usage of available connections: 7% (11/151)
[OK] Aborted connections: 0.00% (0/28)
[--] Query cache has been removed since MySQL 8.0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 136 sorts)
[!!] Joins performed without indexes: 136
[OK] Temporary tables created on disk: 8% (9 on disk / 101 total)
[OK] Thread cache hit rate: 60% (11 created / 28 connections)
[OK] Table cache hit rate: 97% (54K hits / 55K requests)
[OK] table_definition_cache (2000) is greater than number of tables (340)
[OK] Open file limit used: 0% (2/1M)
[OK] Table locks acquired immediately: 100% (11 immediate / 11 locks)
[OK] Binlog cache memory access: 100.00% (86 Memory / 86 Total)

-------- Performance schema ------------------------------------------------------------------------
[--] Performance_schema is activated.
[--] Memory used by Performance_schema: 229.8M
[--] Sys schema is installed.

-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is disabled.

-------- MyISAM Metrics ----------------------------------------------------------------------------
[--] General MyIsam metrics:
[--]  +-- Total MyISAM Tables  : 0
[--]  +-- Total MyISAM indexes : 0B
[--]  +-- KB Size :8.0M
[--]  +-- KB Used Size :1.5M
[--]  +-- KB used :18.2%
[--]  +-- Read KB hit rate: 0% (0 cached / 0 reads)
[--]  +-- Write KB hit rate: 0% (0 cached / 0 writes)
[--] No MyISAM table(s) detected ....

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[OK] InnoDB Buffer Pool size ( 128.0M ) under limit for 64 bits architecture: (17179869184.0G )
[!!] InnoDB buffer pool / data size: 128.0M / 2.7G
[!!] Ratio InnoDB redo log capacity / InnoDB Buffer pool size (75%): 100.0M / 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
[!!] InnoDB Read buffer efficiency: 86.15% (8658271 hits / 10049915 total)
[OK] InnoDB Write Log efficiency: 97.73% (237931 hits / 243456 total)
[OK] InnoDB log waits: 0.00% (0 waits / 5525 writes)

-------- Aria Metrics ------------------------------------------------------------------------------
[--] Aria Storage Engine not available.

-------- 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: ROW
[--] XA support enabled: ON
[--] Semi synchronous replication Master: Not Activated
[--] Semi synchronous replication Slave: Not Activated
[--] This is a standalone server

-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
    MySQL was started within the last 24 hours: recommendations may be inaccurate
    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).
    Be careful, increasing innodb_redo_log_capacity means higher crash recovery mean time
Variables to adjust:
    join_buffer_size (> 256.0K, or always use indexes with JOINs)
    innodb_buffer_pool_size (>= 2.7G) if possible.
    innodb_redo_log_capacity should be (=32M) if possible, so InnoDB Redo log Capacity equals 25% of buffer pool size.

ある程度稼働しているMySQLに対して実行した方が良いので、あまり参考にならないかもしれない。 とりあえず下記は対応してみても良いかもしれない。

対応