CGI的缺点

如果请求数量增加会导致响应速度变慢,每个请求开一个进程,使用平台依赖性语言。

cgi.jpeg
https://www.javatpoint.com/servlet-tutorial

Servlet的优点

每个请求是个线程,The web container creates threads for handling the multiple requests to the Servlet. Threads have many benefits over the Processes such as they share a common memory area, lightweight, cost of communication between the threads are low. The advantages of Servlet are as follows:

Better performance: because it creates a thread for each request, not process.
Portability: because it uses Java language.
Robust: JVM manages Servlets, so we don’t need to worry about the memory leak, garbage collection, etc.
Secure: because it uses java language
servlet.jpeg