Make Dynamic web site With PERL/CGI platform

By Admin - Webhosting Directory and Details  - January, 06, 2008

One of first created gateway protocol, and most success, to connecting web server and application is Common Gateway Interface (CGI).

How CGI works?

  • CGI application is script file that put in web directory and can be accessed by web server.
  • If there are application request from client, web server will read the script and run the program.
  • Web server give input to the program (include client input) from standard input (stdin) and some environment variable.
  • Web server wait the program run until it finish then catch program standard output (stdout).
  • This out put that given to client.

What CGI eminence is?

  • Cgi script can write in every language, however around 90% CGI program write in perl,
  • A simple CGI protocol,
  • Perl fluency in text management, make writing a cgi program easy and quick,
  • Even it old, to this day according to netcraff survei around 70 % web applications still using CGI. It means more than a half dynamic web site is CGI build.

What CGI lack is?

Speed (it term is skalabilitas).

To produce CGI program output, a big overhead have to get thought. In CGI Perl case, it process is:

  • Web server will create a new process first and run interpreter perl.
  • Later perl will compile that CGI script, and then run the script.

These cycles all happen in every request. In other word, waste too much time to create a process and no compile script cache.

If your website receive less than ten to twenty thousand hits CGI per day, average UNIX web server machine that present now can manage fine .

This number is relative, depend on:

  • Web server machine loaded level to run other duty (like sent email and run data base server) also
  • CGI application it self (because several CGI application is large size single script until it loading time is long enough, generally a complex CGI application breaking apart be separate script to less loading time).
  • Fast or slow web page appearance which receive by client depend on network connection