Comparing the Performance of Web Server Architectures

Comparing the Performance of Web Server Architectures

Comparing the Performance of Web Server Architectures David Pariag, Tim Brecht, Ashif Harji, Peter Buhr, and Amol Shukla David R. Cheriton School of Computer Science University of Waterloo, Waterloo, Ontario, Canada db2pariag,brecht,asharji,pabuhr,ashukla @cs.uwaterloo.ca ABSTRACT 1. INTRODUCTION In this paper, we extensively tune and then compare the perfor- Several different server architectures have been proposed for mance of web servers based on three different server architectures. managing high levels of server concurrency. These can be broadly The µserver utilizes an event-driven architecture, Knot uses the categorized as event-driven, thread-per-connection (sometimes re- highly-efficient Capriccio thread library to implement a thread-per- ferred to as thread-based) or a hybrid utilizing a combination of connection model, and WatPipe uses a hybrid of events and threads events and threads. to implement a pipeline-based server that is similar in spirit to a Previous research [18] has analyzed the strengths and weak- staged event-driven architecture (SEDA) server like Haboob. nesses of many of these architectures. However, more recent work We describe modifications made to the Capriccio thread library [24, 8, 22, 23] has re-ignited the debate regarding which archi- to use Linux’s zero-copy sendfile interface. We then introduce the tecture provides the best performance. The most recent results SYmmetric Multi-Processor Event Driven (SYMPED) architecture conclude that the thread-per-connection Knot server [22], which is in which relatively minor modifications are made to a single pro- based on the scalable user-level threading-package Capriccio [23], cess event-driven (SPED) server (the µserver) to allow it to con- matches or exceeds the performance of the hybrid, pipeline-based tinue processing requests in the presence of blocking due to disk Haboob server. In this paper, we conduct benchmark experiments accesses. Finally, we describe our C++ implementation of WatPipe, to compare the performance of well tuned, state-of-the-art event- which although utilizing a pipeline-based architecture, excludes based and thread-per-connection servers (the µserver and Knot), the dynamic controls over event queues and thread pools used in along with a hybrid, pipeline-based server (called WatPipe). Wat- SEDA. When comparing the performance of these three server ar- Pipe’s architecture is designed to be similar to the staged event- chitectures on the workload used in our study, we arrive at different driven architecture (SEDA) used to implement Haboob [24]. While conclusions than previous studies. In spite of recent improvements SEDA and Haboob are written in Java and use dynamic controllers to threading libraries and our further improvements to Capriccio to adjust the number of threads and load shedding within each and Knot, both the event-based µserver and pipeline-based Wat- stage, WatPipe is written in C++ and does not implement any con- Pipe server provide better throughput (by about 18%). We also ob- trollers. serve that when using blocking sockets to send data to clients, the The contributions of this paper are: performance obtained with some architectures is quite good and in • We present two new approaches for supporting the zero-copy one case is noticeably better than when using non-blocking sockets. sendfile system call within the Capriccio threading library, and evaluate their performance using the Knot web server. Categories and Subject Descriptors • The SYmmetric Multi-Process Event Driven (SYMPED) and D.1.3 [Programming Techniques]: Concurrent Programming— shared-SYMPED server architectures are introduced. Parallel programming; D.4.1 [Process Management]: Concur- • A hybrid pipeline server-architecture, based on a simplified rency, Threads; D.4.8 [Performance]: Measurements staged event-driven (SEDA) architecture, is introduced. • The importance of properly tuning each of the server architec- General Terms tures is demonstrated. We find that with the workload used in Design, Experimentation, Measurement, Performance this paper, performance can vary significantly with the number of simultaneous connections and kernel threads. Keywords • The event-based µserver and the pipeline-based WatPipe servers are found to perform as well as or better than the thread-per- web servers, threads, events, scalability, performance connection Knot server on the workload used in this paper. • Contrary to prior work, the results obtained using our workload show that the overheads incurred by the thread-per-connection architecture make it difficult for this architecture to match the Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are performance of well implemented servers requiring substantially not made or distributed for profit or commercial advantage and that copies fewer threads to simultaneously service a large number of con- bear this notice and the full citation on the first page. To copy otherwise, to nections. republish, to post on servers or to redistribute to lists, requires prior specific • In some of the architectures examined, the use of blocking sock- permission and/or a fee. ets for writing replies is found to perform quite well. EuroSys’07, March 21–23, 2007, Lisboa, Portugal. Copyright 2007 ACM 978-1-59593-636-3/07/0003 ...$5.00. 231 The remainder of this paper is organized as follows. Section 2 tems found it necessary to restrict the number of concurrently run- describes background and related work. Section 3 describes our ning threads [3, 12]. Restricting the number of threads means either experimental environment and workload. Sections 4, 5, and 6 restricting the number of simultaneous connections (in a thread- describe the implementation and performance tuning experiments per-connection server) or multiplexing multiple connections within conducted for the Knot, the µserver and WatPipe servers, respec- each thread. tively. In Section 7, several server configurations are compared and The Single Process Event-Driven (SPED) [18] architecture mul- analyzed using the best performance of each tuned server. Section 9 tiplexes all connections within a single process by putting all sock- explains why our findings differ substantially from previous work, ets into non-blocking mode, and only issuing system calls on those and Section 10 presents our conclusions. sockets that are ready for processing. An event notification mecha- nism such as select, poll, epoll,orkqueue is used to iden- 2. BACKGROUND AND RELATED WORK tify those sockets that are currently readable or writable. For each such socket, the server invokes an appropriate event-handler to pro- Modern Internet servers must efficiently operate on thousands of cess the request without causing the server to block. The SPED files and connections [3]. However, operations on files and sockets architecture leverages operating system support for non-blocking may cause a server to block unless special action is taken. There- socket I/O. However, the SPED architecture makes no provisions fore, strategies for dealing with blocking I/O are a key requirement for dealing with blocking file I/O operations. Therefore, alternative in most server architectures. The main strategies are: do noth- server architectures are required for workloads that induce blocking ing, use non-blocking or asynchronous I/O, or delegate potentially due to disk activity. blocking I/O operations to threads, either among separate server In this paper, we introduce the SYmmetric Multi-Process Event- processes or within a single server process using multiple kernel Driven (SYMPED) architecture (see Section 5.1), which extends threads. the SPED model by employing multiple processes each of which While most Unix-like systems support non-blocking socket I/O, acts as a SPED server to mitigate blocking file I/O operations and support for non-blocking file I/O is poor or non-existent. Asyn- to utilize multiple processors. The SYMPED model relies on the chronous I/O (AIO) mechanisms exist for some file operations, but operating system to context switch from a process that blocks to a performance critical system calls like sendfile have no AIO process that is ready to run. equivalents [14]. In light of these limitations, many server archi- The Flash server implements the Asymmetric Multi-Process tectures have adopted threading to mitigate the effects of blocking Event-Driven (AMPED) [18] architecture, combining the event- I/O. Threading is introduced via kernel processes and/or user-level driven approach of SPED with helper processes dedicated to per- thread libraries. forming potentially blocking file system operations. In this archi- Threads do not prevent blocking due to I/O; they only provide tecture, a single event-driven process delegates all file system I/O possible alternative executions. For example, when one thread to helper processes, which invoke the potentially blocking opera- blocks due to I/O, other non-blocked threads may still be able to ex- tion. Processes may or may not share address spaces. Like the ecute. This approach relies on transparent context switching of ker- SYMPED architecture, the AMPED model relies on the operating nel threads by the operating system or user-level threads by a thread system for all process scheduling. One potential drawback of the library to continue execution. Typically, a user-level thread-library AMPED approach is the coordination and communication required attempts to avoid blocking due to I/O by

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    13 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us