Web Technology Basics
With CGI, the web server starts the program as a new process every time it receives a request, and the process ends when processing is finished. Which of the following is the main reason that FastCGI and application-server approaches can handle many requests more efficiently than CGI?
- ABecause the program's processes stay resident and are reused, the work of starting a process and initializing for each request is saved
- BBecause they communicate with users over UDP instead of HTTP, the work of establishing a TCP connection for every request is eliminated
- CBecause they send the program to the browser and have it run inside the browser, the server does not need to process requests
Show answer and explanation
Answer: A. Because the program's processes stay resident and are reused, the work of starting a process and initializing for each request is saved
CGI is a simple mechanism in which the web server passes request information to the program through environment variables and standard input, and returns what the program writes to standard output as the response. However, it starts a process for every request and redoes loading of the language runtime and connecting to the database each time, so the load becomes heavy when there are many requests. FastCGI and application servers for each language keep the program resident, connect it to the web server through sockets or similar means, and process many requests repeatedly.
- A. Correct. Keeping processes resident avoids repeating startup and initialization for every request.
- B. FastCGI and application-server approaches also communicate with users over HTTP. The difference is how the program is run inside the server.
- C. The program runs on the server. What runs in the browser is the JavaScript included in the page.