what is the advantage of using Servlets over CGI programming?

Answer Posted / sandeep m

CGI programs need separate process to process a request.
For which CGI object has to be created and destroyed for
each request or else pool of processes can be maintained by
server and for each request a process is assigned by server
which will be returned back to server after request
processing.
Servlets use Threads. Due to which single Servlet object is
created. Whenever a request is received by server a new
thread is created and the thread uses the existing Servlet
instance.
Advantage is process creation is heavy weight. Threads are
light weight. Burden of creating and destroying processes
is reduced or else maintaining process objects in pool is
reduced. Any number of requests can be served with not much
burden on server

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by filter in servlet?

771


What is Servlets and explain the advantages of Servlet life cycle?

842


Can we get PrintWriter and ServletOutputStream both in a servlet?

929


How can you run a servlet program?

824


Write a servlet to upload file on server.

845


When a servlet accepts a call from a client, it receives two objects. What are they?

1026


What do you mean by mime type?

797


How to make sure a servlet is loaded at the application startup?

796


Is dispatcher servlet a singleton?

770


How can we implement a jsp page?

881


How do you design microservices?

848


How to get the current httpsession object?

896


Explain the difference between generic servlet and http servlet?

761


Difference between GET and POST?

929


what is the different between a servlet and a cgi? Why do you go for servlet rather than cgi?

802