我真的不明白为什么这么慢。
网站加载非常缓慢。 和vboxheadless命中超过100%CPU每个请求。
我使用2048内存和1个CPU。
这里是活动监视器和顶部: http : //imgur.com/a/j4kqA
这是我的/var/log/error.log:
[Mon Apr 25 09:47:45.572752 2016] [mpm_prefork:notice] [pid 20447] AH00169: caught SIGTERM, shutting down [Mon Apr 25 09:47:46.617995 2016] [mpm_worker:notice] [pid 16841:tid 140284476835712] AH00292: Apache/2.4.7 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 c$ [Mon Apr 25 09:47:46.618120 2016] [core:notice] [pid 16841:tid 140284476835712] AH00094: Command line: '/usr/sbin/apache2' [Mon Apr 25 09:47:46.618358 2016] [:notice] [pid 16844:tid 140284476835712] FastCGI: process manager initialized (pid 16844) [Mon Apr 25 09:47:49.240919 2016] [mpm_worker:notice] [pid 16841:tid 140284476835712] AH00295: caught SIGTERM, shutting down [Mon Apr 25 09:47:49.253270 2016] [:alert] [pid 16844:tid 140284476835712] FastCGI: read() from pipe failed (0) [Mon Apr 25 09:47:49.253334 2016] [:alert] [pid 16844:tid 140284476835712] FastCGI: the PM is shutting down, Apache seems to have disappeared - bye [Mon Apr 25 09:47:49.985954 2016] [mpm_worker:notice] [pid 16936:tid 140332593411968] AH00292: Apache/2.4.7 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 c$ [Mon Apr 25 09:47:49.986367 2016] [core:notice] [pid 16936:tid 140332593411968] AH00094: Command line: '/usr/sbin/apache2' [Mon Apr 25 09:47:49.987182 2016] [:notice] [pid 16939:tid 140332593411968] FastCGI: process manager initialized (pid 16939) [Mon Apr 25 09:47:49.987488 2016] [:warn] [pid 16939:tid 140332593411968] FastCGI: server "/var/www/php-fcgi/php53" started (pid 16944) [Mon Apr 25 09:47:49.987665 2016] [:warn] [pid 16939:tid 140332593411968] FastCGI: server "/var/www/php-fcgi/php55" started (pid 16945)
php55看起来像:
#!/bin/sh PHPRC=/home/vagrant/.phpbrew/php/php-5.5.34/etc/cgi export PHPRC export PHP_FCGI_MAX_REQUESTS=5000 export PHP_FCGI_CHILDREN=8 exec /home/vagrant/.phpbrew/php/php-5.5.34/bin/php-cgi
php53看起来是一样的,但加载5.3。
这是我的网站conf:
<IfModule mod_fastcgi.c> FastCgiServer /var/www/php-fcgi/php55 -processes 1 -idle-timeout 30 </IfModule> <VirtualHost *:80> UseCanonicalName Off ServerAlias *.code.dev ServerAdmin webmaster@localhost VirtualDocumentRoot /var/www/code/%1 <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined <IfModule mod_fastcgi.c> AddType application/x-httpd-fastphp5 .php .html .htm Action application/x-httpd-fastphp5 /php5-fcgi-php-5.5.34 Alias /php5-fcgi-php-5.5.34 /var/www/php-fcgi/php55 <Directory /var/www/php-fcgi> AllowOverride All Order allow,deny allow from all </Directory> </IfModule> </VirtualHost>
我有两个主机看起来非常像上面,但与不同的serveralias和不同的PHP。
我的fastcgi.conf是空的。
mpm_worker.conf:
# worker MPM # StartServers: initial number of server processes to start # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadLimit: ThreadsPerChild can be changed to this maximum value during a # graceful restart. ThreadLimit can only be changed by stopping # and starting Apache. # ThreadsPerChild: constant number of worker threads in each server process # MaxRequestWorkers: maximum number of threads # MaxConnectionsPerChild: maximum number of requests a server process serves <IfModule mpm_worker_module> StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxRequestWorkers 150 MaxConnectionsPerChild 0 </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
我能做些什么来解决这个问题?