Apache2定期使用100%CPU

Apache2定期使用100%CPU,apache2,ubuntu-18.04,cpu-usage,pimcore,sigterm,Apache2,Ubuntu 18.04,Cpu Usage,Pimcore,Sigterm,我对管理自己的服务器还比较陌生,有些Apache2进程占用了100%的CPU。这将持续大约半个小时,几个小时后,它将再次开始。它甚至会在重新启动Apache或重新启动服务器后立即发生 该服务器用于为两个流量非常低的网站提供服务。它使用了一个叫做Pimcore的CMS,它本身就是基于Symfony的 数字海洋液滴1GB内存 Ubuntu 18.04 PHP 7.2 fpm MySql 14.14 Pimcore CMS(Symfony) 我之前在Ubuntu 17.10上运行了完全相同的设置,一切

我对管理自己的服务器还比较陌生,有些Apache2进程占用了100%的CPU。这将持续大约半个小时,几个小时后,它将再次开始。它甚至会在重新启动Apache或重新启动服务器后立即发生

该服务器用于为两个流量非常低的网站提供服务。它使用了一个叫做Pimcore的CMS,它本身就是基于Symfony的

数字海洋液滴1GB内存

Ubuntu 18.04

PHP 7.2 fpm

MySql 14.14

Pimcore CMS(Symfony)

我之前在Ubuntu 17.10上运行了完全相同的设置,一切都很顺利。自从我用Ubuntu 18.04(全新安装)将我的安装转移到一个新服务器后,我开始发现这些问题

我怀疑这与一些PHP脚本的执行有关,但我可以找出它的确切来源

有人知道会发生什么吗

Apache2配置:

<IfModule mpm_prefork_module>
        StartServers            2
        MinSpareServers           3
        MaxSpareServers           5
        MaxRequestWorkers         20
        MaxConnectionsPerChild   3000
        MaxClients              15
</IfModule>
Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 php7_module (shared)
 proxy_module (shared)
 proxy_fcgi_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 ssl_module (shared)
 status_module (shared)
 wsgi_module (shared)
top - 11:34:04 up 17 min,  1 user,  load average: 4.00, 3.92, 2.79
Tasks:  91 total,   5 running,  49 sleeping,   0 stopped,   0 zombie
%Cpu(s): 99.7 us,  0.3 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1008848 total,   112120 free,   483364 used,   413364 buff/cache
KiB Swap:        0 total,        0 free,        0 used.   334772 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                                                                                        
 1405 www-data  20   0  561180  94488  43856 R 24.9  9.4   2:20.77 /usr/sbin/apache2 -k start                                                                                                     
 1427 www-data  20   0  550904  75304  36568 R 24.9  7.5   1:56.12 /usr/sbin/apache2 -k start                                                                                                     
 1429 www-data  20   0  552952  76684  36432 R 24.9  7.6   2:13.89 /usr/sbin/apache2 -k start                                                                                                     
 1437 www-data  20   0  550904  74748  36568 R 24.9  7.4   1:48.41 /usr/sbin/apache2 -k start                                                                                                     
  916 mysql     20   0 1410004 206444  17124 S  0.3 20.5   0:01.96 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid                                                                 
    1 root      20   0  159764   8756   6472 S  0.0  0.9   0:01.37 /sbin/init                                                                                                                     
    2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [kthreadd]                                                                                                                     
    3 root      20   0       0      0      0 I  0.0  0.0   0:00.00 [kworker/0:0]                                                                                                                  
    4 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 [kworker/0:0H]                                                                                                                 
    6 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 [mm_percpu_wq]                                                                                                                 
    7 root      20   0       0      0      0 S  0.0  0.0   0:00.07 [ksoftirqd/0]                                                                                                                  
    8 root      20   0       0      0      0 I  0.0  0.0   0:00.08 [rcu_sched]                                                                                                                    
    9 root      20   0       0      0      0 I  0.0  0.0   0:00.00 [rcu_bh]                                                                                                                       
   10 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 [migration/0]                                                                                                                  
   11 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 [watchdog/0]                                                                                                                   
   12 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [cpuhp/0]                                                                                                                      
   13 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [kdevtmpfs]                                                                                                                    
   14 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 [netns]                                                                                                                        
   15 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [rcu_tasks_kthre]                                                                                                              
   16 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [kauditd]                                                                                                                      
   17 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [khungtaskd]                                                                                                                   
   18 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [oom_reaper]                                                                                                                   
   19 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 [writeback]                                                                                                                    
   20 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [kcompactd0]                  
stat("/var/www/XYZ/XYZ/web/static/css/print.css", {st_mode=S_IFREG|0664, st_size=250, ...}) = 0
sendto(24, "\264\0\0\0\3SELECT id, \n          (CASE"..., 184, MSG_DONTWAIT, NULL, 0) = 184
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\2/\0\0\2\3def\vXYZ\5cache\5"..., 3174, MSG_DONTWAIT, NULL, NULL) = 265
sendto(24, "<\0\0\0\3SELECT sourceId FROM docume"..., 64, MSG_DONTWAIT, NULL, 0) = 64
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\1]\0\0\2\3def\vXYZ\26docume"..., 2909, MSG_DONTWAIT, NULL, NULL) = 120
sendto(24, "\236\0\0\0\3SELECT id,language FROM doc"..., 162, MSG_DONTWAIT, NULL, 0) = 162
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\2\32\0\0\2\3def\0\0\0\2id\2id\f?\0\v\0\0\0\3!\0"..., 2789, MSG_DONTWAIT, NULL, NULL) = 95
sendto(24, "\264\0\0\0\3SELECT id, \n          (CASE"..., 184, MSG_DONTWAIT, NULL, 0) = 184
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\2/\0\0\2\3def\vXYZ\5cache\5"..., 2694, MSG_DONTWAIT, NULL, NULL) = 265
sendto(24, "\271\0\0\0\3SELECT id, \n          (CASE"..., 189, MSG_DONTWAIT, NULL, 0) = 189
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\2/\0\0\2\3def\vXYZ\5cache\5"..., 2429, MSG_DONTWAIT, NULL, NULL) = 104
access("/var/www/XYZ/XYZ/app/views/content/default.html.php", F_OK) = -1 ENOENT (No such file or directory)
access("/var/www/XYZ/XYZ/app/Resources/views/content/default.html.php", F_OK) = -1 ENOENT (No such file or directory)
access("/var/www/XYZ/XYZ/src/AppBundle/Resources/public/areas/blockquote/icon.png", F_OK) = -1 ENOENT (No such file or directory)
access("/var/www/XYZ/XYZ/src/AppBundle/Resources/public/areas/horizontal-line/icon.png", F_OK) = -1 ENOENT (No such file or directory)
access("/var/www/XYZ/XYZ/src/AppBundle/Resources/public/areas/gallery-single-images/icon.png", F_OK) = -1 ENOENT (No such file or directory)
...
错误。日志

Fri May  1 11:01:48 2020 (1309): Error Cannot kill process 1069: Success!
[Fri May 01 11:01:49.207718 2020] [core:notice] [pid 923] AH00051: child pid 1309 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Fri May 01 11:13:15.899518 2020] [core:notice] [pid 923] AH00051: child pid 1333 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Fri May 01 11:13:15.899963 2020] [core:notice] [pid 923] AH00051: child pid 1383 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Fri May 01 11:13:15.899975 2020] [core:notice] [pid 923] AH00051: child pid 1406 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Fri May 01 11:13:15.900004 2020] [core:notice] [pid 923] AH00051: child pid 1305 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Fri May 01 11:13:15.900059 2020] [mpm_prefork:notice] [pid 923] AH00169: caught SIGTERM, shutting down
[Fri May 01 11:13:16.073253 2020] [mpm_prefork:notice] [pid 1605] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Fri May 01 11:13:16.073329 2020] [core:notice] [pid 1605] AH00094: Command line: '/usr/sbin/apache2'
[Fri May 01 11:14:17.466068 2020] [core:notice] [pid 1605] AH00051: child pid 1613 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Fri May 01 11:14:17.466137 2020] [core:notice] [pid 1605] AH00051: child pid 1636 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Fri May 01 11:14:17.466181 2020] [mpm_prefork:notice] [pid 1605] AH00169: caught SIGTERM, shutting down
[Fri May 01 11:14:17.608696 2020] [mpm_prefork:notice] [pid 1685] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Fri May 01 11:14:17.608770 2020] [core:notice] [pid 1685] AH00094: Command line: '/usr/sbin/apache2'
[Fri May 01 11:16:49.360625 2020] [core:notice] [pid 1685] AH00052: child pid 1696 exit signal Segmentation fault (11)
[Fri May 01 11:16:49.360697 2020] [core:notice] [pid 1685] AH00052: child pid 1717 exit signal Segmentation fault (11)
[Fri May 01 11:16:49.360708 2020] [core:notice] [pid 1685] AH00052: child pid 1719 exit signal Segmentation fault (11)
[Fri May 01 11:16:49.360724 2020] [core:notice] [pid 1685] AH00052: child pid 1722 exit signal Segmentation fault (11)
[Fri May 01 11:16:49.360780 2020] [mpm_prefork:notice] [pid 1685] AH00169: caught SIGTERM, shutting down
[Fri May 01 11:17:05.637473 2020] [mpm_prefork:notice] [pid 924] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Fri May 01 11:17:05.651236 2020] [core:notice] [pid 924] AH00094: Command line: '/usr/sbin/apache2'
[Fri May 01 11:25:37.817879 2020] [core:notice] [pid 924] AH00051: child pid 946 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Fri May 01 11:25:37.817946 2020] [core:notice] [pid 924] AH00051: child pid 948 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Fri May 01 11:25:37.817960 2020] [core:notice] [pid 924] AH00051: child pid 1022 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Fri May 01 11:25:37.817972 2020] [core:notice] [pid 924] AH00051: child pid 1055 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Fri May 01 11:25:37.817984 2020] [core:notice] [pid 924] AH00051: child pid 1056 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Fri May 01 11:25:37.818020 2020] [mpm_prefork:notice] [pid 924] AH00169: caught SIGTERM, shutting down
[Fri May 01 11:25:37.957502 2020] [mpm_prefork:notice] [pid 1394] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Fri May 01 11:25:37.957577 2020] [core:notice] [pid 1394] AH00094: Command line: '/usr/sbin/apache2'
顶级输出:

<IfModule mpm_prefork_module>
        StartServers            2
        MinSpareServers           3
        MaxSpareServers           5
        MaxRequestWorkers         20
        MaxConnectionsPerChild   3000
        MaxClients              15
</IfModule>
Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 php7_module (shared)
 proxy_module (shared)
 proxy_fcgi_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 ssl_module (shared)
 status_module (shared)
 wsgi_module (shared)
top - 11:34:04 up 17 min,  1 user,  load average: 4.00, 3.92, 2.79
Tasks:  91 total,   5 running,  49 sleeping,   0 stopped,   0 zombie
%Cpu(s): 99.7 us,  0.3 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1008848 total,   112120 free,   483364 used,   413364 buff/cache
KiB Swap:        0 total,        0 free,        0 used.   334772 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                                                                                        
 1405 www-data  20   0  561180  94488  43856 R 24.9  9.4   2:20.77 /usr/sbin/apache2 -k start                                                                                                     
 1427 www-data  20   0  550904  75304  36568 R 24.9  7.5   1:56.12 /usr/sbin/apache2 -k start                                                                                                     
 1429 www-data  20   0  552952  76684  36432 R 24.9  7.6   2:13.89 /usr/sbin/apache2 -k start                                                                                                     
 1437 www-data  20   0  550904  74748  36568 R 24.9  7.4   1:48.41 /usr/sbin/apache2 -k start                                                                                                     
  916 mysql     20   0 1410004 206444  17124 S  0.3 20.5   0:01.96 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid                                                                 
    1 root      20   0  159764   8756   6472 S  0.0  0.9   0:01.37 /sbin/init                                                                                                                     
    2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [kthreadd]                                                                                                                     
    3 root      20   0       0      0      0 I  0.0  0.0   0:00.00 [kworker/0:0]                                                                                                                  
    4 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 [kworker/0:0H]                                                                                                                 
    6 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 [mm_percpu_wq]                                                                                                                 
    7 root      20   0       0      0      0 S  0.0  0.0   0:00.07 [ksoftirqd/0]                                                                                                                  
    8 root      20   0       0      0      0 I  0.0  0.0   0:00.08 [rcu_sched]                                                                                                                    
    9 root      20   0       0      0      0 I  0.0  0.0   0:00.00 [rcu_bh]                                                                                                                       
   10 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 [migration/0]                                                                                                                  
   11 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 [watchdog/0]                                                                                                                   
   12 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [cpuhp/0]                                                                                                                      
   13 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [kdevtmpfs]                                                                                                                    
   14 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 [netns]                                                                                                                        
   15 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [rcu_tasks_kthre]                                                                                                              
   16 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [kauditd]                                                                                                                      
   17 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [khungtaskd]                                                                                                                   
   18 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [oom_reaper]                                                                                                                   
   19 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 [writeback]                                                                                                                    
   20 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [kcompactd0]                  
stat("/var/www/XYZ/XYZ/web/static/css/print.css", {st_mode=S_IFREG|0664, st_size=250, ...}) = 0
sendto(24, "\264\0\0\0\3SELECT id, \n          (CASE"..., 184, MSG_DONTWAIT, NULL, 0) = 184
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\2/\0\0\2\3def\vXYZ\5cache\5"..., 3174, MSG_DONTWAIT, NULL, NULL) = 265
sendto(24, "<\0\0\0\3SELECT sourceId FROM docume"..., 64, MSG_DONTWAIT, NULL, 0) = 64
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\1]\0\0\2\3def\vXYZ\26docume"..., 2909, MSG_DONTWAIT, NULL, NULL) = 120
sendto(24, "\236\0\0\0\3SELECT id,language FROM doc"..., 162, MSG_DONTWAIT, NULL, 0) = 162
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\2\32\0\0\2\3def\0\0\0\2id\2id\f?\0\v\0\0\0\3!\0"..., 2789, MSG_DONTWAIT, NULL, NULL) = 95
sendto(24, "\264\0\0\0\3SELECT id, \n          (CASE"..., 184, MSG_DONTWAIT, NULL, 0) = 184
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\2/\0\0\2\3def\vXYZ\5cache\5"..., 2694, MSG_DONTWAIT, NULL, NULL) = 265
sendto(24, "\271\0\0\0\3SELECT id, \n          (CASE"..., 189, MSG_DONTWAIT, NULL, 0) = 189
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\2/\0\0\2\3def\vXYZ\5cache\5"..., 2429, MSG_DONTWAIT, NULL, NULL) = 104
access("/var/www/XYZ/XYZ/app/views/content/default.html.php", F_OK) = -1 ENOENT (No such file or directory)
access("/var/www/XYZ/XYZ/app/Resources/views/content/default.html.php", F_OK) = -1 ENOENT (No such file or directory)
access("/var/www/XYZ/XYZ/src/AppBundle/Resources/public/areas/blockquote/icon.png", F_OK) = -1 ENOENT (No such file or directory)
access("/var/www/XYZ/XYZ/src/AppBundle/Resources/public/areas/horizontal-line/icon.png", F_OK) = -1 ENOENT (No such file or directory)
access("/var/www/XYZ/XYZ/src/AppBundle/Resources/public/areas/gallery-single-images/icon.png", F_OK) = -1 ENOENT (No such file or directory)
...
当使用strace跟踪其中一个CPU使用率高的PID时,会出现这样的情况:

<IfModule mpm_prefork_module>
        StartServers            2
        MinSpareServers           3
        MaxSpareServers           5
        MaxRequestWorkers         20
        MaxConnectionsPerChild   3000
        MaxClients              15
</IfModule>
Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 php7_module (shared)
 proxy_module (shared)
 proxy_fcgi_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 ssl_module (shared)
 status_module (shared)
 wsgi_module (shared)
top - 11:34:04 up 17 min,  1 user,  load average: 4.00, 3.92, 2.79
Tasks:  91 total,   5 running,  49 sleeping,   0 stopped,   0 zombie
%Cpu(s): 99.7 us,  0.3 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1008848 total,   112120 free,   483364 used,   413364 buff/cache
KiB Swap:        0 total,        0 free,        0 used.   334772 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                                                                                        
 1405 www-data  20   0  561180  94488  43856 R 24.9  9.4   2:20.77 /usr/sbin/apache2 -k start                                                                                                     
 1427 www-data  20   0  550904  75304  36568 R 24.9  7.5   1:56.12 /usr/sbin/apache2 -k start                                                                                                     
 1429 www-data  20   0  552952  76684  36432 R 24.9  7.6   2:13.89 /usr/sbin/apache2 -k start                                                                                                     
 1437 www-data  20   0  550904  74748  36568 R 24.9  7.4   1:48.41 /usr/sbin/apache2 -k start                                                                                                     
  916 mysql     20   0 1410004 206444  17124 S  0.3 20.5   0:01.96 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid                                                                 
    1 root      20   0  159764   8756   6472 S  0.0  0.9   0:01.37 /sbin/init                                                                                                                     
    2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [kthreadd]                                                                                                                     
    3 root      20   0       0      0      0 I  0.0  0.0   0:00.00 [kworker/0:0]                                                                                                                  
    4 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 [kworker/0:0H]                                                                                                                 
    6 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 [mm_percpu_wq]                                                                                                                 
    7 root      20   0       0      0      0 S  0.0  0.0   0:00.07 [ksoftirqd/0]                                                                                                                  
    8 root      20   0       0      0      0 I  0.0  0.0   0:00.08 [rcu_sched]                                                                                                                    
    9 root      20   0       0      0      0 I  0.0  0.0   0:00.00 [rcu_bh]                                                                                                                       
   10 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 [migration/0]                                                                                                                  
   11 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 [watchdog/0]                                                                                                                   
   12 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [cpuhp/0]                                                                                                                      
   13 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [kdevtmpfs]                                                                                                                    
   14 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 [netns]                                                                                                                        
   15 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [rcu_tasks_kthre]                                                                                                              
   16 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [kauditd]                                                                                                                      
   17 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [khungtaskd]                                                                                                                   
   18 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [oom_reaper]                                                                                                                   
   19 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 [writeback]                                                                                                                    
   20 root      20   0       0      0      0 S  0.0  0.0   0:00.00 [kcompactd0]                  
stat("/var/www/XYZ/XYZ/web/static/css/print.css", {st_mode=S_IFREG|0664, st_size=250, ...}) = 0
sendto(24, "\264\0\0\0\3SELECT id, \n          (CASE"..., 184, MSG_DONTWAIT, NULL, 0) = 184
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\2/\0\0\2\3def\vXYZ\5cache\5"..., 3174, MSG_DONTWAIT, NULL, NULL) = 265
sendto(24, "<\0\0\0\3SELECT sourceId FROM docume"..., 64, MSG_DONTWAIT, NULL, 0) = 64
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\1]\0\0\2\3def\vXYZ\26docume"..., 2909, MSG_DONTWAIT, NULL, NULL) = 120
sendto(24, "\236\0\0\0\3SELECT id,language FROM doc"..., 162, MSG_DONTWAIT, NULL, 0) = 162
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\2\32\0\0\2\3def\0\0\0\2id\2id\f?\0\v\0\0\0\3!\0"..., 2789, MSG_DONTWAIT, NULL, NULL) = 95
sendto(24, "\264\0\0\0\3SELECT id, \n          (CASE"..., 184, MSG_DONTWAIT, NULL, 0) = 184
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\2/\0\0\2\3def\vXYZ\5cache\5"..., 2694, MSG_DONTWAIT, NULL, NULL) = 265
sendto(24, "\271\0\0\0\3SELECT id, \n          (CASE"..., 189, MSG_DONTWAIT, NULL, 0) = 189
poll([{fd=24, events=POLLIN|POLLERR|POLLHUP}], 1, 86400000) = 1 ([{fd=24, revents=POLLIN}])
recvfrom(24, "\1\0\0\1\2/\0\0\2\3def\vXYZ\5cache\5"..., 2429, MSG_DONTWAIT, NULL, NULL) = 104
access("/var/www/XYZ/XYZ/app/views/content/default.html.php", F_OK) = -1 ENOENT (No such file or directory)
access("/var/www/XYZ/XYZ/app/Resources/views/content/default.html.php", F_OK) = -1 ENOENT (No such file or directory)
access("/var/www/XYZ/XYZ/src/AppBundle/Resources/public/areas/blockquote/icon.png", F_OK) = -1 ENOENT (No such file or directory)
access("/var/www/XYZ/XYZ/src/AppBundle/Resources/public/areas/horizontal-line/icon.png", F_OK) = -1 ENOENT (No such file or directory)
access("/var/www/XYZ/XYZ/src/AppBundle/Resources/public/areas/gallery-single-images/icon.png", F_OK) = -1 ENOENT (No such file or directory)
...
stat(“/var/www/XYZ/XYZ/web/static/css/print.css”,{st_mode=S_IFREG | 0664,st_size=250,…})=0
发送到(24),“\264\0\0\0\3选择id,\n(大小写“…,184,MSG\u DONTWAIT,NULL,0)=184
poll([{fd=24,events=POLLIN | POLLERR | POLLHUP}],186400000)=1([{fd=24,revents=POLLIN})
recvfrom(24,“\1\0\0\1\2/\0\0\2\3def\vXYZ\5cache\5”…,3174,MSG_DONTWAIT,NULL,NULL)=265

sendto(24),感谢您发布数据。每秒速率=RPS

建议考虑您的数字海洋MY.CNF[myqLDL]部分

query_cache_type=OFF  # from ON to conserve your 1G of RAM
query_cache_size=0  # to ensure QC is not in use
innodb_io_capacity=1900  # from 200 to enable more use of SSD capacity
innodb_lru_scan_depth=100  # from 1024 to conserve 90% of CPU cycles used for function
tmp_table_size=10M  # from ~500M for 1% of RAM
max_heap_table_size=10M  # from ~500M for 1% of RAM
innodb_log_file_size=64M  # from 8M - size should always be GT innodb_log_buffer_size of 16M for you
innodb_thread_concurrency=0  # from 8 to allow auto calc of concurrency limit

有了这些变化,CPU的使用应该会稳定下来。请在几天内告诉我们您的进度。

好的,所以我最终能够找到问题所在

一些流行SEO工具的爬虫以很高的频率请求不存在的URL,导致一些进程在Pimcore中被触发。这就是导致CPU和RAM消耗增加的原因


在通过.htaccess阻止这些爬虫程序后,一切都恢复正常。

为您的操作系统创建并启用4GB交换空间。最好慢一段时间运行,而不是“断开”。您知道为什么文件会丢失吗?您能让它们重新联机吗?每个孩子的最大连接数可能在30而不是3000。来自MySQL command提示,显示全局状态,如“max_used_connections”;将结果乘以3,用于Apache max客户端。其他信息请求。MySQL主机服务器上的任何SSD或NVME设备?在pastebin.com上发布并共享链接。从SSH登录根目录,文本结果为:B)显示全局状态;在至少24小时正常运行后C)显示全局变量;D)显示完整的PROCESSLIST;E)完整的MySQLTuner报告和可选的非常有用的信息,如果可用,包括-htop或top用于大多数活动应用程序,ulimit-a用于Linux/Unix限制列表,iostat-xm 5 3用于按设备和核心/cpu计数计算的IOPS,用于服务器工作负载优化分析以提供建议。Have您已通过SHOW CREATE TABLE tbl_name验证;您的索引在新服务器上的表上,就像在旧服务器上一样?您好,威尔逊,谢谢您的帮助!以下是请求的文本结果:B)C)D)e)谢谢,建议已在5月2日20日16:30左右的回答中发布。@nik isschick您有机会实现这些建议吗他建议:当时间允许时,请考虑投票或接受。评论正面或负面对社区是有益的。最后,没有一个建议能奏效。问题是一些爬虫经常请求不存在的URL。不知怎么的,这导致CMS反应过度,导致CPU和RAM消耗。n感谢您的输入!太好了。有了建议,您的查询完成时间应该会更快。