[mapserver-dev] Mapfile is parsed on every MapServer FastCGI request

Stephen Woodbridge woodbri at swoodbridge.com
Mon Jan 3 09:54:30 EST 2011


No that is the way things work.
FastCGI gives you primarily two benefits:

1. process creation only happens ones
2. you can cache you database connection which can be very costly to 
reconnect.

The reason that the mapfile is not cached is because you can have a site 
that supports multiple mapfiles, Mapfiles can be changed via the URL 
parameters and parts of mapfiles can to changed via substitution 
parameters in the URL.

Hope this helps,
   -Steve W
    http://imaptools.com/

On 1/3/2011 9:49 AM, Bjoern Schilberg wrote:
> Hello,
> i discover that every time a request is send to a MapServer FastCGI the
> complete mapfile is read and parsed on every request. I would expect that the
> mapfile configuration is only read once, when the first request is send to the
> MapServer FastCGI and __NOT__ on every request. Is my expectation wrong or did
> i configure the MapServer FastCGI in a wrong way?
>
> bj
>
> Debug / Reproduce
> ===========
>
> I discovered the behavior by using strace:
>
> strace -s 2000 -ff -p pid*
>
> *-p pid: Process ID of MapServer FastCGI
>
>
> Configuration
> ========
>
> This is the way how the MapServer FastCGI is configured:
>
> vhost.conf
> -------------
>
> ...
>
> <Directory "/srv/www/fcgi-bin">
> SetHandler fcgid-script
> SetEnvIf Request_URI "/fcgi-bin/wms.fcgi"
> MS_MAPFILE=/PATH/TO/MAPFILE/mapfile.map
> AllowOverride None
> Options +ExecCGI -MultiViews FollowSymLinks
> Order allow,deny
> Allow from all
> </Directory>
>
> ...
>
> In /srv/www/fcgi-bin
> ------------------------
>
> lrwxrwxrwx 1 root root   12 2010-12-16 11:10 wms.fcgi ->  mapserv.fcgi
> -rwxr-xr-x 1 root root 1.6M 2010-12-16 10:35 mapserv.fcgi
>
> Environment
> ========
>
> ./mapserv.fcgi -v
> MapServer version 5.6.5 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
> OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV
> SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER
> SUPPORTS=WFS_CLIENT
> SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS
> SUPPORTS=GEOS SUPPORTS=RGBA_PNG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=MYGIS
> INPUT=SHAPEFILE
>
> /usr/sbin/httpd2 -v
> Server version: Apache/2.2.10 (Linux/SUSE)
> Server built:   May  5 2010 14:32:30
>
> Information for package apache2-mod_fcgid:
> Name: apache2-mod_fcgid
> Version: 2.2-31.17
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev



More information about the mapserver-dev mailing list