Fossgis: speed increase of web map services with proxies - Johannes WeskammΒΆ

Tags: fossgis

Lots of WMS services are slow. The server constantly has to render images and the users simply have to wait and wait and wait. The solution: a wms proxy. You get quicker responses. Usability for the user goes up and the amount of work for the WMS server goes down.

Normally you’ve got data; a WMS server renders an image; the client gets the image. With a proxy, the proxy is the WMS server’s client and the proxy itself is the server that takes direct requests from the client. Often, the proxy only caches a certain area on the map.

What happens is that the proxy stores rendered tiles, so there is no re-re-re-rendering on the WMS server anymore. The proxy just stores a heap of tiles and serves them. If the proxy doesn’t yet have a tile, it only has to create it once (and thus it only requests it once from the actual WMS server).

Every map proxy uses tiles. There are two basic ways in which a proxy can generate them:

  • On demand: they’re only made when first requested. So the cache starts out small and grows continuously.
  • Seeding: everything is calculated beforehand. Often only in a certain area (normally a bounding box, but mapproxy also allows selection by polygon). And you have to tell it which zoomlevels and which tile size you want.

There are three well-known proxies:

  • Tilecache
  • GeoWebCache
  • MapProxy

WMS proxies can be accessed as a regular WMS server: GetCapabilities, GetMap, GetFeatureInfo, GetLegendGraphic and so on.

Apart from the speed increase, a proxy also means you can still get maps even if the original WMS server isn’t available. So you get a bit more reliability for free.

There are also drawbacks.

  • The biggest is the freshness of the tiles. You’ll have to set up deletion of cached tiles and seeding of new ones based upon the needs and update interval of the original WMS server.
  • A second drawback is that you can run into problems with symbols and map labels if they cross a tile boundary. There are solutions for that, though, like the “MetaTiles” option in mapproxy.
  • A third drawback is that you basically limit yourself to a limited set of zoom levels. You cannot store unlimited zoom levels. So a regular WMS server is more flexible in this regard. There are tricks you can use in the proxy, like stretching, that mimick the behaviour.

Despite the drawbacks, the advantages outweigh them! Speed!

Along the Neckar
blog comments powered by Disqus
 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):