I am experiencing a bizarre problem with my linux webserver where images periodically load incredibly slowly.
Background:
I am a website designer with about 70 customers big and small - my websites all run on one VMware virtual machine running 64bit Debian. The physical machines are all top of the range dell servers - and the bandwidth is virtually unlimited.
I use a CMS system which I built myself over the last 6 years which allows clients to create webpages using mysql/php/javascript but then outputs them to static HTML so their websites remain as fast as possible.
Problem:
Every 2 - 3 weeks images start taking ages to load. a 30kb jpg can take up to 2 minutes to appear. This problem happens with PNG files as well but videos, database queries, FTP access etc are unaffected. No errors appear in the apache logs and the problems seems to clear itself a day or so later. I thought there might be an incompatibility issue with the OS (which was originally the latest version of ubuntu) so I changed from ubuntu to a stable release of debian 6.0.2 (fresh install) but the problem returned some weeks later.
My hosting company assure me that there are no bandwidth/hardware issues with the server and when they check their logs there are no bandwidth spikes / memory problems etc.
I run 'Top' in the shell to discover that the CPU is not maxed out, and that memory usage is minimal.
The images themselves are regular jpg/png images stored in a folder on the same machine which is accessed using an apache alias:
-Alias /img /var/www/tmd/img
Excluding virtual hosts, my config is as follows:
ServerRoot "/etc/apache2"
LockFile /var/lock/apache2/accept.lock
PidFile ${APACHE_PID_FILE}
TimeOut 300
KeepAlive on
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_worker_module>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from 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 "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
ServerTokens Full
ServerSignature On
Include /etc/apache2/conf.d/
- Any support or suggestions are welcomed, because this is driving me insane!
Many thanks.