On 25 Mei 2010, at 24:10, Marcos Douglas wrote:

> "If it's already running, the CGI app acts as request proxy for the FCGI app"
> Would not the oposite?

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. ;)

-Bee-

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to