Tuesday, November 18, 2008

Performance !

It's quite obvious to say that the web users like to have fast applications. This is also true in the web mapping area. We present in the MapFish HowTo Optimize some tips regarding performance in MapFish. I'd like to highlight some of these tips:
- In OpenLayers, the "buffer" is per default 2. This means that 2 tiles are downloaded around the viewport. If you reduce this setting, then less tiles will be downloaded.
- Of course, use tilecache to cache the tiles on the server side. We have just commited a nice function that is able to merge tiles on the server sides (if you have several layers). In this case, the browser has not to do the merge.
- With Web 2.0, a lot of functions are developped in Javascript. This code has to be transferred to the browser. You can activate the mod_deflate module in Apache to compress the web server output.
- And of course, the performance of you mapping server (MapServer or GeoServer) can be optimized, for example by using persistent database connection or by avoiding complex styling. But I let you google that ;-)


François Van Der Biest said...

You're also strongly advised to configure your web server to send far-future "expires" headers (with mod_expires for instance, if you're using apache).

This should obviously apply to "static" tiles, but also to any component required by the web pages you serve : CSS, JS, images... (be sure to include a rev. number in your files' name in that case).

You can even add those headers to ajax responses for which the content does not vary with time.

This will improve your user's experience on second and later visits. Don't forget that it's also a cost-saver if you pay for bandwidth.

Anonymous said...

"Adjust your layer extent to your data extent for each layer to avoid generating and downloading transparent tiles."

Silly question : the OpenLayers map object has a maxExtent but I don't see individual WMS layers have an extent that I can configure. How does one adjust one's layers extents with their underlying data? I'm pretty sure I generate blank tiles ...

elem said...

Layers can be configured with a maxExtent option. When a WMS layer is configured with maxExtent tiles that fall completely outside of this maxExtent won't be requested. This is documented as such in the OpenLayers API doc.

Anonymous said...

Thanx Eric; to leave a trace, I had a map extent in 900913 coordinates that was larger than the layer I wanted to TileCache (an Ikonos image). Indeed, Firebug/net tab showed I had a bunch of empty images. So I went and added a maxExtent to my layer, adjusted the BBOX in my cfg file with that and now I get no empty tiles.

I had to re-run tilecache-seed.py because obviously (except for the most zoomed out level) the tile locations have now changed.

Thanx again !