低メモリサーバー用のMariaDB最適化に関する記事をたくさん読んだことがあります。これについては多くのガイドがありますが、人々は常に自分の設定を共有しています。それは私や他の初心者にとって理解するのを難しくします。
以下のガイドによると、MariaDB財団はパフォーマンススキーマを無効にすることを提案しています。 100MBのメモリを節約するだけです。 https://mariadb.com/resources/blog/starting-mysql-on-low-memory-virtual-machines/
問題は、私のサーバーに1GBのメモリがあり、Mysqlチューナーで確認したところ、すべて問題なかったということです。 物理メモリは1GBであり、最大MySQLメモリは800MBでした
そして、昨日、サーバーを1GBメモリから2GBメモリにアップグレードしました。さて、以下のように、Mysqltunerはアップグレード後にサーバーを専用にすることを勧めています。なぜそれらの警告が表示されるのですか?
root@WordPress:~# Perl mysqltuner.pl --checkversion --updateversion
>> MySQLTuner 1.7.19 - Major Hayden <[email protected]>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
[OK] You have the latest version of MySQLTuner(1.7.19)
[OK] Logged in using credentials from Debian maintenance account.
[OK] Currently running supported MySQL version 10.4.12-MariaDB-1:10.4.12+maria~bionic
[OK] Operating on 64-bit architecture
-------- Log file Recommendations ------------------------------------------------------------------
[OK] Log file /var/log/mysql/error.log exists
[--] Log file: /var/log/mysql/error.log(408B)
[OK] Log file /var/log/mysql/error.log is readable.
[OK] Log file /var/log/mysql/error.log is not empty
[OK] Log file /var/log/mysql/error.log is smaller than 32 Mb
[OK] /var/log/mysql/error.log doesn't contain any warning.
[!!] /var/log/mysql/error.log contains 4 error(s).
[--] 0 start(s) detected in /var/log/mysql/error.log
[--] 0 shutdown(s) detected in /var/log/mysql/error.log
-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +Aria +CSV +InnoDB +MEMORY +MRG_MyISAM +MyISAM +PERFORMANCE_SCHEMA +SEQUENCE
[--] Data in InnoDB tables: 17.4M (Tables: 89)
[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 are 620 basic passwords in the list.
-------- CVE Security Recommendations --------------------------------------------------------------
[OK] NO SECURITY CVE FOUND FOR YOUR VERSION
-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 16h 4m 42s (166K q [2.870 qps], 8K conn, TX: 170M, RX: 14M)
[--] Reads / Writes: 81% / 19%
[--] Binary logging is disabled
[--] Physical Memory : 1.9G
[--] Max MySQL memory : 3.3G
[--] Other process memory: 0B
[--] Total buffers: 432.0M global + 18.8M per thread (151 max threads)
[--] P_S Max memory usage: 104M
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 649.3M (32.58% of installed RAM)
[!!] Maximum possible memory usage: 3.3G (169.44% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory
[OK] Slow queries: 0% (0/166K)
[OK] Highest usage of available connections: 3% (6/151)
[OK] Aborted connections: 0.00% (0/8261)
[OK] Query cache is disabled by default due to mutex contention on multiprocessor machines.
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 8K sorts)
[OK] No joins without indexes
[OK] Temporary tables created on disk: 0% (838 on disk / 93K total)
[OK] Thread cache hit rate: 99% (6 created / 8K connections)
[OK] Table cache hit rate: 95% (139 open / 145 opened)
[OK] table_definition_cache(400) is upper than number of tables(258)
[OK] Open file limit used: 1% (52/4K)
[OK] Table locks acquired immediately: 100% (231 immediate / 231 locks)
-------- Performance schema ------------------------------------------------------------------------
[--] Memory used by P_S: 104.4M
[--] Sys schema is installed.
-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is enabled.
[--] Thread Pool Size: 1 thread(s).
[--] Using default value is good enough for your version (10.4.12-MariaDB-1:10.4.12+maria~bionic)
-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.3% (3M used / 16M 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
[OK] InnoDB buffer pool / data size: 256.0M/17.4M
[OK] Ratio InnoDB log file size / InnoDB Buffer pool size: 32.0M * 2/256.0M should be equal to 25%
[OK] InnoDB buffer pool instances: 1
[--] Number of InnoDB Buffer Pool Chunk : 2 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: 99.92% (2744805 hits/ 2747120 total)
[!!] InnoDB Write Log efficiency: 74.36% (25782 hits/ 34670 total)
[OK] InnoDB log waits: 0.00% (0 waits / 8888 writes)
-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is enabled.
[OK] Aria pagecache size / total Aria indexes: 128.0M/320.0K
[!!] Aria pagecache hit rate: 93.4% (12K cached / 850 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:
Control error line(s) into /var/log/mysql/error.log file
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.
MariaDBバージョン:10.4およびサーバー構成:LEMPスタック
これが私のMariaDB設定です。
query_cache_type = 0
query_cache_size = 0
performance_schema = ON
innodb_buffer_pool_size = 256M
innodb_log_file_size = 32M
skip-name-resolve=1
join_buffer_size=256K
innodb_stats_on_metadata = 0
あなたの素晴らしい提案が必要です。よろしく。
my.cnf
、スワッピングが発生しますが、これはパフォーマンスにとってひどいものです。innodb_buffer_pool_size
。 128M
は、「小さすぎる」(クラッシュする可能性がある)と「大きすぎる」(スワップしている可能性がある)の間の転換点のどこかにあります。max_connections=10, table_open_cache=50, query_cache_type=0, query_cache_size=0, performance_schema=OFF
。Innodb data size
は便利です:buffer_poolはその約2倍以上である必要はありません。ただし、小さなbuffer_poolで処理できるデータ量には「制限」はありません。トレードオフはより多くのI/Oです。