[Mapserver-dev] FastCGI Implementation / connection pooling

Daniel Morissette dmorissette at dmsolutions.ca
Thu Sep 23 15:17:32 EDT 2004


Frank Warmerdam wrote:
> 
> Refractions and I are not committed to proceeding on the FastCGI
> implementation.  The only comment I had was from Sean who was interested
> in being able to capture the "stdout" output of various functions such as
> the capabilities document generation. 

Frank,

I also have a few ideas but had not replied yet since I'm not exactly 
clear on what I would like to suggest.

FastCGI shares some of the same requirements as persistent MapScript 
modules (it's true for PHP, and quite likely for Python and others), so 
I think that any FastCGI work should be done with the MapScript 
requirements in mind.

For instance, when PHP runs as a DSO, things like printf to stdout, or 
dealing with chdir() and getcwd() all need to go through a virtual API. 
At a minimum I would like to be able to replace the FastCGI wrappers 
with my own PHP wrappers when building PHP MapScript. Sean may want to 
do the same for SWIG MapScript, I'm not sure?

One possible approach may be a table of virtual functions that is stored 
somewhere (where?), but as you mentioned already that would add overhead 
for the regular CGI case.

If we just go with a #ifdef, to replace regular stdio with FastCGI stdio 
then that still doesn't help PHP and other MapScript since the MapScript 
modules are linked only with libmap.a/.so and they have no way to 
control the #ifdef that were evaluated while libmap.a/.so was built. 
Furthermore we want the same libmap.a/.so to be usable for mapserv, 
fastcgi, php_mapscript, and all other SWIG MapScripts, so we don't want 
to hardcode FastCGI stuff in libmap.a/.so

Maybe one possibility would be that MapScript define and link with its 
own custom ms_stdio.o file on top of libmap.a. If I remember correctly 
it is possible to override symbols from a .a file with a .o file. e.g. 
When you link a binary with libmap.a and ms_stdio.o, the symbols in the 
ms_stdio.o will take precedence over the ones in libmap.a. I remember 
that we've used that trick before in other projects, but I'm wondering 
if that's a really viable approach that works on any system or if that's 
just a side-effect that may not work that well. I also don'tknow if that 
works only with static .a files and may not work with a libmap.so?

Anyway, my thoughts are still very unclear, but I just hope that you can 
do something that will be flexible enough to be reusable by the various 
MapScript modules.

Daniel
-- 
------------------------------------------------------------
  Daniel Morissette               dmorissette at dmsolutions.ca
  DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------



More information about the mapserver-dev mailing list