Wednesday, September 28, 2005

What is the difference between a Servlet and a CGI?

When CGI ( Common Gateway Interface) script is invoked, the server creates a separate process for it. The server has a limitation on the number of process it can create. When the request is too high the server efficiency comes down.

The most popular platform for writing CGI script is perl. The server needs to load the CGI script and perl interpreter for every incoming request that it receives. This brings down the efficiency of the server.

Unlike CGI script the servlet initialization code is executed only once. In the case of servlets, each request is handled by a separate thread by container in the web browser. This helps web servers to be more efficient by preventing creation of unnecessary process.


Post a Comment

<< Home