fastcgi, lacking performance over standard cgi
Frank Warmerdam
fwarmerdam at GMAIL.COM
Thu Apr 14 06:35:36 PDT 2005
On 4/13/05, Gregor Mosheh <stigmata_blackangel at yahoo.com> wrote:
> Nice. That did the trick. Thank you, Frank.
>
> For most of the map, the speedup is modest but
> measurable. For one particular view, though, it
> reduces the generation time from 15 seconds to <5
> seconds. Mileage varies.
Gregor,
Whew, that is surprising.
> What is the algorithm for keeping those DB connections
> persistent? Do they get closed automatically after a
> set period or number of connections? Do I need to
> worry about maxing out my DB's allowed connections?
The DB connections are never closed till fastcgi shutdown.
There are things you can configure in the apache .conf
file to control how many fastcgi processes may be started,
and how long they are kept alive. You may want to tune
these to try and cleanup fastcgi processes after a set
period of inactivity.
Generally speaking, yes, you do need to be wary about
database connection consumption in environments where
the number of connections is limited due to licensing or
resource restrictions.
> Say, the documentation on the PROCESSING keyword is
> rather sparse. What exactly does the
> CLOSE_CONNECTION=DEFER flag do in a non-fcgi
> environment? Does the data source stay open until the
> end of the mapserv.cgi execution, and save the
> overhead of opening/closing a data source that would
> be used in multiple layers?
In a non-FastCGI situation the closes are deferred till the
cgi process is ready to terminate. This effectly allows for
"connection sharing" between layers but does not help the
next cgi request that starts up. So for a map with multiple
layers drawing from a single database the deferred closing
can still provide a significant speedup over opening a
connection for each layer rendered.
The PROCESSING keyword is a bit of a hack to make it easy
to add new features. If we now consider the pooling mechanism
sufficiently mainline perhaps we should be making CLOSE_CONNECTION
a proper keyword in mapfiles, instead of going through the PROCESSING
directive.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the MapServer-users
mailing list