write()excessively on all file descriptors to see if they are ready for read or write is inefficient. We must use system call like
poll()to inquire kernel which file descriptor is ready and only read or write on ready one. Although single process event driven (SPED) architecture is much more efficient than multiple process (MP) architecture, previous studies[1,3] have shown that
poll()is not scalable; more than 30%of CPU time is spent on such a system call on a normal squid proxy server.
poll()performs the amount of work in proportion to the number of file descriptors in event array rather than constant factor. The overhead of handling event detection for all connections severely limits scalability. Most solutions proposed for the scalability are based on efforts in the kernel mode or even a new operating system architecture (such as Novell's Internet Caching System-ICS). The event dispatching mechanisms in Linux can be summarized in Table 1. In this paper, we focus on improving the performance of web service applications in the user mode. We compare different event dispatching mechanisms in Linux, and give a summary of them. Based on the observation that most web connections are idle, we present a temporal-locality aware library for event dispatching in the user mode. A scalable event dispatching mechanism may improve the performance because of less context switching between user mode and kernel mode, but also encourage better code portability for various web applications. We conducted the performance evaluation of the proposed library on a memory-based event-threading server. Our studies show that performance of the server can be significantly improved by 30% or more. Programming interface and implementation details of web server and library are discussed. Performance analysis is given based on two metric: event dispatching overhead and dispatching throughput.