在 Digital Ocean 上托管的 WordPress 网站 - 100% CPU 使用率

在 Digital Ocean 上托管的 WordPress 网站 - 100% CPU 使用率

TL;DR - 当流量(大约 900)时,我们网站的 CPU 达到 100%,减慢速度并崩溃。

介绍

我们公司拥有 40 多个内容网站,托管在 Digital Ocean 上,使用 Wordpress CMS。在过去的 3 天里,奇怪的事情开始发生,日复一日,每次都有不同网站的 CPU 上升到 100%,最终导致网站崩溃。

细节

服务器

  1. 机器规格- 48GB RAM,12 核,Centos
  2. 主持人- 数字海洋
  3. 环境配置- nginx & php-fpm & mysql - 全部在一台服务器中。

我们所知道的

  1. 这可能不是一次攻击- 如果它发生在一个网站上,我们会认为这是一次攻击,但由于它是 4 个网站,那么它可能是其他攻击。

  2. 这不是插件- 我们尝试关闭它们并重新启动服务,但 CPU 仍然很高。另外,所有其他网站都有相同的插件。

  3. 我们没有做任何改变- 所有其他网站都正常,我们没有做任何更改来实现这种情况。

  4. 这是一个内在的过程- 我们使用 CDN 工作程序来提供缓存,因此不应从数据库请求任何内容。

我们尝试过但没有帮助的事情

  1. 更改 php-fpm 配置- 将 php-fpm 最大子进程数从 50 增加到 200。此外,将进程的时间限制设置为在 20 秒内终止。

  2. 长宁nginx配置- 关闭 ngnix fastcgi_ignore_client_abort

报告

顶级报告

顶级报告

php fpm 错误日志 php-fpm 错误日志

Nginx 错误日志 Nginx 错误日志

mysql进程列表 在此输入图像描述

mysql错误日志

2019-04-02 21:13:34 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-04-02 21:13:34 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 14287 ...
2019-04-02 21:13:34 14287 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
2019-04-02 21:13:34 14287 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)
2019-04-02 21:13:34 14287 [Note] Plugin 'FEDERATED' is disabled.
2019-04-02 21:13:34 14287 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-04-02 21:13:34 14287 [Note] InnoDB: The InnoDB memory heap is disabled
2019-04-02 21:13:34 14287 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-04-02 21:13:34 14287 [Note] InnoDB: Memory barrier is not used
2019-04-02 21:13:34 14287 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-04-02 21:13:34 14287 [Note] InnoDB: Using Linux native AIO
2019-04-02 21:13:34 14287 [Note] InnoDB: Using CPU crc32 instructions
2019-04-02 21:13:34 14287 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2019-04-02 21:13:34 14287 [Note] InnoDB: Completed initialization of buffer pool
2019-04-02 21:13:34 14287 [Note] InnoDB: Highest supported file format is Barracuda.
2019-04-02 21:13:34 14287 [Note] InnoDB: 128 rollback segment(s) are active.
2019-04-02 21:13:34 14287 [Note] InnoDB: Waiting for purge to start
2019-04-02 21:13:34 14287 [Note] InnoDB: 5.6.42 started; log sequence number 79628880679
2019-04-02 21:13:34 14287 [Note] Server hostname (bind-address): '*'; port: 3306
2019-04-02 21:13:34 14287 [Note] IPv6 is available.
2019-04-02 21:13:34 14287 [Note]   - '::' resolves to '::';
2019-04-02 21:13:34 14287 [Note] Server socket created on IP: '::'.
2019-04-02 21:13:34 14287 [Note] Event Scheduler: Loaded 0 events
2019-04-02 21:13:34 14287 [Note] /usr/sbin/mysqld: ready for connections. Version: '5.6.42'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
2019-04-02 21:19:56 14287 [Warning] IP address '85.93.20.38' could not be resolved: Name or service not known
2019-04-02 21:21:20 14287 [Note] /usr/sbin/mysqld: Normal shutdown
2019-04-02 21:21:20 14287 [Note] Giving 2 client threads a chance to die gracefully
2019-04-02 21:21:20 14287 [Note] Event Scheduler: Purging the queue. 0 events
2019-04-02 21:21:20 14287 [Note] Shutting down slave threads
2019-04-02 21:21:22 14287 [Note] Forcefully disconnecting 0 remaining clients
2019-04-02 21:21:22 14287 [Note] Binlog end
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'partition'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_METRICS'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_CMPMEM'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_CMP'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_LOCKS'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'INNODB_TRX'
2019-04-02 21:21:22 14287 [Note] Shutting down plugin 'InnoDB'
2019-04-02 21:21:22 14287 [Note] InnoDB: FTS optimize thread exiting.
2019-04-02 21:21:22 14287 [Note] InnoDB: Starting shutdown...
2019-04-02 21:21:24 14287 [Note] InnoDB: Shutdown completed; log sequence number 79629654999
2019-04-02 21:21:24 14287 [Note] Shutting down plugin 'BLACKHOLE'
2019-04-02 21:21:24 14287 [Note] Shutting down plugin 'ARCHIVE'
2019-04-02 21:21:24 14287 [Note] Shutting down plugin 'MRG_MYISAM'
2019-04-02 21:21:24 14287 [Note] Shutting down plugin 'MyISAM'
2019-04-02 21:21:24 14287 [Note] Shutting down plugin 'MEMORY'
2019-04-02 21:21:24 14287 [Note] Shutting down plugin 'CSV'
2019-04-02 21:21:24 14287 [Note] Shutting down plugin 'sha256_password'
2019-04-02 21:21:24 14287 [Note] Shutting down plugin 'mysql_old_password'
2019-04-02 21:21:24 14287 [Note] Shutting down plugin 'mysql_native_password'
2019-04-02 21:21:24 14287 [Note] Shutting down plugin 'binlog'
2019-04-02 21:21:24 14287 [Note] /usr/sbin/mysqld: Shutdown complete
190402 21:21:24 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
190402 21:21:25 mysqld_safe Logging to '/var/log/mysqld.log'.
190402 21:21:25 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2019-04-02 21:21:25 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-04-02 21:21:25 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 14764 ...
2019-04-02 21:21:25 14764 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
2019-04-02 21:21:25 14764 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)

相关内容