[ka-Map-users] Speeding up tile display/download
Ionut Muntean
ionut at muntean.ro
Sat Feb 17 14:00:46 EST 2007
Hi,
Don't know if this is already known by you, but it is worth a try to
share this.
I've always wondered why google maps displays the tiles so fast.
mt0..mt3.google.com resolves to the same server. So what's the clue?
Fortunately, i've bumped on some web page where it says that IE and
Firefox have only 4 sockets for downloading the web page content.
So, what if altering kaMap.setTile() to use, sequentially, 4 server
names to build img.src?
The improvement was dramatically! The tiles are now loading 4 to 5 times
faster.
tileURL is now an array that holds 4 server names that are basically
only cnames in the dns server to the same server.
The setTile() function was modified to sequential build the img.src like
this (this is only the last part of the function):
.....
var idx = this._map.kaMap.tileIDX;
if (this._map.kaMap.tileURL[idx].indexOf('?') != -1) {
if (this._map.kaMap.tileURL[idx].slice(-1) != '&') {
q = '&';
} else {
q = '';
}
} else {
var src = this._map.kaMap.tileURL[idx] +
q + 'map=' + this._map.name +
'&t=' + t +
'&l=' + l +
szScale + szForce + szGroup + szImageformat + szTimestamp +
szVersion;
}
if (img.src != src) {
img.style.visibility = 'hidden';
img.src = src;
}
idx++;
if (idx == this._map.kaMap.tileURL.length) {
this._map.kaMap.tileIDX = 0;
} else {
this._map.kaMap.tileIDX = idx;
}
}
Of course this method presumes that you have access to the DNS servers
of the company or whoever is hosting your pages.
Hope this is usefull info for someone.
/ IM
More information about the ka-Map-users
mailing list