[fpc-pascal] Powtils Apache and Windows Seven 64bits

Leonardo M. Ramé martinrame at yahoo.com
Mon May 24 20:45:34 CEST 2010


--- On Mon, 5/24/10, Marcos Douglas <md at delfire.net> wrote:

> From: Marcos Douglas <md at delfire.net>
> Subject: Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits
> To: "FPC-Pascal users discussions" <fpc-pascal at lists.freepascal.org>
> Date: Monday, May 24, 2010, 3:39 PM
> On Mon, May 24, 2010 at 2:33 PM, Bee
> Jay <bee.ography at gmail.com>
> wrote:
> >
> > Because FCGI app is the true worker app. CGI proxy is
> lightweight app. It does nothing but redirecting incoming
> request and outgoing response, aka proxy. Since it's
> lightweight, the CGI penalty can be ignored.
> >
> >> A FCGI lightweight app would be the proxy for some
> CGI apps. The FCGI
> >> stay in memory, so it is more fast for requests,
> while CGI app would
> >> be more specialized.
> >
> > Take a simple common case, an app that need to connect
> to a database, run an sql query, format the result, send it
> to client, and close the db connection. If it's a CGI app,
> the whole process is done on every single client request.
> 100 incoming request, then 100 times it's done over and
> over.
> >
> > If it's a FCGI app, you could make it connect to
> database once when it goes up, run the sql query once when
> the first request comes, format the result, send it to
> client, then cache the formatted result. If another similar
> request coming in, since the FCGI app stays in the memory,
> it could simply re-send the cached result without re-connect
> and re-query to the database. The cache can be refreshed
> (re-query the database) upon some conditional triggers, i.e.
> time interval, number of similar request, or some special
> kind of request (update query, etc). The db connection only
> need to be closed before the FCGI app is about to terminate
> itself at the end of its session. You can imagine how big
> performance boost you will get. ;)
> 
> I agree about the performance.
> But just one connection to database will be slow and you
> have to
> manager that... or create a thread for each request and
> each thread
> have a connection. Do you agree?
> 
> And about the cache... well, is possible use it even in CGI
> apps (but
> is slower, of course).
> 
> I did not understand why to use CGI and FCGI. Why the FCGI
> apps can
> not receive the requests? Would be faster, don't?
> 
> Marcos Douglas

Yes, but some times your FCGI app must run on one of those cheap shared hostings where you can't touch the Apache's httpd.conf file to configure the FCGI application. That's why the CGI proxy/gateway approach is used in some cases.

If you have full control of the server, the CGI proxy isn't required.

Leonardo M. Ramé
http://leonardorame.blogspot.com





      



More information about the fpc-pascal mailing list