A second performance issue is minimizing the cost of event notification. We define event notification as the queuing of a client request by a server for response by a server task. In the case of a HTTP 1.0 request, the client request is formed by the arrival of a TCP SYN packet and subsequent data packets containing the request. The server must handle these two events with minimal overhead. First, it must complete the three-way TCP handshake started with the arrival of the first SYN packet. Second, it must receive the data forming the request, and read this data into a user-mode memory area. To handle multiple clients, the server supports concurrency either by assigning a single task from a pool of tasks to each client request or by using asynchronous system calls to manage many requests with a few tasks.
Achieving efficient event notification requires a thread model with minimal scheduling overhead. The mapping between threads and requests is taxonomized by [5] as multiple process/thread (MP) or single process event driven (SPED). In the MP model, a server creates a new task for each new request. Because creating a new task can be time consuming, most MP servers reduce the overhead by pre-allocating a pool of tasks. However, pre-allocating a pool of tasks to avoid task creation still incurs unwanted scheduling overhead. Every request requires a reschedule to the task for that request. Apache [6] is the canonical example of the MP architecture. Ideally, the unnecessary scheduling inherent to the MP model is avoided in a design where a single task services requests on behalf of multiple clients.
In the SPED model, a few processes handle requests from multiple clients concurrently. The SPED model relies on asynchronous notification mechanism for notifying a server task of incoming network requests. For example, select() is the event notification mechanism commonly used on user-mode UNIX Web servers and I/O completion ports are commonly used on Windows 2000. Web servers such as Zeus [7], IIS [8] use a SPED model. Flash [5] also uses a SPED model for cached content, using only one thread for serving cache hits. The Windows 2000 APIs implementing zero copy data transfer and efficient event notification are described in [9].