Question

I have a site where a page takes 10 seconds to load with firefox, and a further 10 seconds to load the images. It's a php page running on apache. The Images are just static images.

It runs beautifully on chrome.... instant loading.

googling for the answer has pointed me towards a possible issue with keep alive and the lack of content length confusing firefox, and indeed, it appears that content length isn't being set by the server on either the static or non static content, but disabling keep alive on the server doubles the load time!

Some sites have suggested disabling keep alive on the browser, but I'm reluctant to recommend that to everyone that views the page! Am I perhaps barking up the wrong tree?

browser is firefox 3.6.8 on Lucid Lynx. server is Apache 2.2.11.

apache.conf is apended... I think it's the one that comes out of the box, although I reduced the KeepAlive timeout to 3 in a vain attempt to try and get the page to load.

Am I barking up the wrong tree?

ServerRoot "/etc/apache2"

LockFile /var/lock/apache2/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 3
<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 "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
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
CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined
Include /etc/apache2/conf.d/
Include /etc/apache2/sites-enabled/
Was it helpful?

Solution

The issue was with local DNS lookup. The issue was hidden by the fact that command line DNS resolution seemed to be OK, and chrome was lightning fast. Turns out that chrome uses DNS prefetching, which doesn't use the local network stack. This threw me onto completely the wrong tack.

After creating a local bind service, firefox seems to be working nicely.

So something to watch out for when running chrome on the same platform as other browsers.

OTHER TIPS

Don't disable keep-alive. It makes that one connection can be used to get multiple pages (or images, or .js files, or .css files, etc.), which reduces page load time significantly.

Just make sure your scripts add Content-Length headers and all will be fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top