Reputation: 393
In experimenting with a custom tile source in OpenSeadragon, I was wondering if there is a way to cycle multiple image hosts, to improve the async way in which the browser retrieves resources?
In the
getTileUrl: function(level, x, y){
return "imagecdn1.example.com/" +
level + "/" + x + "_" + "y" + ".png"
..can I put a %d or some sort of cycling value (of '1' in this example) so that I get the following round-robin set of calls for tiles?
Example sequence:
imagecdn1.example.com
imagecdn2.example.com
imagecdn3.example.com
Is this possible?
As a follow-up if it is not possible, does this really improve the performance anyway in the browser, in that should I even be doing it at a URL level?
Upvotes: 0
Views: 168
Reputation: 979
This is not possible however you can do that yourself in your getTileUrl method:
var inc = 0;
getTileUrl: function(level, x, y){
inc++;
inc = inc % 3 + 1; //number of cdn you have
return "imagecdn" + inc + ".example.com/" +
level + "/" + x + "_" + "y" + ".png"
I doubt that would be really beneficial though.
One disadvantage I can think of is that if a tile is already cached at one URL, it will be redownloaded anyway if getTileUrl return a different URL.
Upvotes: 2