Map Application Performance Tuning - Part 1

My current task is to improve the performance of a web application that runs on Apache 2.2.10 on OpenSuse 10.6, 64bit. It is a map application that works with Google Maps JavaScript API, OpenLayers JavaScript API on the client side and a Mapserver on the server side.

After discovering that the response time of my server was sometimes quite long (using firebug), I decided to start optimizing the server side application first.

1. First step I did was installing Tilecache, a Python-based server that caches tiles from different sources on disk. Installation is easy and straightforward. The test run worked correctly.

2. Figuring out how my application or better a OpenLayers.Layer.WMS object could request tiles via Tilecache that were formerly requested from Mapserver was a little bit harder. First I had to install Python MapScript (to enable communication between Tilecache and Mapserver). which I managed by following the advices "Building and Installing Python MapScript" in Chapter 7 from the "Beginning MapServer" book from Bill Kropla. As far as I know now, each map that should be cached by and requested via Tilecache has to have a correct entry in tilecache.cfg.

Example:
[worldtest]
layers = country
spherical_mercator = yes
extension = png
mapfile = mapfile.map
data_extent = -198.0,-115.542749339,198.0,109.146905833
type = MapServer
metatile = no
srs = EPSG:4326
metabuffer = 10,10
bbox = -198.0,-115.542749339,198.0,109.146905833
metasize = 5,5
extent_type=loose

This layer can requested via an OpenLayers.Layer.WMS object as follows:

var layer = new OpenLayers.Layer.WMS("name",
  "http://localhost/cgi-bin/tilecache/tilecache.cgi", {
  maxExtent:new OpenLayers.Bounds(1,2,3,4),
  maxResolution:156543.0339,
  layers:"worldtest",
  transparent:true
});

No comments yet.