Setting up a FastCGI UMN Mapserver

When dealing with height data we usually have numerous features stored in a database.
In my own experience over 250.000 features were stored in a PostGIS 1.5 database. The features were spread almost globally.

A UMN Mapserver was set up on a local Windows 7 System and a Debian squeeze Server.
On both Systems the Response time was quite slow (> 5000 ms).
Setting up a FastCGI Mapserver gives an impressive performance boost on both Systems (< 500ms).

UMN Mapserver Response – FastCGI [ms] UM Mapserver Response - CGI [ms]
375 5944
375 5959
156 5943
141 5975
156 5959
141 5944
359 6006
140 5975
358 5959
125 6006
Avergage:  232,6 Average: 5967

Table 1: Comparison of response time for a UMN Mapserver with (left) and without (right) FastCGI mode. The test was done on a local Windows7 System without any other traffic.

There are already DEBIAN UMN Mapserver packages available

Simply install the UMN mapserver:

apt-get install cgi-mapserver

The installed mapserver is already built with the FastCGI option.
All you need is to install is this:

apt-get install libapache2-mod-fcgid

Make a copy of your mapserv file (/usr/lib/cgi-bin in my case) with the name mapserv.fcgi and restart the Apache.

cp mapserv mapserv.fcgi

/etc/init.d/apache restart

The Map request is now: http://YourServerName/cgi-bin/mapserv.fcgi?...

Here are some great performance tipps for UMN Mapserver & PostGIS

Astonishingly the Geoserver (testet versions: 2.2 and 2.1.2) was is this case even slower than the UMN CGI Mapserver, with inadmissible response times (> 20.000 ms).