I think this filter is working as well as it can given the design tradeoffs 
that mod_pagespeed has made from the beginning, which is to prioritize fast 
delivery of HTML over completing optimizations.

The issue is that the dns prefetch tag has value only in the beginning of the 
page, and only then if the page doesn't get delivered to the browser all at 
once, but is streamed out slowly (e.g. some content pulled from a slow database 
or similar).  In that scenario, the early DNS prefetch can get the browser 
doing something useful while waiting for the rest of the page.

The problem is that mod_pagespeed doesn't know what needs to be prefetched 
until *it* can see the whole page. So it solves the problem with its *property 
cache*. The property cache caches observed properties of an HTML page from when 
it was served earlier. There is no perfect way for mod_pagespeed to know how 
long to keep entries in the property cache. At some point the page can change 
and the domains that were previously important may change.

So mod_pagespeed periodically refreshes this cache in response to page 
requests, and arbitrarily only considers data less than 5 minutes old to be 
valid. This should in practice be effective on pages that are frequently 
viewed. However, on new pages, or debug versions of sites that are essentially 
never accessed, the property cache will be stale, and DNS prefetch will not 
work on the first view of a page. But if you reload the page it will work. 

Thus this feature is useful for accelerating pages that are visited more than 
once every 5 minutes.

[ Full content available at: 
https://github.com/apache/incubator-pagespeed-mod/issues/964 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to