hoopycat wrote:
Your KeepaliveTimeout should be in the single digits, perhaps 2 or 3 seconds instead of the extra-long default. That's the #1 eater of otherwise-idle connections.
And yes, if you ditch mod_php and move to php-fpm, you can also ditch mpm-prefork and set the world on fire accordingly. I handle about 120,000 hits/day on vBulletin with a 1 GB VPS, Apache, and PHP-FPM with room to spare (I could resize down to 512 MB...), which replaces a previous VPS with 4 GB, Apache, and mod_php, which occasionally slammed itself into the turf...
Thanks for the tips, decreasing the KeepAlive Timeout has helped a lot.
I was not able to switch to php-fpm as it turned out to be a complicated thing ( the site went down and I had to revert to an old backup! )
I'm interested to know about your Apache configurations, will it be possible to mention what other settings you have in there, the default file I have is way too long and I believe that's one of the issues. here is the whole file I have:
Code:
ServerRoot "/etc/apache2"
LockFile /var/lock/apache2/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 8
<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 6
MaxSpareServers 12
MaxClients 48
MaxRequestsPerChild 6000
</IfModule>
<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_event_module>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy all
</Files>
DefaultType text/plain
HostnameLookups Off
ErrorLog /var/log/apache2/error.log
LogLevel warn
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
Include /etc/apache2/httpd.conf
Include /etc/apache2/ports.conf
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
Include /etc/apache2/conf.d/
Include /etc/apache2/sites-enabled/
Thanks