Win2k Performance Guide.pdf - Windows 2000 Performance...

This preview shows page 1 out of 535 pages.

Unformatted text preview: Windows 2000 Performance Guide Odysseas Pentakalos Mark Friedman Publisher: O'Reilly First Edition January 2002 ISBN: 1-56592-466-5, 718 pages By Giantdino Copyright Table of Contents Index Full Description About the Author Reviews Reader reviews Errata Most computer systems do not degrade gradually. The painful reality is that performance is acceptable day after day, until quite suddenly it all falls apart. If this happnes on a system you're responsible for, you'll need to be prepared to get your organization through the crisis. Windows 2000 Performance Guide will give you the information and the conceptual framework to become your own Windows 2000 performance expert. Windows 2000 Performance Guide Preface Intended Audience Organization of This Book Conventions Used in This Book How to Contact Us Acknowledgments 1. Perspectives on Performance Management 1.1 Windows 2000 Evolution 1.2 Tools of the Trade 1.3 Performance and Productivity 1.4 Performance Management 1.5 Problems of Scale 1.6 Performance Tools 2. Measurement Methodology 2.1 Performance Monitoring on Windows 2.2 Performance Monitoring API 2.3 Performance Data Logging 2.4 Performance Monitoring Overhead 2.5 A Performance Monitoring Starter Set 3. Processor Performance 3.1 Windows 2000 Design Goals 3.2 The Thread Execution Scheduler 3.3 Thread Scheduling Tuning 4. Optimizing Application Performance 4.1 Background 4.2 The Application Tuning Case Study 4.3 Intel Processor Hardware Performance 5. Multiprocessing 5.1 Multiprocessing Basics 5.2 Cache Coherence 5.3 Pentium Pro Hardware Counters 5.4 Optimization and SMP Configuration Tuning 5.5 Configuring Server Applications for Multiprocessing 5.6 Partitioning Multiprocessors 6. Memory Management and Paging 6.1 Virtual Memory 6.2 Page Replacement 6.3 Memory Capacity Planning 7. File Cache Performance and Tuning 7.1 File Cache Sizing 7.2 Cache Performance Counters 7.3 Universal Caching 7.4 How the Windows 2000 File Cache Works 7.5 Cache Tuning 8. Disk Subsystem Performance 8.1 The I/O Subsystem 8.2 Disk Architecture 8.3 I/O Buses 8.4 Disk Interfaces 8.5 System Monitor Counters 8.6 Workload Studies 9. Filesystem Performance 9.1 Storage Management 9.2 Filesystems 9.3 Defragmentation 9.4 System Monitor Counters 9.5 Comparing Filesystem Performance 9.6 Selecting a Filesystem 10. Disk Array Performance 10.1 Disk Striping 10.2 Enter RAID 10.3 RAID Disk Organizations 10.4 RAID and Windows 2000 10.5 Benchmark Testing 10.6 Selecting a RAID Configuration 11. Introduction to Networking Technology 11.1 Networking Basics 11.2 Bandwidth and Latency 11.3 Media Access Layer 11.4 Internet Protocol Layer 11.5 Host-to-Host Connections 12. Internet Information Server Performance 12.1 Web Server Architecture 12.2 Sources of Information 12.3 Web Server Benchmarks 12.4 Performance Management 12.5 Load Balancing and Server Clustering 13. Bibliography 13.1 Performance Management 13.2 Measurement Methodology 13.3 Processor Performance 13.4 Optimizing Application Performance 13.5 Multiprocessing 13.6 Memory Management and Paging 13.7 File Cache Performance and Tuning 13.8 Disk Subsystem Performance 13.9 Filesystem Performance 13.10 Disk Array Performance 13.11 Networking Technology 13.12 Internet Information Server Performance Colophon Preface The book you hold in your hands originally arose from need. Professionally, we felt the need to answer both basic and not-so-basic questions about the performance of Intel-based computer systems running various versions of the Microsoft Windows 2000 operating system, including both Windows NT and Windows XP. We expect that most readers of this book are seeking answers to common questions about computer and operating system performance out of similar personal or professional curiosity. This book, in fact, evolved from a seminar intended to address such questions that one of the authors developed and taught over a number of years. The material in the book is the result of research performed over the last five years on successive versions of the Windows NT operating system, beginning with Version 3.5 and continuing to the present day. (As this book was going to press, we were experimenting with early versions of Windows XP. As best we can currently determine, almost all of the information provided here regarding Windows 2000 performance can also be applied to the 32-bit version of Windows XP.) Much of the material here is original, derived from our observations and analysis of running systems, some of which may contradict official documentation and the writings and recommendations of other authorities. Rest assured that we carefully reviewed any findings reported here that run counter to the received wisdom. While we strive to make the discussion here definitive, there are necessarily many places where our conclusions are tentative and subject to modification should new information arise. We expect readers to be willing to challenge our conclusions in the face of strong empirical evidence to the contrary, and urge you to communicate to us (via the publisher) when you discover errors of commission or omission, for which we assume full responsibility. If you observe behavior on one of your Windows 2000 machines that seems to contradict what we say in the book, please share those observations with us. With your help, we should be able to produce a subsequent version of this book that is even more authoritative. Our research for the book began with all the standard sources of information about the Windows 2000 operating system. We frequently cite official documentation included in the operating system help files. We also refer to the extensive reference material provided in the Windows 2000 Resource Kit. David Solomon and Mark Russinovich's Inside Windows 2000, published by Microsoft Press, was another valuable source of inside information. The Windows 2000 platform System Development Kit (SDK) and Device Driver Development Kit (DDK) documentation, along with Microsoft Developer Network (MSDN) KnowledgeBase entries and other technical articles, also proved useful from time to time. Intel processor hardware documentation (available at ) was helpful as well, particularly in writing Chapter 4 and Chapter 5. At many points in the text, we cite other reference material, including various academic journals and several excellent books. From time to time, we also mention worthy magazine articles and informative white papers published by various vendors. This book contains a complete bibliography. Originally, we intended this book to serve as an advanced text, picking up where Russ Blake's outstanding Optimizing Windows NT left off. Unfortunately, Blake's book is currently out of print and woefully obsolete. Blake led a team of developers who implemented a performance monitoring API for the initial version of Windows NT 3.1, when the OS first became available in 1992. Russ's book also documented using Performance Monitor, the all-purpose performance monitoring application the team developed. We acknowledge a tremendous debt to Russ, Bob Watson, and other members of that team. Writing when he did, Blake had little opportunity to observe real-world Windows NT environments. Consequently, almost all the examples he analyzes are based on artificial workloads generated by an application called Performance Probe, which he also developed. (The Performance Probe program is no longer available in the Windows 2000 Resource Kit; it is available in earlier versions of the NT 3.5 and 4.0 Resource Kits.) While we also experiment in places with artificial workloads running under controlled conditions, we were fortunate to dive into Windows NT some years after it first became available. That allowed us to observe and measure a large number of real-world Windows NT and Windows 2000 machine environments. One advantage of real-world examples and case studies is that they are more likely to resemble the environments that you encounter. We should caution you, however, that many of the examples we chose to write about reflect extreme circumstances where the behavior we are trying to illustrate is quite pronounced. However, even when the systems you are observing do not evidence similar exaggerated symptoms, you should still be able to apply the general principles illustrated. Our focus is on explaining how Windows 2000 and various hardware components associated with it work, how to tell when the performance of some application running under Windows 2000 is not optimal, and what you can do about it. The presentation is oriented toward practical problemsolving, with an emphasis on understanding and interpreting performance measurement data. Many realistic examples of performance problems are described and discussed. Intended Audience We have tried to aim this book at a variety of computer systems professionals, from system administrators who have mastered the basics of installing and maintaining Windows 2000 servers and workstations, to developers who are trying to build high-performance applications for this platform, to performance management and capacity planning professionals with experience on other platforms. Although we presume no specific background or prior level of training for our readers, our experience teaching this material suggests that this is not a book for beginners. If you find the material at hand too challenging, we recommend reading a good book on Windows 2000 operating system internals or on basic operating system principles first. We try to pick up the discussion precisely where most other official documentation and published sources leave off. This includes the course material associated with obtaining MCSE certification, which provides a very limited introduction to this topic. Computer performance remains a core topic of interest to experienced programmers, database administrators, network specialists, and system administrators. We wrote this book for professionals who seek to understand this topic in the context of Windows 2000 and the hardware environment it supports. At a minimum, you should have a working knowledge of Windows 2000. We recommend that you have read and are familiar with the section on performance in the Windows 2000 Professional Resource Kit, which introduces the topic and documents the basic tools. For best results, you should have ready access to a computer running Windows 2000 Professional or Server so that you can refer frequently to a live system while you are reading, and put the abstract concepts we discuss into practice. We understand that many people will buy this book because they hope it will assist them in solving some specific Windows 2000 performance problem they are experiencing. We hope so, too. Please understand, though, that for all but the simplest applications, there may be many possible solutions. While we do try to provide specific and detailed answers to Frequently Asked Questions, our approach to problem diagnosis is more theoretical and general than the many books that promise that this sort of understanding is easily acquired. It is possible that we have chosen to illustrate a discussion of some topic of immediate interest with an example that looks remarkably similar to a problem that you currently face. We all get lucky from time to time. Organization of This Book This book consists of twelve chapters and a bibliography. Chapter 1 introduces a broad range of best practices in computer performance and capacity planning. Chapter 2 describes the Windows 2000 performance monitoring API, which is the source of most of the performance data that is dealt with in subsequent chapters. Chapter 3 discusses the basics of processor performance monitoring at the system, processor engine, process, and thread levels. Since the thread, not the process, is the unit of execution in Windows 2000, we focus on thread scheduling and thread execution priority. Chapter 4 is organized around a description of a programming optimization exercise that compares and contrasts several popular CPU usage code-profiling tools. Chapter 5 discusses performance considerations when you are running Windows 2000 Server, Advanced Server, and Datacenter on machines with two or more processors. Chapter 6 discusses Windows 2000 virtual memory management and describes the techniques Windows 2000 uses to manage RAM and the working sets of active application processes. Chapter 7 tackles the Windows 2000 file cache, a built-in operating system service that is crucial to the performance of a number of important applications, including Windows 2000 network file sharing and IIS. Chapter 8 introduces basic disk performance concepts. Chapter 9 looks at filesystem performance. Chapter 10 discusses the disk array technology used in most larger Windows 2000 servers. Chapter 11 is a survey of computer networking, with an emphasis on the TCP/IP support in Windows 2000. Chapter 12 focuses on the Microsoft web server application Internet Information System (IIS). The bibliography contains a list of references for those who would like to pursue these topics in more depth. Conventions Used in This Book We have used the following conventions in this book: • Italic is used for filenames, directories, URLs, and hostnames. It is also used for emphasis and to introduce new terms. • Constant width is used for commands, keywords, functions, and utilities. • Constant width italic is occasionally used for replaceable items in code. This icon signifies a tip relating to the nearby text. This icon signifies a warning relating to the nearby text. How to Contact Us Please address comments and questions concerning this book to the publisher: O'Reilly & Associates, Inc. 1005 Gravenstein Highway North Sebastopol, CA 95472 (800) 998-9938 (in the United States or Canada) (707) 829-0515 (international or local) (707) 829-0104 (fax) We have a web page for this book, where we list errata and any additional information. You can access this page at: To comment or ask technical questions about this book, send email to: [email protected] For more information about books, conferences, Resource Centers, and the O'Reilly Network, see O'Reilly's web site at: Acknowledgments Both authors gratefully acknowledge the support and assistance of Robert Denn and his staff at O'Reilly, without whom the book you hold in your hands would never have been completed. We are especially grateful for Robert's steady hand and patience throughout the long gestation period for this book. At one point we thought that he might select an engraving of a sloth to adorn the front cover. We would also like to acknowledge the help of many other individuals who reviewed earlier drafts of the book, including Dave Butchart, Janet Bishop, Bob Gauthier, Todd Glasgow, Kitrick Sheets, Jim Quigley, and Rich Olcott. They all contributed to making the final text clearer and more readable. Any errors that remain are solely the responsibility of the authors. Mark would like to acknowledge the support of Ziya Aral and George Teixiera of Datacore for allowing him to complete this book on their watch. He is grateful for the long and fruitful collaboration with Stets Newcomb, Phil Henninge, and Dave Steier, working out the details of the Windows 2000 performance monitoring API. Special thanks to Joanne Decker for watching over me during this period. Barry Merrill, in particular, was helpful in getting that project off the ground, and his enthusiastic encouragement over the years is greatly appreciated. Russ Blake and Bob Watson from Microsoft also provided valuable support and assistance when we were starting out. Bob Gauthier, Jim Quigley, Sharon Seabaugh, Denis Nothern, and Claude Aron all contributed useful ideas and practical experiences. Also, thanks to Jee Ping, Kitrick Sheets, Dave Solomon, and Mark Russinovich for sharing their knowledge of Windows 2000 operating system internals. Mark would also like to recognize some of the many individuals who contributed to his understanding of the discipline of computer performance evaluation over the past twenty years of his deepening involvement in the field. Alexandre Brandwajn and Rich Olcott deserve special recognition for being stimulating collaborators over a long and fruitful period. Thanks to Jeff Buzen, Pat Artis, Ken Sevcik, Barry Merrill, Dick Magnuson, Ben Duhl, and Phil Howard for all nurturing my early interest in this subject. A belated thanks to Kathy Clark of Landmark Systems for allowing me the opportunity to practice what I preached in the area of mainframe performance. A nod to Bob Johnson for giving me the courage to even attempt writing a book in the first place and to Bob Thomas for encouraging my writing career. To Bernie Domanski, Bill Fairchild, Dave Halbig, Dan Kaberon, Chris Loosely, Bruce McNutt, Rich Milner, Mike Salsburg, Ray Wicks, Brian Wong, and many other friends and colleagues too numerous to mention from the Computer Measurement Group, I owe a debt of gratitude that I can never repay for having shared their ideas and experiences so freely. Thanks to the folks at Data General for giving us access to the CLARiiON disk array, and the folks at 3Ware Corporation for letting Odysseas use their RAID adapters. Thanks also to Ed Bouryng, Burton Strauss, Avi Tembulkar, and Michael Barker at KPMG for getting Odysseas involved with their performance tuning effort. Odysseas would like to thank Edward Lazowska, Kenneth Sevcik, and John Zahorjan, who got him started in the area of performance modeling of computer systems with their summer course at Stanford University. I appreciate the support of Yelena Yesha from the University of Maryland at Baltimore County, and Milt Halem at NASA's Center for Computational Sciences, who got me involved with modeling the performance of hierarchical mass storage systems and supported me throughout that effort. Special thanks to Dr. Daniel Menasce of George Mason University for taking me under his wing. Danny generously shared his extensive knowledge and experience in the field of performance evaluation and modeling. He was also instrumental in honing my technical writing and research skills. I want to thank my mother and brothers for their love and support over the years. I owe sincere gratitude to my father who always believed in me. If he were still alive, he would have been proud to see this book. Last, but not least, I must extend my most sincere gratitude to my wife Yimin. Throughout the long gestation period in getting this book completed, she took care of our two wonderful kids, John and Sophia, while I disappeared down in the basement to finish that very last chapter or make that very last modification. Despite the extra effort that she had to exert to compensate for my absence, she was supportive throughout. Chapter 1. Perspectives on Performance Management Our goal in writing this book is to provide a good introduction to the Windows 2000 operating system and its hardware environment, focusing on understanding how it works from the standpoint of a performance analyst responsible for planning, configuration, and tuning. Our target audience consists of experienced performance analysts, system administrators, and developers who are already familiar with the Windows 2000 operating system environment. Taken as a whole, Windows 2000 performance involves not just the operating system, but also the performance characteristics of various types of computer hardware, application software, and communications networks. The key operating system performance issues include understanding CPU scheduling and multiprogramming issues and the role and impact of virtual memory. Key areas of hardware include processor performance and the performance characteristics of I/O devices and other peripherals. Besides the operating system (OS), it is also important to understand how the database management system (DBMS) and transaction-monitoring software interact with both the OS and the application so...
View Full Document

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture