[mapserver-users] Comparing cgi and fcgi for serving aerial images

Daniel Morissette dmorissette at mapgears.com
Fri Dec 18 08:32:39 EST 2009

It's hard to give a definite answer without seeing your actual setup, 
mapfile, data, etc.

However, as a general rule, you will gain from using fastcgi only once 
you get to the point where the processing time for each request (to read 
data and render the map) becomes close to or smaller than the time it 
takes to launch CGI processes. So if you get around 5 hits/sec with 8 
cores, we can presume that each request takes over 1 second of 
processing time (and/or disk I/O) which is several times larger than the 
time to launch a CGI process, and you need to do some work on your data 
and mapfile before you can benefit from fastcgi.

Of course I could be completely wrong, but I'd suggest you start by 
verifying where the time is spent by enabling MS_ERRORFILE/DEBUG at both 
the mapfile and layer level, look at the logs to identify where the time 
is spent and optimize your mapfile/data accordingly.



Rahkonen Jukka wrote:
> I made some tests by letting JMeter run a few thousand WMS GetMap 
> requests with varying BBOX and WIDTH and HEIGHT parameter.  I tested 
> three alternatives:
> MS4W 2.2.8 and Mapserver 5.2.1
> MS4W 3.0 beta 7 and Mapserver 5.6.0 as cgi
> MS4W 3.0 beta 7 and Mapserver 5.6.0 a fcgi
> Server is Windows 2003 server with 8 cores and fast disks. I configured 
> JMeter to use 20 threads
> I feel I was able to get fcgi running by following the instructiuons of 
> MS4W README_INSTALL document.  I believe it is convinced by a) 
> calls addressed to  /fcgi-bin/mapserv.exe work and b) after receiving an 
> image from WMS service the process remains on the server for some time. 
> However, all these three alternatives are giving me about the same 
> speed that is  5 images per second or 500 KB/sec with jpeg output.  
> Bandwidth is not the limiting factor because with 24-bit png output I 
> get a throughput of 4400 KB/sec.  It looks like I am having some  base 
> load in my system that takes about 150 milliseconds per each successful 
> WMS request and using fcgi does not help in my case.
> Can anybody suggest why my server is so much slower than the one used in 
> Mapserver/Geoserver shootout  
> http://www.slideshare.net/gatewaygeomatics.com/wms-performance-shootout and 
> why I do not get any advantage from using Fast-CGI?  Could it be because 
> my tileindex shapefile is rather large with more than 11000 polygons?  
> Images themselves are processed in a standard Mapserver way and they 
> are uncompressed, tiled geotiffs with external uncompressed overviews.  
> Some evidence about tileindex handling eating time is that I can get 
> double speed with 10 images per second from a single ecw file but this 
> test is not very comparable because my ecw file is black and white and 
> not 3-channel as my geotiff layer.
> -Jukka Rahkonen-
> ------------------------------------------------------------------------
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users

Daniel Morissette

More information about the mapserver-users mailing list