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

Christopher Schmidt crschmidt at metacarta.com
Thu Jun 26 10:46:37 EDT 2008

On Thu, Jun 26, 2008 at 10:37:59AM -0500, Stephen Woodbridge wrote:
> 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. 

No, it's not.

> 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.

This is the case currently.

> 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.

This is exactly what is done.

> Would this idea be worth pursuing?

Were it not already in place: Yes.

Christopher Schmidt

More information about the Dev mailing list