Operating System Performance and Large Servers 1

Similar documents
Multiprocessor System. Multiprocessor Systems. Bus Based UMA. Types of Multiprocessors (MPs) Cache Consistency. Bus Based UMA. Chapter 8, 8.

Multiprocessor Systems. COMP s1

Multiprocessor Systems. Chapter 8, 8.1

Multiprocessor and Real- Time Scheduling. Chapter 10

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009

Chapter 13: I/O Systems

Multiprocessor and Real-Time Scheduling. Chapter 10

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections )

CS 153 Design of Operating Systems Winter 2016

I/O Systems. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

(b) External fragmentation can happen in a virtual memory paging system.

The control of I/O devices is a major concern for OS designers

Multimedia Systems 2011/2012

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

CMPS 111 Spring 2003 Midterm Exam May 8, Name: ID:

Operating System Review Part

Device-Functionality Progression

Chapter 12: I/O Systems. I/O Hardware

Unit 3 : Process Management

COMP SCI 3SH3: Operating System Concepts (Term 2 Winter 2006) Test 2 February 27, 2006; Time: 50 Minutes ;. Questions Instructor: Dr.

Sybase Adaptive Server Enterprise on Linux

Midterm Exam Amy Murphy 19 March 2003

Chapter 13: I/O Systems

Chapter 13: I/O Systems

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Scheduling

Real-Time Operating Systems Issues. Realtime Scheduling in SunOS 5.0

COMP 3361: Operating Systems 1 Final Exam Winter 2009

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Computer Systems Assignment 4: Scheduling and I/O

B.H.GARDI COLLEGE OF ENGINEERING & TECHNOLOGY (MCA Dept.) Parallel Database Database Management System - 2

Module 12: I/O Systems

PROCESSES AND THREADS THREADING MODELS. CS124 Operating Systems Winter , Lecture 8

Chapter 12: I/O Systems

Chapter 13: I/O Systems

Chapter 12: I/O Systems. Operating System Concepts Essentials 8 th Edition

CSE544 Database Architecture

SMD149 - Operating Systems

Today s class. Scheduling. Informationsteknologi. Tuesday, October 9, 2007 Computer Systems/Operating Systems - Class 14 1

First-In-First-Out (FIFO) Algorithm

CSCI-GA Operating Systems Lecture 3: Processes and Threads -Part 2 Scheduling Hubertus Franke

CSE 153 Design of Operating Systems

Distributed File Systems Issues. NFS (Network File System) AFS: Namespace. The Andrew File System (AFS) Operating Systems 11/19/2012 CSC 256/456 1

CSE 153 Design of Operating Systems

Suggested Solutions (Midterm Exam October 27, 2005)

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

!! What is virtual memory and when is it useful? !! What is demand paging? !! When should pages in memory be replaced?

Chapter 13: I/O Systems

Chapter 13: I/O Systems. Chapter 13: I/O Systems. Objectives. I/O Hardware. A Typical PC Bus Structure. Device I/O Port Locations on PCs (partial)

Operating Systems (1DT020 & 1TT802)

Preview. Process Scheduler. Process Scheduling Algorithms for Batch System. Process Scheduling Algorithms for Interactive System

Chapter 13: I/O Systems. Operating System Concepts 9 th Edition

Example: CPU-bound process that would run for 100 quanta continuously 1, 2, 4, 8, 16, 32, 64 (only 37 required for last run) Needs only 7 swaps

Virtual Memory. Chapter 8

The MOSIX Scalable Cluster Computing for Linux. mosix.org

Hierarchical PLABs, CLABs, TLABs in Hotspot

What s An OS? Cyclic Executive. Interrupts. Advantages Simple implementation Low overhead Very predictable

Utilizing the IOMMU scalably

4. Hardware Platform: Real-Time Requirements

Chapter 13: I/O Systems

File. File System Implementation. File Metadata. File System Implementation. Direct Memory Access Cont. Hardware background: Direct Memory Access

CS3733: Operating Systems

Chapter 10: Case Studies. So what happens in a real operating system?

CS330: Operating System and Lab. (Spring 2006) I/O Systems

CSE 120 PRACTICE FINAL EXAM, WINTER 2013

I/O Systems. Jo, Heeseung

Virtual Machines Disco and Xen (Lecture 10, cs262a) Ion Stoica & Ali Ghodsi UC Berkeley February 26, 2018

Performance and Optimization Issues in Multicore Computing

Operating Systems. Process scheduling. Thomas Ropars.

1995 Paper 10 Question 7

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

CSE 4/521 Introduction to Operating Systems. Lecture 24 I/O Systems (Overview, Application I/O Interface, Kernel I/O Subsystem) Summer 2018

Chapter 13: I/O Systems

Chapter 5: CPU Scheduling

Department of Computer applications. [Part I: Medium Answer Type Questions]

Chapter 9 Memory Management

CMPS 111 Spring 2013 Prof. Scott A. Brandt Midterm Examination May 6, Name: ID:

Ultra-Low Latency Down to Microseconds SSDs Make It. Possible

AC59/AT59/AC110/AT110 OPERATING SYSTEMS & SYSTEMS SOFTWARE DEC 2015

Design Patterns for Real-Time Computer Music Systems

CSL373: Lecture 5 Deadlocks (no process runnable) + Scheduling (> 1 process runnable)

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Introduction. CS3026 Operating Systems Lecture 01

GLocks: Efficient Support for Highly- Contended Locks in Many-Core CMPs

Computer Architecture. Lecture 8: Virtual Memory

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

But this will not be complete (no book covers 100%) So consider it a rough approximation Last lecture OSPP Sections 3.1 and 4.1

ECE519 Advanced Operating Systems

238P: Operating Systems. Lecture 14: Process scheduling

Notes based on prof. Morris's lecture on scheduling (6.824, fall'02).

File System Implementations

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)

Motivation. Threads. Multithreaded Server Architecture. Thread of execution. Chapter 4

1 Multiprocessors. 1.1 Kinds of Processes. COMP 242 Class Notes Section 9: Multiprocessor Operating Systems

Main Points of the Computer Organization and System Software Module

Unix SVR4 (Open Solaris and illumos distributions) CPU Scheduling

CPU Scheduling (1) CPU Scheduling (Topic 3) CPU Scheduling (2) CPU Scheduling (3) Resources fall into two classes:

Operating Systems Overview

Module 12: I/O Systems

OPERATING SYSTEM. Chapter 12: File System Implementation

Transcription:

Operating System Performance and Large Servers 1 Hyuck Yoo and Keng-Tai Ko Sun Microsystems, Inc. Mountain View, CA 94043 Abstract Servers are an essential part of today's computing environments. High performance is one of the critical requirements that the applications demand from servers. It is often found that the key performance bottleneck on servers is the operating systems. We have investigated the commonly encountered performance anomalies and found that they are due to the mismatches between operating systems and the distinct characteristics of server applications. The characteristics pose several scalability issues in operating systems. We discuss possible scalable solutions and their trade-offs to support applications on servers efficiently. 1 Introduction Mission-critical applications such as online transaction processing, financial packages, and manufacturing applications, that only run on mainframes before, run on servers today. High performance is one of the critical requirements that the applications demand from servers as more and more organizations depend on servers for their day-to-day operations. Furthermore, server performance will be even more important because the current trends show that servers will become more ubiquitous and diversified in the future due to various driving forces, e.g. economic benefit to move away from mainframes, demands from emerging areas such as multimedia, video-on-demand, etc. However, in many cases the applications perform poorly on servers. There are many potential performance bottlenecks. Sometimes, hardware deficiency such as system bus or cache mechanisms is the bottleneck [6]. Nevertheless, it is often found that the key performance bottleneck is the operating systems running on servers. A simple example is desktop operating systems that are ported to run on servers. Although servers may be viewed as powerful desktops with plenty of memory and disks, applications running on servers are quite different from the ones on the desktops so that the ported operating systems behave very poorly. Even with extensive tuning efforts, it is quite difficult to achieve satisfactory performance. Careful investigation on applications and operating system performance is necessary. The goal of this paper is to address what operating systems need to do in order to efficiently support server applications. Obviously, there are many issues related to this subject, we would not attempt to discuss them all in this paper. Rather, we investigated some of the commonly encountered operating system performance anomalies for server applications and present our findings here. First, our experience shows that server applications have distinct characteristics. They can be summarized with the following two observations. 1Admittedly, server is not a well-defined term. We use it as a generally-accepted term which usually means a system running a single operating system, 166

Observation 1 On a typical server, it only runs a few related applications. In other words, each server is usually dedicated to certain functions within an organization. Generally speaking, favorite applications for servers today are file repository services through the Network File System (NFS), remote login, and databases. Observation 2 Despite only a few applications, there are a large number of instances of each application running simultaneously on a server. The number could vary anywhere from several hundreds to several thousands. Each instance of an application is normally implemented as a heavy-weight process (in UNIX terms). An example is the university environment where servers are used for rlogin and NFS. Another example is the commercial environment where database servers often connect to thousands of front-end workstations/terminals for online transaction processing. The above characteristics pose several scalability 2 issues in various parts of operating systems, among which we will cover process management, virtual memory management, and high performance I/O in this paper. In the following sections, we will discuss what the issues are, the possible solutions, and their trade-offs. 2 Process management A key issue in process management for large servers is how to schedule thousands of processes effectively. A typical operating system scheduler is based on fixed time quantums and priorities. It blindly preempts processes when their time quantums expire. This type of preemptive scheduling hurts performance of server applications by adding unnecessary context switches. For example, server applications like databases use latches 3 to coordinate simultaneous accesses to shared data. When a scheduler preempts a process holding a latch, the preempted process will be placed in the end of the queue (by a round robin scheduling policy). When the next process in the run queue is scheduled to run, it may also need to acquire the same latch to do useful work. In that case, the process has to wait for the latch to become available and thus will waste its scheduling turns, which introduces extra context switches. A desirable scheduling in this scenario would be not to preempt the process holding a latch. However, schedulers have no information to make such an intelligent decision. Preemptive scheduling may also be unnecessary for server applications because they generally involve frequent I/O operations. It is better to hold the preemption until the application voluntarily gives up the CPU. Preemptive scheduler would just introduce additional context switches. However, the dilemma is that operating systems still need preemptive scheduling to enforce fairness in a general purpose server, i.e. to prevent compute-intensive programs from hogging CPU(s). To avoid unnecessary context switches, scheduler needs the semantic information about applications and 2By scalability, we mean not only to scale up to multiple processors, but more importantly, to efficiently support a large number of processes. 3Latch is an efficient mutual exclusion mechanism. 167

their execution states. The question is how a scheduler gets such application-dependent information. A few solutions have been proposed. One is to use separate scheduling classes for applications. In [3], a scheduling problem was found in multimedia applications and a new scheduling class was proposed to solve the problem. We also used a scheduling class for a server application and observed that the performance improved quite a bit. However, we also noticed a disadvantage of this solution as well. It degraded the performance of similar applications. It would be desirable that a scheduling class can support a set of applications, not just a single application. Another solution is to let scheduler and applications communicate about the scheduling decisions. Potential mechanisms are signals in UNIX or upcalls in [1]. The success of this solution would depend on the overhead of such mechanisms since scheduling decisions have to be made very frequently. As a different approach, user level thread can be used to reduce significant number of context switchings inside the kernel. This solution allows application developers to implement their own thread scheduler that can utilize application specific information to make more intelligent scheduling decisions. However, without a major redesign of the applications this benefit can not be easily realized. In addition, thread scheduler adds a layer on top of the process scheduler, which may introduce extra overheads. Therefore, risk exists for a multi-threaded application to perform much worse than its multi-process counterpart. Another issue in process management is how to maximize parallelism inside the kernel. When processes access kernel resources in parallel, the resources need to be protected by locks. The more locks are used, the higher parallelism can be achieved. However, it adds more overhead too. Because lock contention also varies with applications, each lock needs to be carefully examined. Locking granularity is not technically interesting but practically very important for server performance. 3 Virtual Memory management A key issue in virtual memory (VM) management is how to map a huge amount of VM for a large number of processes. VM mapping requires mapping resources such as page tables. A common design in VM systems is to a~ocate mapping resources per process because process is the unit of protection domain. This design causes problems for server applications. Suppose that the size of VM required for an application is 128M. Also assume that a mapping resource like page table entry (PTE) maps 4K page and takes 4 bytes. Then for each instance of this application, the size of required PTEs will be 128K. If a server needs to support 1000 instances of such an application, the operating system will need at least 128M of memory for VM mapping. Note that this is not just a hypothetical situation, Imagine video applications which mmap video files and serve many clients. In fact, 128M VM requirement is relatively modest in commercial database servers, which normally share much larger VM segments among processes. In traditional operating systems like UNIX, page tables are statically allocated at boot time. This means that at some point adding new processes overflows the pre-allocated page tables so that processes have to steal page tables from other processes. We observed that this "page table stealing" phenomenon significantly degrades performance on servers and that it happens even when there 168

is enough physical memory available [7]. Note that this phenomenon may take place in window systems where there are also many processes. Because only a few of them are active at a time, the performance impact is much less significant. If mapping resources are allocated dynamically, this phenomenon can be avoided, but per process allocation will still consume way too much physical memory. As a solution, we designed and implemented shared page tables. The idea is to share page tables among processes for shared memory. It reduced page table requirements dramatically and were able to avoid page table stealing. As a result, the servers were capable of supporting more processes running at the same time with increased performance. Sharing page tables has other advantages in addition to saving memory. When a page is freed, the VM system needs to check all the PTEs that map,the page in order to maintain page table consistency. The more PTEs point to the same page, the more time the VM system need to spend to maintain the consistency. Sharing mapping resources simplifies this consistency checking. The implementation was done for Sun SPARC Reference MMU [2], but we believe that the idea can be applied to other MMUs. As a next step, we feel that we need a general mechanism to share mapping resources for servers. The motivation is to benefit dyna.micaily-linked libraries and process texts. A potential mechanism is copy-on-write. It is a very useful technique that is already used to share the pages for text and data among processes. It would be interesting to apply copy-on-write to the address translation layer. The granularity of sharing is expected to be smaller since a page is too big to share for page tables. Again, as discussed in process management, user level thread can be a sohltion. Since most of these thousands of processes are instances of only a few applications, it appears that the demand on the VM resource can be significantly reduced if those related processes are converted into multiple threads that share a common address space. This is certainly true for applications like database that share large virtual memory segments. However, it may not help applications like rlogin that have very little VM sharing among different execution threads. Another issue in VM management is whether a VM system needs to support multiple page sizes [5]. Obviously using large pages like 64K will cut down the mapping resource requirements. Furthermore, it will reduce the translation lookaside buffer misses because one mapping resource (e.g., a PTE) covers more address references. However, this will involve a major overhaul in the VM system. Also there are still open issues like how to switch between large pages and regular pages for different applications that need to be addressed. 4 High Performance I/O A key issue in high performance I/O for servers is how to manage a large number of concurrent I/O requests. Many I/O performance issues are related to hardware (e.g., memory system, bus architectures, etc.) and firmware, which we will not cover in this paper. Instead, we will discuss issues more related to operating systems, namely, file system performance and asynchronous I/O. An issue in file systems is how to reduce the overhead of maintaining kernel buffers, including overhead of extra copy from/to the buffers. Because server applications generate a large number 169

of I/O requests, the file system overhead adds up and becomes a major impediment to high performance. This is why server applications prefer raw devices. A solution may require new I/O interfaces because existing interfaces such as read() and write() would be difficult to avoid the overhead due to their" semantics. Bypassing kernel buffers for file system operations would reduce the performance gap with raw devices. Another issue is how to speed up synchronous write in file systems. Synchronous write is known to be slow since it has to update several data structures in the kernel as well as on the disks. But, synchronous write is frequently used in server applications. For example, database transactions need to flush their log into stable storage before they commit. Flushing the log requires synchronous writes to disks, not to file system buffers. NFS write is another example. A potential solution is to use logging as in databases to reduce disk latency. A log-structured file system (LFS) [4] uses a log inside the file system to speed up random and sequential writes. However, server applications transfer a small amount of data during synchronous writes and an LFS is not efficient for small synchronous writes. Most database log writes are 2KB and typical NFS writes are 8KB. More studies need to be done to support efficient small synchronous writes. An important technique to achieve high performance I/O is asynchronous I/O. Asynchronous I/O means that a process can issue I/O requests without blocking and gets notifications when they complete. Asynchronous I/O is especially useful in server applications because it avoids context switching and increases parallelism by allowing the process to proceed while I/O is being done. It is also essential for multithreaded applications which do not use kernel threads. An issue in asynchronous I/O is how to maximize the throughput of a large number of concurrent I/O requests. Asynchronous I/O can be designed in a few different ways. A comparative study needs to be done to find an optimal way to achieve maximal throughput. 5 Summary The distinct characteristics of server applications pose various performance issues in operating systems. In this paper we discussed the commonly encountered issues and possible solutions in process management, virtual memory management, and high performance I/O. Although those issues appear mostly on servers, they are generic problems caused by the non-scalable design of operating systems. Solutions discussed in this paper attempt to improve scalability of operating systems for servers. References [1] T. E. Anderson and et al. Scheduler Activations: Effective Kernel Support for the User-Level Management of Parallelism. A CM Transactions on Computer Systems, 1992. [2] SPARC Internal, editor. SPARC Architecture Manual Version 8. 1991. [3] J. Nieh and et al. SVR4 UNIX Scheduler Unacceptable for Multimedia Applications. In Proc. 4th Internaltional Workshop on Network and Operating System Support for Digital Audio and Video, pages 35-47, 1993. 170

[4] M. Rosenblum and J. Ousterhout. The Design and Implementation of a Log-Structured File System. A CM Transactions on Computer Systems, 1992. [5] M. Talluri and et. al. Tradeoffs in Supporting Two Page Sizes. In Proc. International Symposium on Computer Architecture, pages 415-424, 1992. [6] S. Thakkar and M. Swseiger. Performance of an OLTP Application on Symmetry Multiprocessor System. In Proceedings of International Symposium on Computer Architecture, 1990. [7] H. Yoo and T. Rogers. UNIX Kernel Support for OLTP Performance. In Proc. 1993 Winter USENIX Conference, pages 241-247, 1993. 17I