Lesson 5 | The problems with CGI |
Objective | What are the problems with CGI? |
What are the Traditional Problems with CGI ?
A CGI program can be written in any language .
Prerequisites: Be able to produce a program that will execute on your server machine. In practice, most Web developers use a compiled language like C or a scripting language like Perl. Perl is the popular choice for CGI programming because it is powerful and widely available.
- Perl programs are challenging for humans.
- There is also a performance issue with CGI programming.
- If you have a popular site, different users could be using the same CGI program simultaneously.
- The Web server will start a new copy of the program for each of them.
And if the program is in Perl, it will start a whole new copy of the Perl interpreter for each of them.
This can waste a great deal of execution time and limit the number of users your server can handle.
Servlets are more efficient than this.
Servlets are Convenient
Servlets have an extensive infrastructure for automatically parsing and decoding HTML form data, reading and setting HTTP headers, handling cookies, tracking sessions, and many other such high-level utilities. In CGI, you have to do much of this yourself. Besides, if you already know the Java programming language, why learn Perl too?
You are already convinced that Java technology makes for more reliable and reusable code than does Visual Basic, VBScript, or C++.
Why go back to those primitive languages for server-side programming?
Server side includes (SSI) will be discussed in the next lesson.