[OpenLayers-Dev] Better caching of tiles when using multiple servers

Stephen Woodbridge woodbri at swoodbridge.com
Thu Jun 26 11:37:59 EDT 2008

Hi all,

I wanted to float an idea that I think might give better tile caching 
results when using multiple tile servers.

An observation. We set up a ka-map style cache that is precached. We 
added 4 servers to the layer definition and it appeared that any given 
tile might get served from any of the servers. IE: there is the 
potential for the tile being cached 4 times, once from each server, 
because the host assignment I think is done on a rotating basis. We 
found the two servers seemed to be subjectively faster (I'm not sure if 
the tester flushed the cache between tests).

Assuming the observations and assumptions are correct, the optimization 
idea would be to do something simple to ensure that a given tile is 
always requested from the same server so once we have it and its cached 
in the browser we never request it from a different server.

One idea for doing this would be to change the rotating host assignment 
to an algorithm like:

   host_index = checksum(url_less_host) % num_hosts;

where checksum() is a simple checksum of the url string.

Sorry no patch, and I haven't even read the code that does the current 

Would this idea be worth pursuing?

-Steve W

More information about the Dev mailing list