我刚把wordpress博客迁移到新服务器上。它有大约120 K的帖子。
问题是,在mysql操作期间,它会被击中、挂起甚至冻结。一个wordpress(没有任何插件)创建后操作消耗了60-80%的CPU。当执行3-5数据库操作时,它会被冻结。而且没有任何慢速查询的日志。
系统:Ubuntu18.04,16 and内存,8核CPU,120 and磁盘和MySQL版本5.7.25
这是mysqltuner和其他报告。
和当前的mysql.cnf
[mysqld]
# Skip reverse DNS lookup of clients
skip-name-resolve
default-storage-engine=InnoDB
max_allowed_packet=500M
max_connections = 256
interactive_timeout=7200
wait_timeout=7200
innodb_file_per_table=1
innodb_buffer_pool_size = 8G
innodb_buffer_pool_instances = 4
innodb_log_file_size = 1G
innodb_flush_log_at_trx_commit = 1
innodb_flush_method = O_DIRECT
innodb_open_files=5000
innodb_io_capacity=2000
innodb_io_capacity_max=4000
innodb_old_blocks_time=2000
open_files_limit=50000
query_cache_type = 1
query_cache_min_res_unit = 1M
query_cache_limit = 1M
query_cache_size = 50M
tmp_table_size= 256M
max_heap_table_size= 256M
#key_buffer_size = 128M
thread_stack = 128K
thread_cache_size = 32
slow-query-log = 1
slow-query-log-file = /var/lib/mysql/mysql-slow.log
long_query_time = 1编辑:与生成mysqltuner报告时相比,上面粘贴的初始mysql.cnf变量有一些不正确/更改的值。更正谢谢@EchoMike444 444
发布于 2019-04-01 15:52:13
每秒速率= RPS -为您的my.cnf 米舍尔德部分提供建议,
innodb_lru_scan_depth=100 # from 1024 to reduce 90% of cpu cycles used for function every SECOND
innodb_io_capacity=3500 # from 2000 to enable higher IOPS on your SSD devices
innodb_flushing_avg_loops=5 # from 30 to reduce innodb_buffer_pool_pages_dirty overhead - count was 3183 in SGStatus
read_buffer_size=256K # from 128K to reduce handler_read_next RPS of 277,134
read_rnd_buffer_size=192K # from 256K to reduce handler_read_rnd_next RPS of 778有更多的机会通过全球变量来提高性能。免责声明:我是作者的网站在我的个人资料,网络配置文件,其中包括联系信息。
发布于 2019-04-19 05:43:44
WordPress中的"meta“表有一个低效的模式。这讨论了提高效率所需的修补程序。
这些修复不会修复WordPress固有的EAV (实体-属性-值)模式固有的低效。
https://serverfault.com/questions/960737
复制相似问题