[OpenLayers-Dev] Caching layerimages by browsers

Tim Schaub tschaub at opengeo.org
Tue Mar 9 14:24:31 EST 2010


Claude Philipona wrote:
>> So, you can improve the caching situation by having your server (or
>> gateway cache) use appropriate headers on responses.
> 
> In a deep analysis of OL cache browser use in firefox using the
> firefox extension "Page Seed", we found out that Firefox is actually
> not always using properly the cache browser with OL preseeded tile
> system, even though the headers are properly set on the http server.
> 

... snip ...

> 
> We found out that we are facing this kind of FF limitation with OL
> preseeded layers served thru varnish or Squid
> 
> More info from:
> 
> http://code.google.com/speed/page-speed/docs/caching.html#LeverageBrowserCaching
> 
> Avoid URLs that cause cache collisions in Firefox.
> 

Great info Claude.  Thanks for pointing that out.  I would classify this 
as a browser limitation that OpenLayers has no real control over.

The locations exposed for tile resources are not the responsibility of 
OpenLayers.  We cannot force a different URL to resolve to the same 
resource as another - so with OpenLayers alone, you cannot resolve the 
Firefox disambiguation issue.

However, if you configure your server to expose the same resource with 
multiple URLs, then OpenLayers can take advantage of this (as you 
imply).  Using an array for the layer's url property (with different 
subdomains) would be a way to reduce the chance of cache "collisions."

At some point, I imagine this Firefox limitation will be gone.  Properly 
using cache related headers will always be good advice.

Tim

>    The Firefox disk cache hash functions can generate collisions for
> URLs that differ only slightly, namely only on 8-character boundaries.
> When resources hash to the same key, only one of the resources is
> persisted to disk cache; the remaining resources with the same key have
> to be re-fetched across browser restarts. Thus, if you are using
> fingerprinting or are otherwise programmatically generating file URLs,
> to maximize cache hit rate, avoid the Firefox hash collision issue by
> ensuring that your application generates URLs that differ on more than
> 8-character boundaries.
> 
> Claude
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Dev mailing list