1

Hopefully someone can help. I'm using OpenLayers and have a TMS layer with local tiles stored. When drawing the tiles it seems slow, I see the tiles load one by one.

Is there a way to make getURL request handle multiple tiles at once?

1 Answer 1

3

You are running into the limit of multiple connections to one server.

According to standards the HTTP 1.1 RFC limits persistent connections to 2 per server. This means that at one time a browser should parallel download/receive only two files from the same server.

This limit was set in the early days of the internet, and thankfully most browsers ignore this limit and request for more resources simultaneously.

So you should see 6 to 8 requests simultaneously, if you use a modern browser like Mozilla Firefox or Google Chrome.

To increase the speed even further, you need to serve the tiles from several hostnames. By configuring additional hostnames, the browser will load more tiles simultaneously, 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'})

You should also have a look at this sample: Multiple Server URLS

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.