OpenLayers/FasterTiles
Jump to navigation
Jump to search
| Using multiple hostnames for faster loading of tiles is outdated and bad practice. Browsers support HTTP/2 nowadays which is solves this problem. Please ignore the advice on this page. It will be deleted soon. |
OpenLayers has the ability to load from multiple tile servers URLs at once. Since browsers limit concurrent requests based on hostname, this means that by configuring additional hostnames, the browser will load more tiles simulatneously, resulting in a faster load time.
To set this up:
- Set up multiple DNS aliases for the same content. It may make sense to simply set up a wildcard DNS name for tile loading, a la *.tile.openstreetmap.org
- Change the OpenLayers.Layer creation to use multiple URLs:
- Layer.TMS("Name", ['http://tile1.tile.openstreetmap.org/tiles/', 'http://tile2.tile.openstreetmap.org/tiles/'], {'layername':'mapnik'})
- Watch as tiles load more quickly!