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

Stephen Woodbridge woodbri at swoodbridge.com
Thu Jun 26 12:10:44 EDT 2008


Christopher Schmidt wrote:
> 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.
> 
> Regards,

OK Cool, I guess I need to go back and have the guys explain why they 
thought 4 servers was slower to load than 2 servers and have them do 
some less subjective and more quantitative testing. Based on this I'll 
assume that they did not clear the browser cache between the tests.

<sigh> And I guess I should go read more code before sending email :(

Thank you.
   -Steve



More information about the Dev mailing list