Forum Moderators: phranque
Brief ISAPI overview:
In Windows IIS, you can build a web application as a dynamic link library (dll). This is much more efficient than building the web application as an executable (exe) because an IIS extension (dll) is loaded only ONE TIME by IIS. New processes are not created for each http request.
Brief CGI (under Windows) overview:
An exe is launched and terminated with each http request and this is very expensive in terms of CPU use.
Using the extension model, you can do things that you otherwise couldn't. One example would be to track your sessions in RAM as opposed to a database. But more importantly you could do things that you couldn't do under a CGI model. For example, at startup, an IIS extension can load a huge array (let's say 20 MB) of information into RAM only once; let's assume that this is an IP address database for countries and cities. The array of info could be very efficiently used by the web application for every single http request--no db overhead required.
If you were to do this using the cgi model, the exe would be reading the file from ram for each request which would simply be out of the question! The cgi solution for this would be to perform a database lookup.
I have briefly read about FastCGI yet I would really like to know if there are other options to look at before I begin working with Linux and Apache.
Does Apache allow you to load web applications as extension libraries like IIS does? If so, is this commonly done?
Best regards,
Jason
P.S. I don't want to be locked into Windows anymore.
I know that I'm going to have to download linux and apache at some point and start experimenting.
Let me just ask if I were to create an Apache module in C, could that module be written as a library or does Apache have to be completely rebuilt?
Let me just ask if I were to create an Apache module in C,
Well, a module loaded as a dynamic shared object (DSO) is nothing more than an extension library.
If so, is this commonly done?That depends. Writing a c module for a special project takes time, mostly a lot of time. Many people tend to use some 3rd party modules (if the requirements are met) then writing their own.
or does Apache have to be completely rebuilt?
Thanks for pointing me in the right direction, good to hear that modules can be dynamically linked.
I spent several hours researching all of this and began to see how this works.
It may be that I still need to do further research, load linux and actually get my hands wet but from what I see, developing a web application as an Apache module would be a frightening task without a framework to use, just like it is using IIS without a framework.
In IIS, fortunately, there is an IIS framework that I use called ATL Server, and you can build web applications using that framework that are extremely CPU efficient since apps are written in C or C++ and essentially become dynamically linked extension of the web server itself.
I'm still searching for a web application module framework for Apache. Without one, creating a web application without one would be way too much trouble. If I don't find one, I may take an existing cgi framework and write an Apache module interface for it when I have time available (if ever).
Thanks again,
Jason
Another approach would be writing modules with mod_perl.