我正在使用wordpress、php 7.2和mysql 对生产服务器进行负载测试Ver 15.1 Distrib 10.1.44-MariaDB
,其中有 4 个 Core i7 CPU 和 10GB Ram 在ubuntu 18.04 LTS上运行。问题是即使负载很低,比如每秒 5 个用户,所有 4 个 CPU 都达到 100%,并且它们仍然存在。一段时间后,CPU 已满,我只收到错误 500。而且,我所有的模块都是最新的。
我尝试禁用 wordpress 中的所有插件并运行相同的测试,但问题仍然存在。
我也使用了一些插件来优化数据库wp-optimize
,但没有运气。该/var/log/mysql/mysql-slow.log
文件也是空的。
如上图所示,您可以理解mysqld
无缘无故地使用了过多的 CPU。
mysql配置在 /etc/mysqld/my.cnf:
[mysqld]
general_log = on
skip-name-resolve
innodb_read_io_threads=4
innodb_write_io_threads=4
general_log_file = /var/log/mysql/mysql.log
log_error=/var/log/mysql/mysql_error.log
#
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
innodb_buffer_pool_size= 4000M
max_connections =800
wait_timeout=100
interactive_timeout=100
query_cache_size=0
query_cache_type=0
query_cache_limit=2M
tmp_table_size=500M
max_heap_table_size=500M
thread_cache_size=4
performance_schema=ON
innodb_log_file_size=500M
innodb_buffer_pool_instances=3
innodb_autoinc_lock_mode = 2
胡说叔叔