Cost of starting a process for every CGI request

A small server runs a C order-lookup program through CGI on a machine with 4 CPU cores. Profiling shows two costs for each request. Creating the process and starting the program takes 12 ms of CPU time; this covers fork, exec, dynamic linking and opening a database connection. Handling the request itself takes a further 3 ms of CPU time. Assume the work is CPU-bound, requests spread evenly over the cores, and nothing else runs on the machine.


Find:

  • the CPU time per request, in ms, as a whole number;
  • the maximum CGI throughput, in requests per second, to one decimal place;
  • the percentage of each request's CPU time spent on start-up, as a whole number;
  • the maximum throughput, in requests per second to one decimal place, if the program is rewritten as a pool of four persistent FastCGI processes, one per core, each started once and then paying only the 3 ms handling cost per request.
Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More CGI Programming Questions: