What are the main differences between CGI and Java servlets?
Servlets are run in one process (HTTP server with additional features, which called Servlet Container) and they exist as long as that process exists.
CGI means every time there's client request, HTTP server creates new instance of process to serve this request. This is performance killer. Additionally, since there's new process per each request, it means CGI can't aggregate data from several requests in memory, as Servlets can, and must resort to external persistent storage (file or DB). This is performance killer as well.