I've got multiple virtual hosts on my Ubuntu server. I am running Apache 2.4 & mod_php. At the moment, one website is receiving a lot of traffic - and it is taking time to respond (6+ seconds at times). However - the other websites on this server are all responding instantly. The server isn't under heavy load:
I've got 16 CPUs and the load is currently: 2.27 I'm nowhere near reaching the max memory as there is 48GB and I'm only using around 10GB.
My Virtual Host config file for the site in question is pretty straight forward:
<VirtualHost 0.0.0.0:8080>
ServerName MySite.com
ServerAlias *.MySite.com
ServerAdmin test@test.com
DocumentRoot /var/www/html/MySite.com
ErrorLog ${APACHE_LOG_DIR}/error.log
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Note that I am using Varnish - which explains the port 8080.
Latest mod_status output for the server:
Server uptime: 1 hour 49 minutes 21 seconds
Server load: 2.70 2.69 2.63
Total accesses: 943706 - Total Traffic: 17.8 GB
CPU Usage: u717.5 s40.96 cu0 cs0 - 11.6% CPU load
144 requests/sec - 2.8 MB/second - 19.8 kB/request
91 requests currently being processed, 24 idle workers
Because this particular site utilises sessions and varnish isn't of any real use to it, I use the following in my default.vcl file to "bypass" varnish altogether:
if (req.http.host ~ "(www)?(mysite).com") {
set req.http.connection = "close";
return (pipe);
}
My mpm_prefork.conf file, which applies to all sites on the server:
<IfModule mpm_prefork_module>
ServerLimit 4000
StartServers 2
MinSpareServers 2
MaxSpareServers 5
MaxRequestWorkers 4000
MaxConnectionsPerChild 0
</IfModule>
Any ideas why this might be happening?
I switched to PHP-FPM using the following mpm_worker settings:
<IfModule mpm_worker_module>
ServerLimit 250
StartServers 10
MinSpareThreads 75
MaxSpareThreads 250
ThreadLimit 64
ThreadsPerChild 32
MaxClients 8000
MaxRequestsPerChild 10000
</IfModule>
Site is still taking a while to load - whereas other sites are responding instantly. Top results while using PHP-FPM:
My /etc/php5/fpm/pool.d/www.conf settings:
pm = static
pm.max_children = 1200
pm.start_servers = 16
pm.min_spare_servers = 1
pm.max_spare_servers = 36
pm.max_requests = 800