[Lazarus] fpWeb - Apache Modules

Lee Jenkins lee at datatrakpos.com
Fri Jan 23 16:37:51 CET 2009


Graeme Geldenhuys wrote:
> On Thu, Jan 22, 2009 at 4:51 PM, Lee Jenkins <lee at datatrakpos.com> wrote:
>> Powtils and other only cgi frameworks by their nature do not support object
>> pooling.  The only other option that I saw was apache dso's using the fpWeb
>> framework but that did not turn out too well and I spent quite a long time
>> trying to get apache to load the dso (which it would not) let alone actually
>> running it.
> 
> I have currently written a large chunk of our application using
> Powtils for standard CGI applications. I miss object pooling or DB
> connection pooling a lot. Setting up a connection is very slow
> compared to many other things, and having to do that on every mouse
> click is not ideas.

Right.  Since CGI is a one-off technology, you have to setup and tear down db 
connections, which (and I could be wrong here) tiOPF takes a bit longer to do 
than standard TConnect > TDataset model and since I use tiOPF as well, I'd 
prefer not to take a hit like that if I don't have to.

> I will be investigating alternative options. fpWeb and DSO etc.. I
> even thought of creating a Application Server application like in a
> 3-tier app. The CGI apps then communicate to the application server.
> The app server is the only one that has the actual DB connection. In
> theory this will work, but I haven't tried a prototype yet.

One idea that I had was to use a gateway application, much like they're doing 
over at ExtPascal.  ExtPascal uses FastCGI in one of 2 ways.

1. Gateway App => FastCGI Server.  This model is designed for webservers that 
don't have cgi support.  A standard gateway.cgi application takes the actual 
rqeuest and then communicates with a backend FastCGI (basically TCP/IP) server 
to fill the request.

2. Stand alone FastCGI server.  This is the FastCGI server used in the first 
model but is used for web servers that have native FastCGI support.  In this 
model the server (apache) just talks to the persistent running FastCGI server 
directly.

There server is pretty well abstracted out of the ExtJS stuff that the project 
is based on so I may just use their code for ideas.

Of course, FastCGI (like apache DSO's) have their drawbacks in terms of being 
able to actually use them on a shared hosting plan as most providers do not 
allow you to install DSO's or long running processes like TCP/FastCGI servers.

But a nice compromise would be to write a cgi gateway like in ExtPascal with a 
few minor changes so that my business logic can be the same regardless of 
whether its standard cgi running on a low traffic Plesk/CPanel account or a 
dedicated server.

> Also, Michael van Canneyt has written some articles on Free
> Pascal/Lazarus and web apps. Maybe if you ask nicely, he can send you
> those, which might give some hints on how to use fpWeb etc..  :-)

Michael?  Michael?  Where art thou and whilst thou share thine most valuable 
knowledge with me?  :)

--
Warm Regards,

Lee



More information about the Lazarus mailing list