next up previous
Next: Temporal-locality-aware poll Up: A Scalable Locality-Aware Event Previous: A Scalable Locality-Aware Event


Scalability of network servers is important today. As the Internet continues to grow in popularity and size, network servers without good scalability will result in performance drop or live-lock[2]. One approach is to serve all connections in a single process, called single process event-driven (SPED). Server cannot block itself waiting for any read or write on a file descriptor. Nonblocking I/O is needed. However, calling read() or 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[4] 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.

Table 1: Comparison of various event dispatching mechanisms
features scalable event dequeue event when return multiple
to col- multiple queue queue initial interest
large lapsing event over- overflow, state sets
set of per flow kernel when in
file call fallback to declare kernel
desc. traditional interest per
methods poll() fd process
select() No NA Yes NA NA NA NA
poll() No NA Yes NA NA NA NA
/dev/poll Yes NA Yes NA NA NA Yes
RT signals Yes No No Yes No No Yes
RT sig-per-fd Yes Yes No No NA No Yes
declare_interest Yes Yes Yes Yes Yes Yes No

next up previous
Next: Temporal-locality-aware poll Up: A Scalable Locality-Aware Event Previous: A Scalable Locality-Aware Event