MapServer Performance Tips

Gregor Mosheh gregor at HOSTGIS.COM
Tue Aug 7 16:28:56 EDT 2007


>>  I'm not really sure that I want to move
>> these separate layers into one with just class definitions because the
>> legend does display the class definitions only layers

That's not right; it should show them for every class that has a NAME 
element.

Looking at your code sample, I'd have to agree that there are probably 
circumstances where 5 layers using FILTER may be faster than 1 layer 
using 5 classes, and vice versa.

If your data were in PostGIS and the filtering were happening by the 
same column in each case, and that column were indexed and also 
clustered, that'd probably show some excellent performance using the 
filter (keep the filtering in the DB instead of taking it to Mapserver).

If your data is in shapefiles, though, the indexing by criteria isn't 
happening and Mapserver has to do a sequential scan and class-matching 
for every record in the spatial region represented. For each layer. Five 
times. Ouch.

So yeah, if you're sticking with shapefiles I'd agree with the others 
that 1 layer with 5 classes would probably be the best bet. If you're 
willing to put in the work to put it into PostGIS, you could probably 
have 5 layers work very nicely.


>> I'm really wondering if this is a hardware issue. The box is
>> a Sun server with 4 x 400MHz processors and 4GB ram. That might not be a
>> powerful enough machine to do what I'm trying to do.

Should be fine; that's plenty of hardware.


> You might want to try shp2img on your mapfile as you edit it, to help 
> make sure your benchmark conditions are consistent between runs.
> http://mapserver.gis.umn.edu/docs/reference/utilityreference/shp2img

Good move, Hal. I'll take a note of this and add it to the performance 
docs we've been working on.

-- 
Gregor Mosheh / Greg Allensworth
System Administrator, HostGIS cartographic development & hosting services
http://www.HostGIS.com/

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA



More information about the mapserver-users mailing list