[mapserver-users] How to make MapServer WMS super fast?

Léveillé, James James.Leveille at mtq.gouv.qc.ca
Fri Dec 12 11:00:08 EST 2008


Here is a message published by Alexandre Dubé a few weeks ago - helpfull
 
 
 
Here's how to install and setup fastCGI with Apache 2.2.8 contained in 

the MS4W 2.2.7 version.

1- MS4W 2.2.7 contains a MapServer compiled to support FastCGI so 

nothing needs to be done there.

2- But, Apache 2.2.8 that comes with MS4W 2.2.7 doesn't include the 

mod_fcgi module. This module can be dowloaded at 

http://www.apachelounge.com/download/
<http://www.apachelounge.com/download/>  ... Take the 

mod_fcgid-2.2a-w32.zip which will work with Apache 2.2.8.

3- Copy mod_fcgid.so to your apache/modules folder

4- Install the Visual C++ 2008 Redistributable Package (the binary is 

build with VC 2008). Download and install, if it isn't already done, 

from: 

www.microsoft.com/downloads/details.aspx?FamilyID=9B2DA534-3E03-4391-8A4D-07
4B9F2BC1BF&displaylang=en
<outbind://14/www.microsoft.com/downloads/details.aspx?FamilyID=9B2DA534-3E0
3-4391-8A4D-074B9F2BC1BF&displaylang=en> 

5- Modify your /ms4w/Apache/conf/httpd.conf

a) Add :

LoadModule fcgid_module modules/mod_fcgid.so

b) Add :

ScriptAlias /cgi-bin/ "/ms4w/Apache/cgi-bin/"

ScriptAlias /fcgi-bin/ "/ms4w/Apache/cgi-bin/"

c) Remove :

<Directory "/ms4w/Apache/cgi-bin">

AllowOverride All

Options None

Order allow,deny

Allow from all

</Directory>

d) Add :

<Location "/cgi-bin">

Options None

Order allow,deny

Allow from all

</Location>

e) Add :

<Location "/fcgi-bin">

# The following line activates the fastCGI script to all files 

in location

SetHandler fcgid-script

Options None

Order allow,deny

Allow from all

</Location>

f) Add :

<IfModule fcgid_module>

IPCCommTimeout 60

IdleTimeout 60

DefaultMinClassProcessCount 2

DefaultMaxClassProcessCount 20

DefaultInitEnv PROJ_LIB "c:/ms4w/proj/nad/"

DefaultInitEnv PATH 

"c:/ms4w/Apache/cgi-bin;c:/WINDOWS/system32;c:/WINDOWS;c:/WINDOWS/System32/W
bem;"

DefaultInitEnv windir "c:/WINDOWS"

DefaultInitEnv SystemRoot "c:/WINDOWS"

DefaultInitEnv SystemDrive "c:"

DefaultInitEnv GDAL_DATA "c:/ms4w/gdaldata"

DefaultInitEnv GDAL_DRIVER_PATH "c:/ms4w/gdalplugins"

DefaultInitEnv TMP "c:/ms4w/tmp"

DefaultInitEnv TEMP "c:/ms4w/tmp"

</IfModule>

6- Restart Apache : /ms4w/apache-restart.bat

7- In your mapfile, set a PROCESSING directive to tell FastCGI to cache 

the connections and layer information on all layers for which connection 

caching is desired - ie. all slow layers.

a) Add :

PROCESSING "CLOSE_CONNECTION=DEFER"

8- Now you can load your map using either normal CGI or FastCGI :

a) CGI :

http://host:port/cgi-bin/mapserv.exe <http://host:port/cgi-bin/mapserv.exe>
?...

b) fastCGI :

http://host:port/fcgi-bin/mapserv.exe
<http://host:port/fcgi-bin/mapserv.exe> ?...

That way, your original cgi-bin folder wont be affected by fastCGI 

unless you use the modified url with "fcti-bin" which is the alias you 

added to your httpd.conf file at 5b).

Special thanks to Jeff McKenna and Daniel Morissette who helped me a lot 

with this.

 

 

 
 

______________________________________________________

JAMES LÉVEILLÉ
Service des systèmes de Mission
Direction des technologies de l'information
Ministère des Transports du Québec

5833, boul. Pierre-Bertrand, 2ième étage
Québec (Québec) G2K 1K7
Téléphone:   (418) 380-2005 poste 227
Télécopieur: (418) 644-6653
james.leveille at mtq.gouv.qc.ca <mailto:james.leveille at mtq.gouv.qc.ca> 


 

	-----Message d'origine-----
	De : mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] De la part de Rahkonen
Jukka
	Envoyé : 12 décembre 2008 10:39
	À : Marcelo Oliveira; mapserver-users at lists.osgeo.org
	Objet : Re: [mapserver-users] How to make MapServer WMS super fast?
	
	
	Hi,
	 
	Thanks, I will try Fast CGI.  Are there some simple enough document
for a ms4w users about how to turn the system to use Fast CGI?
	 
	-Jukka-


________________________________

		Lähettäjä: Marcelo Oliveira [mailto:moliveira at GEOSTATS.com] 
		Lähetetty: 12. joulukuuta 2008 17:05
		Vastaanottaja: Rahkonen Jukka;
mapserver-users at lists.osgeo.org
		Aihe: RE: [mapserver-users] How to make MapServer WMS super
fast?
		
		

		Try using Fast CGI, it should improve your latency problem
you are seeing.  It is also possible that using other raster formats could
help.

		 

		Good luck! M

		 

		--------------

		Marcelo Simas Oliveira

		GeoStats LP

		530 Means St., Ste. 310

		Atlanta, Georgia 30318

		(404) 588-1004

		www.geostats.com

		 

		From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Rahkonen Jukka
		Sent: Friday, December 12, 2008 10:01 AM
		To: mapserver-users at lists.osgeo.org
		Subject: [mapserver-users] How to make MapServer WMS super
fast?

		 

		Hi,

		 

		Are there any effective tricks for making MapServer to
Top-Fuel class?  We have now a typical ms4w installation on a rather good
server platform with SCSI drives and 2 four-core processors running on
Windows 2003 server. Our images are tiled, uncompressed geotiffs with
overviews, vector sample data set is shapefile with shptree index.  I have a
shortened epsg file and my mapfile is extra short. Bandwith is not the
limit. We are getting out now about 450 orthoimage pictures per minute (size
500 by 500 pixels) and 550 pictures from the vector layer in png24 image
format.  I consider that rather good, but we are required to reach 20 images
per second, thus 1200 images per minute or 0.05 seconds per image.  I wonder
if anybody has tuned MapServer that far.

		 

		I am willing to try however exotic solutions to reach the 20
WMS output images/second goal if somebody could suggest me what to try next.
In our system there seems to be about 0.1 second ballast with WMS getMap
requests and I cannot get any faster response even if I try with on empty
data layer with nothing to render.  Have anybody tried to keep mapfile,
epsg-file or even tileindex files in RAM drive?  

		 

		Having about 20 parallel users seems to be optimal for our
server and if I drive just WMS getCapabilities request against my mapfile I
can get about 1300 responses per minute.  That leads me to think that 1200
rendered images per minute might be possible to reach with optimal set-up.

		 

		-Jukka Rahkonen-

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20081212/8066422e/attachment-0001.html


More information about the mapserver-users mailing list