views:

671

answers:

4

I was fortunate enough to not do any cgi-bin .cgi based web development. But generally those who have do not seem to 'miss' those days.

A project I recently joined has a performance issue when dealing with the pages that need to communicate to a legacy system that has a CGI-BIN based API. That system is COGNOS 7.

The feedback I received to date is that 'COGNOS is slow' but others have reported great success with COGNOS, I am thinking it has more to do with the access via CGI-BIN and not the performance of COGNOS in and of itself.

All that said what are the main issues that made CGI-BIN based web development non-performant, difficult, etc...

A: 

The main disadvantage, IMHO, was the same disadvantage that all lower-level coding has - instead of programming in the problem domain, you had to program in the implementation domain. The end result was, at its core, identical - an HTTP response was sent to a client based on an HTTP request. However, getting to that point was a lot trickier from a programming perspective.

Harper Shelby
Nothing about how the web server communicates with the application has any connection to how hard it is to 'get to the point'
David Dorward
@David Dorward: You're absolutely right. However, in developing to the CGI interface, you're dealing with all the lower level details in every application. Frameworks, whether ASP.NET, Rails, Django, or anything else, allow the programmer to focus on the problem domain, and not worry about the details of the communication protocol, allowing the programmer to 'get to the point' of his or her application, instead of the CGI specification.
Harper Shelby
+4  A: 

The fundamental architectural issue with CGI-BIN based systems is that each HTTP request requires the server to start a new process. This affects performance in a number of ways:

  • It's expensive to start the process, as the OS pages in the program, sets up the process, etc.
  • Resources can not be shared across requests, so that any DB connections, etc. have to be set up with each request
  • User session state can not be preserved in memory, so it has to be persisted with each request
John Stauffer
Those restrictions all apply to CGI in general, they aren't particular to CGI-BIN. You're still right of course, just thought I'd make that comment.
Adam Bellaire
It *can* be expensive to start a process. In general, Unix-like operating systems make processes cheap and encourage forking processes whenever needed; Windows operating systems make processes expensive and encourage creating threads instead. Each approach has its merits; the CGI model was initially developed in Unix environments, so the overhead of creating processes wasn't considered problematic. (On the other hand, if when you create your process, you have to bootstrap something like a Perl/Python/etc. language interpreter, then the overhead goes up by an order of magnitude at least...)
Daniel Pryden
+1  A: 

For me the biggest pain with CGI is that my CGI programs have to "learn" everything each time they start up. If they were running constantly that wouldn't be the case, of course...

A: 

Apache has several solutions to this for various languages (e.g. mod_perl) so that a script is only invoked once, then held in memory for fast retrieval. There are still plenty of GCI-protocol driven sites out there, many of which run with reasonably low latency, if well-coded and set up.

Dave Everitt