Check out the new USENIX Web site. next up previous
Next: Immunity against SYN-flooding Up: Performance Previous: Prioritized handling of clients

   
Controlling resource usage of CGI processing

Section 2 described how requests for dynamic resources are typically handled by processes other than the main Web server process. In a system that time-shares the CPU equally between processes, these back-end (CGI) processes may gain an excessive share of the CPU, which reduces the throughput for static documents. We constructed an experiment to show how a server can use resource containers to explicitly control the CPU costs of CGI processes.

We measured the throughput of our Web server (for cached, 1 KB static documents) while increasing the number of concurrent requests for a dynamic (CGI) resource. Each CGI request process consumed about 2 seconds of CPU time. These results are shown in the curve labeled ``Unmodified System'' in Figure 12.

As the number of concurrent CGI requests increases, the CPU is shared among a larger set of processes, and the main Web server's share decreases; this sharply reduces the throughput for static documents. For example, with only 4 concurrent CGI requests, the Web server itself gets only 40% of the CPU, and the static-request throughput drops to 44% of its maximum.

The main server process actually gets slightly more of the CPU than does each CGI process, because of misaccounting for network processing. This is shown in Figure 13, which plots the total CPU time used by all CGI processes.


  
Figure 12: Throughput with competing CGI requests.
\begin{figure}
\centerline{%
\input data/cgi-rate.tex}
\end{figure}


  
Figure 13: CPU share of CGI requests.
\begin{figure}
\centerline{%
\input data/cgi-share.tex}
\end{figure}

In Figures 12 and 13, the curves labeled ``LRP System'' show the performance of an LRP version of Digital UNIX. LRP fixes the misaccounting, so the main server process shares the CPU equally with other processes. This further reduces the throughput for static documents.

To measure how well resource containers allow fine-grained control over CGI processes, we modified our server so that each container created for a CGI request was the child of a specific ``CGI-parent'' container. This CGI-parent container was restricted to a maximum fraction of the CPU (recall that this restriction includes its children). In Figures 12 and 13, the curves labeled ``RC System 1'' show the performance when the CGI-parent container was limited to 30% of the CPU; the curves labeled ``RC System 2'' correspond to a limit of 10%.

Figure 13 shows that the CPU limits are enforced almost exactly. Figure 12 shows that this effectively forms a ``resource sand-box'' around the CGI processes, and so the throughput of static requests remains almost constant as the number of concurrent CGI requests increases from 1 to 5.

Note that the Web server could additionally impose relative priorities among the CGI requests, by adjusting the resource limits on each corresponding container.


next up previous
Next: Immunity against SYN-flooding Up: Performance Previous: Prioritized handling of clients
Gaurav Banga
1998-12-17