[mapserver-users] Using Fast CGI with MapServer to alleviate poor performance

John Westwood John.Westwood at port.ac.uk
Thu Sep 18 14:23:51 EDT 2008


Hi Paul,

Thanks for the tips, I forgot about trying from the command line and the apache log :) Anyway, I found out the problem was to do with libpq.so.4 (which is a Postgres library) not being found. My colleague had upgraded Postgres, so it wasn't me that broke MapServer afterall !

The new libpq library is libpq.so.5. Recompiling MapServer did not solve the problem, so I just symlinked libpq.so.4 to libpq.so.5 . Problem solved.

Now to track down the performance issues!

Thanks,

John



>>> "Paul Ramsey" <pramsey at cleverelephant.ca> 18/09/08 1:09 AM >>>
Pull out your command-line, you probably have a linking library
problem, and mapserv is just dying unceremoniously.

So first: can you just run "mapserv" on the command line. If not,
what's the error? is it instructive?
Second, if just a plain "mapserv" runs, what happens when you feed it
your workload? the trick is to use the mysterious "QUERY_STRING"
commandline parameter, thusly:

./mapserv "QUERY_STRING=map=/your/map.map&layers=yourlayers&etc"

This runs mapserv in pretend CGI mode, without having a web server in
the way, very handy for debugging.

P.

PS - I just realized, usually you can see the error in the apache
error_log, skipping all this tedious command-line stuff.


On Wed, Sep 17, 2008 at 3:00 PM, John Westwood <John.Westwood at port.ac.uk> wrote:
> Hi Paul,
>
> Thanks for the useful information. The performance is pretty terrible, so I will have to do some more investigating. The MapServer executable almost completely maxes out two cores and it can take 30 seconds or more to fetch all the tiles for a particular view. I do connect to Postgres to fetch map metadata and I pull the info from MapServer using WFS. Perhaps this is causing a problem.
>
> One large problem. I tried going back to my old MapServer without the FastCGI and I commented out my MapServer configuration lines in the mod_fcgid.conf file (and restarted the server). Unfortunately, this too now no longer works and gives the same error:
>
> The server encountered an internal error and was unable to complete your request
> Error message: Premature end of script headers: mapserv
>
> I really need to fix this! Aaaaaarghhhh!
>
> Thanks,
>
> John
>
>
>>>> "Paul Ramsey" <pramsey at cleverelephant.ca> 17/09/08 5:15 PM >>>
> John,
>
> The idea that CGI is naturally a much slower situation than a
> long-running process is a bit of a red herring in the case of
> Mapserver, and I say that as someone who is anal retentive about these
> things.  Unless your Mapserver installation has some naturally latent
> components (database connections, primarily) you'll find that moving
> from CGI to FastCGI is worth about 15ms per request.
>
> On Wed, Sep 17, 2008 at 8:40 AM, John Westwood <John.Westwood at port.ac.uk> wrote:
>
>> The reason I am trying to get MapServer to work with fast_cgi is because I am experiencing poor performance with OpenLayers. I believe that OpenLayers starts a new MapServer instance for each tile request, thus causing an unnecessary overhead. Am I correct?
>
> Yes and no. If you are experiencing noticeably poor performance (you
> can actually *see* it being slow) the only place that the CGI overhead
> could be the cause is if you're connecting to Oracle or SDE for some
> of your layers. If that's not the case, look elsewhere first, the very
> small gains you will receive from moving to FastCGI will not change
> your underlying problem.
>
> Paul
>
>



More information about the mapserver-users mailing list