<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v = 
"urn:schemas-microsoft-com:vml" xmlns:o = 
"urn:schemas-microsoft-com:office:office" xmlns:w = 
"urn:schemas-microsoft-com:office:word" xmlns:m = 
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3429" name=GENERATOR>
<STYLE>@font-face {
        font-family: Calibri;
}
@font-face {
        font-family: Tahoma;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; COLOR: black; FONT-FAMILY: "Times New Roman","serif"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; COLOR: black; FONT-FAMILY: "Times New Roman","serif"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; COLOR: black; FONT-FAMILY: "Times New Roman","serif"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.EmailStyle17 {
        COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-reply
}
.MsoChpDefault {
        FONT-SIZE: 10pt; mso-style-type: export-only
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US vLink=purple link=blue bgColor=white>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN class=513565815-12122008>Here 
is a message published by Alexandre Dubé a few weeks ago - 
helpfull</SPAN></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=513565815-12122008></SPAN></FONT> </DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=513565815-12122008></SPAN></FONT> </DIV>
<DIV><FONT face=Verdana color=#0000ff size=2></FONT> </DIV>
<DIV><FONT size=2>
<P>Here's how to install and setup fastCGI with Apache 2.2.8 contained in </P>
<P>the MS4W 2.2.7 version.</P>
<P>1- MS4W 2.2.7 contains a MapServer compiled to support FastCGI so </P>
<P>nothing needs to be done there.</P>
<P>2- But, Apache 2.2.8 that comes with MS4W 2.2.7 doesn't include the </P>
<P>mod_fcgi module. This module can be dowloaded at </P>
<P></FONT><A href="http://www.apachelounge.com/download/"><U><FONT color=#0000ff 
size=2>http://www.apachelounge.com/download/</U></FONT></A><FONT size=2> ... 
Take the </P>
<P>mod_fcgid-2.2a-w32.zip which will work with Apache 2.2.8.</P>
<P>3- Copy mod_fcgid.so to your apache/modules folder</P>
<P>4- Install the Visual C++ 2008 Redistributable Package (the binary is </P>
<P>build with VC 2008). Download and install, if it isn't already done, </P>
<P>from: </P>
<P></FONT><A 
href="outbind://14/www.microsoft.com/downloads/details.aspx?FamilyID=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en"><U><FONT 
color=#0000ff 
size=2>www.microsoft.com/downloads/details.aspx?FamilyID=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en</U></FONT></A></P><FONT 
size=2>
<P>5- Modify your /ms4w/Apache/conf/httpd.conf</P>
<P>a) Add :</P>
<P>LoadModule fcgid_module modules/mod_fcgid.so</P>
<P>b) Add :</P>
<P>ScriptAlias /cgi-bin/ "/ms4w/Apache/cgi-bin/"</P>
<P>ScriptAlias /fcgi-bin/ "/ms4w/Apache/cgi-bin/"</P>
<P>c) Remove :</P>
<P><Directory "/ms4w/Apache/cgi-bin"></P>
<P>AllowOverride All</P>
<P>Options None</P>
<P>Order allow,deny</P>
<P>Allow from all</P>
<P></Directory></P>
<P>d) Add :</P>
<P><Location "/cgi-bin"></P>
<P>Options None</P>
<P>Order allow,deny</P>
<P>Allow from all</P>
<P></Location></P>
<P>e) Add :</P>
<P><Location "/fcgi-bin"></P>
<P># The following line activates the fastCGI script to all files </P>
<P>in location</P>
<P>SetHandler fcgid-script</P>
<P>Options None</P>
<P>Order allow,deny</P>
<P>Allow from all</P>
<P></Location></P>
<P>f) Add :</P>
<P><IfModule fcgid_module></P>
<P>IPCCommTimeout 60</P>
<P>IdleTimeout 60</P>
<P>DefaultMinClassProcessCount 2</P>
<P>DefaultMaxClassProcessCount 20</P>
<P>DefaultInitEnv PROJ_LIB "c:/ms4w/proj/nad/"</P>
<P>DefaultInitEnv PATH </P>
<P>"c:/ms4w/Apache/cgi-bin;c:/WINDOWS/system32;c:/WINDOWS;c:/WINDOWS/System32/Wbem;"</P>
<P>DefaultInitEnv windir "c:/WINDOWS"</P>
<P>DefaultInitEnv SystemRoot "c:/WINDOWS"</P>
<P>DefaultInitEnv SystemDrive "c:"</P>
<P>DefaultInitEnv GDAL_DATA "c:/ms4w/gdaldata"</P>
<P>DefaultInitEnv GDAL_DRIVER_PATH "c:/ms4w/gdalplugins"</P>
<P>DefaultInitEnv TMP "c:/ms4w/tmp"</P>
<P>DefaultInitEnv TEMP "c:/ms4w/tmp"</P>
<P></IfModule></P>
<P>6- Restart Apache : /ms4w/apache-restart.bat</P>
<P>7- In your mapfile, set a PROCESSING directive to tell FastCGI to cache </P>
<P>the connections and layer information on all layers for which connection </P>
<P>caching is desired - ie. all slow layers.</P>
<P>a) Add :</P>
<P>PROCESSING "CLOSE_CONNECTION=DEFER"</P>
<P>8- Now you can load your map using either normal CGI or FastCGI :</P>
<P>a) CGI :</P>
<P></FONT><A href="http://host:port/cgi-bin/mapserv.exe"><U><FONT color=#0000ff 
size=2>http://host:port/cgi-bin/mapserv.exe</U></FONT></A><FONT size=2>?...</P>
<P>b) fastCGI :</P>
<P></FONT><A href="http://host:port/fcgi-bin/mapserv.exe"><U><FONT color=#0000ff 
size=2>http://host:port/fcgi-bin/mapserv.exe</U></FONT></A><FONT size=2>?...</P>
<P>That way, your original cgi-bin folder wont be affected by fastCGI </P>
<P>unless you use the modified url with "fcti-bin" which is the alias you </P>
<P>added to your httpd.conf file at 5b).</P>
<P>Special thanks to Jeff McKenna and Daniel Morissette who helped me a lot </P>
<P>with this.</P>
<P> </P>
<P><FONT face=Verdana color=#0000ff></FONT> </P></FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV class=Section1>
<P align=left><SPAN lang=FR-CA 
style="COLOR: navy; FONT-FAMILY: 'Arial Black'; mso-ansi-language: FR-CA">______________________________________________________</SPAN></P>
<P><SPAN lang=FR-CA 
style="COLOR: navy; FONT-FAMILY: 'Arial Black'; mso-ansi-language: FR-CA"><FONT 
size=2><FONT face=Verdana><FONT size=4><STRONG>JAMES 
LÉVEILLÉ<BR></STRONG></FONT>Service des systèmes de Mission<BR>Direction des 
technologies de l'information<BR>Ministère des Transports du 
Québec</FONT></FONT></SPAN></P>
<P><SPAN lang=FR-CA 
style="COLOR: navy; FONT-FAMILY: 'Arial Black'; mso-ansi-language: FR-CA"><FONT 
face=Verdana size=2>5833, boul. Pierre-Bertrand, 2ième étage<BR>Québec (Québec) 
G2K 1K7<BR>Téléphone:   (418) 380-2005 poste 227<BR>Télécopieur: (418) 
644-6653<BR><A href="mailto:james.leveille@mtq.gouv.qc.ca"><FONT 
color=#000080>james.leveille@mtq.gouv.qc.ca</FONT></A><BR></FONT></SPAN></P>
<P><FONT color=#000080></FONT> </P></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=OutlookMessageHeader lang=fr dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Message d'origine-----<BR><B>De :</B> 
  mapserver-users-bounces@lists.osgeo.org 
  [mailto:mapserver-users-bounces@lists.osgeo.org] <B>De la part de</B> Rahkonen 
  Jukka<BR><B>Envoyé :</B> 12 décembre 2008 10:39<BR><B>À :</B> 
  Marcelo Oliveira; mapserver-users@lists.osgeo.org<BR><B>Objet :</B> Re: 
  [mapserver-users] How to make MapServer WMS super fast?<BR><BR></FONT></DIV>
  <DIV dir=ltr align=left><SPAN class=019313015-12122008><FONT face=Arial 
  color=#0000ff size=2>Hi,</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN class=019313015-12122008><FONT face=Arial 
  color=#0000ff size=2></FONT></SPAN> </DIV>
  <DIV dir=ltr align=left><SPAN class=019313015-12122008><FONT face=Arial 
  color=#0000ff size=2>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?</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN class=019313015-12122008><FONT face=Arial 
  color=#0000ff size=2></FONT></SPAN> </DIV>
  <DIV dir=ltr align=left><SPAN class=019313015-12122008><FONT face=Arial 
  color=#0000ff size=2>-Jukka-</FONT></SPAN></DIV><BR>
  <BLOCKQUOTE dir=ltr 
  style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
    <DIV class=OutlookMessageHeader lang=fi dir=ltr align=left>
    <HR tabIndex=-1>
    <FONT face=Tahoma size=2><B>Lähettäjä:</B> Marcelo Oliveira 
    [mailto:moliveira@GEOSTATS.com] <BR><B>Lähetetty:</B> 12. joulukuuta 2008 
    17:05<BR><B>Vastaanottaja:</B> Rahkonen Jukka; 
    mapserver-users@lists.osgeo.org<BR><B>Aihe:</B> RE: [mapserver-users] How to 
    make MapServer WMS super fast?<BR></FONT><BR></DIV>
    <DIV></DIV>
    <DIV class=Section1>
    <P class=MsoNormal><SPAN 
    style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Try 
    using Fast CGI, it should improve your latency problem you are seeing.  
    It is also possible that using other raster formats could 
    help.<o:p></o:p></SPAN></P>
    <P class=MsoNormal><SPAN 
    style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </o:p></SPAN></P>
    <P class=MsoNormal><SPAN 
    style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Good 
    luck! M<o:p></o:p></SPAN></P>
    <P class=MsoNormal><SPAN 
    style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </o:p></SPAN></P>
    <DIV>
    <P class=MsoNormal><SPAN lang=PT-BR 
    style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">--------------<o:p></o:p></SPAN></P>
    <P class=MsoNormal><SPAN lang=PT-BR 
    style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Marcelo 
    Simas Oliveira<o:p></o:p></SPAN></P>
    <P class=MsoNormal><SPAN lang=PT-BR 
    style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">GeoStats 
    LP<o:p></o:p></SPAN></P>
    <P class=MsoNormal><SPAN lang=PT-BR 
    style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">530 
    Means St., Ste. 310<o:p></o:p></SPAN></P>
    <P class=MsoNormal><SPAN 
    style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Atlanta, 
    Georgia 30318<o:p></o:p></SPAN></P>
    <P class=MsoNormal><SPAN 
    style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">(404) 
    588-1004<o:p></o:p></SPAN></P>
    <P class=MsoNormal><SPAN 
    style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">www.geostats.com<o:p></o:p></SPAN></P></DIV>
    <P class=MsoNormal><SPAN 
    style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </o:p></SPAN></P>
    <DIV>
    <DIV 
    style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
    <P class=MsoNormal><B><SPAN 
    style="FONT-SIZE: 10pt; COLOR: windowtext; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
    style="FONT-SIZE: 10pt; COLOR: windowtext; FONT-FAMILY: 'Tahoma','sans-serif'"> 
    mapserver-users-bounces@lists.osgeo.org 
    [mailto:mapserver-users-bounces@lists.osgeo.org] <B>On Behalf Of 
    </B>Rahkonen Jukka<BR><B>Sent:</B> Friday, December 12, 2008 10:01 
    AM<BR><B>To:</B> mapserver-users@lists.osgeo.org<BR><B>Subject:</B> 
    [mapserver-users] How to make MapServer WMS super 
    fast?<o:p></o:p></SPAN></P></DIV></DIV>
    <P class=MsoNormal><o:p> </o:p></P>
    <P class=MsoNormal><SPAN 
    style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">Hi,</SPAN><o:p></o:p></P>
    <P class=MsoNormal> <o:p></o:p></P>
    <P class=MsoNormal><SPAN 
    style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">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.</SPAN><o:p></o:p></P>
    <P class=MsoNormal> <o:p></o:p></P>
    <P class=MsoNormal><SPAN 
    style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">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?  </SPAN><o:p></o:p></P>
    <P class=MsoNormal> <o:p></o:p></P>
    <P class=MsoNormal><SPAN 
    style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">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.</SPAN><o:p></o:p></P>
    <P class=MsoNormal> <o:p></o:p></P>
    <P class=MsoNormal><SPAN 
    style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">-Jukka 
    Rahkonen-</SPAN><o:p></o:p></P></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>