首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MYSQL消耗所有的CPU - WooCommerce。

MYSQL消耗所有的CPU - WooCommerce。
EN

Server Fault用户
提问于 2018-04-05 06:55:50
回答 2查看 389关注 0票数 1

我们有一家WordPress + WooCommerce商店。

我们的服务器有24个RAM和128 RAM。几天后,我们在同一时间有多个订单,CPU完全超载,网站长期瘫痪。

我们使用的是MariaDB 10.2

是否有人有经验,如果这是正常的,或者是什么东西配置错误?

下面是我的配置文件的相关部分:

代码语言:javascript
复制
#
# * Fine Tuning
#
max_connections         = 500
connect_timeout         = 5
wait_timeout            = 600
max_allowed_packet      = 16M
thread_cache_size       = 128
sort_buffer_size        = 4M
bulk_insert_buffer_size = 16M
tmp_table_size          = 32M
max_heap_table_size     = 32M

#
# * MyISAM
#
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched. On error, make copy and try a repair.
myisam_recover_options = BACKUP
key_buffer_size         = 128M
#open-files-limit       = 2000
table_open_cache        = 400
myisam_sort_buffer_size = 512M
concurrent_insert       = 2
read_buffer_size        = 2M
read_rnd_buffer_size    = 1M

#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
default_storage_engine  = InnoDB
# you can't just change log file size, requires special procedure
#innodb_log_file_size   = 50M
innodb_buffer_pool_size = 256M
innodb_log_buffer_size  = 8M
innodb_file_per_table   = 1
innodb_open_files       = 400
innodb_io_capacity      = 400
innodb_flush_method     = O_DIRECT
EN

回答 2

Server Fault用户

回答已采纳

发布于 2018-04-05 12:31:39

我想您有很多磁盘i/o,因为key_buffer_sizeinnodb_buffer_pool_size值太小。没有确切的建议来调整它们,但是您应该注意到下面的几点:

key_buffer_size应该大于MYISAM索引的总量,以便将它们全部放入内存中。

如果innodb_buffer_pool_size可用,那么与所有INNODB表一样大的是很好的。

您必须非常小心地调优join_buffer_sizesort_buffer_size (以及其他的值,如read_buffer_size和read_rnd_buffer_size,线程堆栈)值,因为它们用于每个连接和最多500个同时连接,您可以轻松地超过实际可用的RAM。

无论如何,您必须首先启动mysqltuner,并在调优之前彻底检查报告的每一行。请记住,mysqltuner给出的建议是一般性的,可能不适合您的具体情况。

票数 2
EN

Server Fault用户

发布于 2018-04-10 17:52:07

建议考虑您的my.cnf-ini 米舍尔德部分(即使此时只有my.cnf-ini的一部分可见)。

代码语言:javascript
复制
read_buffer_size=128K  # from 2M to minimize read data requirements 

read_rnd_buffer_size=256M  # from 1M  to minimize read data requirements 

thread_cache_size=100  # from 128  for V8 suggested CAP to avoid Out Of Memory 

其他机会将变得明显,因为从要求的资料中得到的数据可供分析。

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/906094

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档