6

MySQL 设置优化记录

 9 months ago
source link: https://yjyj.net/learn/wordpress-learn/6426.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

MySQL 设置优化记录

2023-09-20 44 0

用 WordPress 嘛,速度是优先考虑的第一问题。
最近用 wp benchmark 测了下服务器,发现数据库评分惨不忍睹,满分10份竟然只有 2.85 的平均分。
怪不得几个站点的 TTFB 都高于700+了
按照推荐的优化方式尝试优化了以下数据库配置,记录一下作为备忘。

innodb_flush_log_at_trx_commit=2

参数值意义:
参数值可以是 0,1,2
0:该模式速度最快,但不太安全,mysqld进程的崩溃会导致上一秒钟所有事务数据的丢失。
1:该模式是最安全的,但也是最慢的一种方式。在mysqld 服务崩溃或者服务器主机crash的情况下,binary log 只有可能丢失最多一个语句或者一个事务。
2:该模式速度较快,也比0安全,只有在操作系统崩溃或者系统断电的情况下,上一秒钟所有事务数据才可能丢失。

innodb_file_per_table=1innodb_thread_concurrency=0innodb_buffer_pool_size=4Ginnodb_buffer_pool_instances=8innodb_log_file_size=512M # updated 29.june.2023, increased query_cache_type=1query_cache_limit=128Kquery_cache_size=64Mquery_cache_min_res_unit=512 performance_schema=0 sql-mode="NO_ENGINE_SUBSTITUTION"

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK