[fpc-pascal] Powtils Apache and Windows Seven 64bits
md at delfire.net
Mon May 24 20:39:46 CEST 2010
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?
More information about the fpc-pascal