Optimizing Linux Performance: A Hands-on Guide to Linux Performance Tools

Optimizing Linux Performance: A Hands-on Guide to Linux Performance Tools

by Phillip G. Ezolt
     
 

  • The first comprehensive, expert guide for end-to-end Linux application optimization

  • Learn to choose the right tools—and use them together to solve real problems in real production environments

Superior application performance is more crucial than ever—and in today's complex production environments,

Overview

  • The first comprehensive, expert guide for end-to-end Linux application optimization

  • Learn to choose the right tools—and use them together to solve real problems in real production environments

Superior application performance is more crucial than ever—and in today's complex production environments, it's tougher to ensure, too. If you use Linux, you have extraordinary advantages: complete source code access, plus an exceptional array of optimization tools. But the tools are scattered across the Internet. Many are poorly documented. And few experts know how to use them together to solve real problems. Now, one of those experts has written the definitive Linux tuning primer for every professional: Optimizing Linux® Performance.

Renowned Linux benchmarking specialist Phillip Ezolt introduces each of today's most important Linux optimization tools, showing how they fit into a proven methodology for perfecting overall application performance. Using realistic examples, Ezolt shows developers how to pinpoint exact lines of source code that are impacting performance. He teaches sysadmins and application developers how to rapidly drill down to specific bottlenecks, so they can implement solutions more quickly. You'll discover how to:

  • Identify bottlenecks even if you're not familiar with the underlying system

  • Find and choose the right performance tools for any problem

  • Recognize the meaning of the events you're measuring

  • Optimize system CPU, user CPU, memory, network I/O, and disk I/O—and understand their interrelationships

  • Fix CPU-bound, latency-sensitive, and I/O-bound applications, through case studies you can easily adapt to your own environment

Install and use oprofile, the advanced systemwide profiler for Linux systems

If you're new to tuning, Ezolt gives you a clear and practical introduction to all the principles and strategies you'll need. If you're migrating to Linux, you'll quickly master Linux equivalents to the tools and techniques you already know. Whatever your background or environment, this book can help you improve the performance of all your Linux applications—increasingbusiness value and user satisfaction at the same time.

© Copyright Pearson Education. All rights reserved.

Editorial Reviews

bn.com
The Barnes & Noble Review
Folks who can optimize Linux performance in the enterprise are scarce -- and valuable. With this book, you can be one of them.

Optimizing Linux Performance shares Phillip Ezolt’s lessons from a decade of diagnosing Linux/UNIX performance. First, Ezolt demonstrates how to use Linux’s essential tools for measuring CPUs, memory, processes, disk I/O, and networking. Next, he takes on dozens of real-world issues. Is a process devouring too many CPU cycles? Is the kernel servicing too many interrupts? Is swap space a problem? Are any network devices operating near their limits?

Ezolt introduces a systematic methodology for identifying problems, baselining, goal setting, configuring applications, running performance tools, and analyzing results. You’ll put it to work in three chapter-length case studies, clearing bottlenecks in CPU-bound and latency-sensitive apps and diagnosing systemwide slowdowns. This is relentlessly practical, hands-on stuff, distilled for use by any experienced Linux admin. Bill Camarda, from the May 2005 Read Only

Product Details

ISBN-13:
9780131486829
Publisher:
Prentice Hall
Publication date:
03/19/2005
Series:
HP Professional Series
Pages:
384
Product dimensions:
6.90(w) x 9.00(h) x 1.00(d)

Related Subjects

Read an Excerpt

PrefacePreface1.1. WHY IS PERFORMANCE IMPORTANT?

If you've ever sat waiting for a computer to do something, (while pounding on your desk, cursing and wondering "What is TAKING so long?") you know why it is important to have a fast and well tuned computer system. While not all performance problems can be easily solved, understanding WHY things are slow can be the difference between fixing the problem in software, upgrading the slow hardware or simply throwing the whole computer out the window. Fortunately most operating systems, Linux in particular, provide the tools to figure out why the machine runs slowly. By using a few basic tools, you can determine where the system is slowing down and fix the parts that are running inefficiently.

While a slow system can be particularly annoying to an end-user, if you are an application developer, you have an even more important reason to performance tune your applications. An efficient application runs on more systems. Not everyone has the latest hardware and by writing sluggish applications that need a zippy computer, you eliminate customers who have slower computers. A well-tuned application will be usable by more customers, and have a bigger potential user base. In addition, if a potential customer must choose between two different applications with similar functionality, they will often chose the one which runs faster or is more efficient. Finally, a long lived application will likely go through several rounds of optimization to cope with different customer demands, so it is crucial to know how to track down performance problems.

If you are a system administrator, you have a responsibility to the users of the system to make sure that it is running with an adequate level of performance. If the system is running slowly, users will complain. If you can figure out the problem and fix it quickly, they'll stop complaining. As a bonus, if you can solve their problem by tuning the application or operating system rather than buying new hardware, you'll make the company bean-counters happy. Knowing how to effectively use performance tools can mean the difference between spending days and spending hours on a performance problem.

1.2. LINUX: STRENGTHS AND WEAKNESS

If you use Linux, maintain it, and develop on it, you are in a strange but good situation. You have unprecedented access to source code, developers, and mailing lists which often document design decisions years after they were made. Linux is an excellent environment to find and fix performance problems. This is in contrast to a proprietary environment, where it can be difficult to get direct access to software developers, may be hard to find written discussion about most design decisions, and is nearly impossible to access source code. In addition to this productive environment, Linux also has powerful performance tools that you can use to find and fix performance problems. These tools rival their proprietary counterparts.

Even with these impressive benefits the Linux ecosystem still has challenges to overcome. Linux's performance tools are scattered everywhere. The tools are developed by different groups with different aims, and as a result aren't in the same location. Some tools are included in standard Linux distributions, such as Redhat, SUSE or Debian, while others are scattered through out the Internet. If you're trying to solve a performance problem, you first have to know that the tools you need exist, and then figure out where to find them.

No single Linux performance tool will solve every type of performance problem, so you also must figure out how to use them together to determine what is broken. This can be a bit of an art that becomes easier with experience. Most of the general strategies can be written down, but Linux doesn't have any guide that tells you how to use the performance tools together to actually solve a problem. Most of the tools or subsystems have information about tuning the particular subsystem, but not how to use them with other tools. Many performance problems span several areas of the system and unless you know how to use the tools together you won't be able the fix the problem.

1.3. HOW CAN THIS BOOK HELP YOU?

This book will help you in a few different ways. It will show you:

  • What the different performance tools measure

  • How to use each tool

  • How to combine the tools to solve a performance problem

  • How to start with a poorly performing system and pinpoint the problem

  • How the methods are used to solve real-world problems by providing a few case studies

Using the methods in this book, you will be able to make a well organized and diagnosed problem description which can be passed on to the original developers. If you're lucky, they'll solve the problem for you.

1.4. WHY LEARN HOW TO USE PERFORMANCE TOOLS?

Why should anyone put effort into tuning a system or application?

  • A well-tuned system can do more work with less resources

  • A well-tuned application can run on older hardware

  • A well-tuned desktop can save a user time

  • A well-tuned server provides a higher service quality for more users

If you know how to effectively diagnose performance problems, you can take a targeted approach at solving the problem, rather than simply taking a shot in the dark and hoping that it works. If you are an application developer, this means that you can quickly figure out what piece of code is causing the problem. If you are a system administrator, it means that you can figure out what part of the system needs to be tuned, or upgraded without wasting time unsuccessfully trying different solutions. If you are a end-user, you can figure out which applications are lagging, and report the problem to the developers, or update your hardware if necessary.

Linux is at cross-roads. Most of the functionality for a highly productive system is already done. The next evolutionary step is for Linux and Linux applications to be tuned to compete with and surpass the performance of other operating systems. Some of this performance optimization has already begun. Projects such as SAMBA, Apache and the TUX web server have spend a lot of time tuning and optimizing the system and code. Other performance optimizations such as the Native POSIX Thread Library (NPTL), which dramatically improve threading performance, and object prelinking, which improves application startup time, are just starting to be integrated into Linux. Linux is a fertile ground for performance improvements.

1.5. CAN I TUNE FOR PERFORMANCE?

The best thing about performance optimization is that you don't need to know the details of the entire application or system to effectively fix performance problems. Performance optimization requires a complementary set of skills to those of a typical application developer.

You need to be observant and persistent. It takes more of a detective than a programmer to hunt down and eliminate the performance problems. It is exhilarating to find and fix these. When you start, performance is terrible. However, you track down the cause. Rip it out by the roots, if you're lucky, it runs twice as fast. Voila!

To get to the "viola!", you have to understand the powerful but sometimes confusing world of Linux performance tools. This takes a little bit of work, but in the end it is worth it. The tools can show you aspects of your application and system that you never expected to see.

2.1 WHO SHOULD READ THIS BOOK?

This book is intended to help Linux software developers, system administrators and end users to use the Linux performance tools to find the performance problems in a given system. Beginning performance investigators will learn the basics of performance investigation and analysis. Medium to advanced performance investigators, especially those with performance experience on other proprietary operating systems, will learn about the Linux equivalents of commands from other systems they may already be familiar with.

Software developers will learn how to pinpoint the exact line of source code that is causing a performance problem. System administrators who are performance tuning a system will learn about the tools that show why a system is slowing down and they can then use that information to tune the system. Finally, while not the primary focus of the book, end users will be the learn basic skills necessary to figure out which applications are consuming all of the system resources.

2.2 HOW IS THE BOOK ORGANIZED?

This book is intended to teach an audience varying level of experience to find and fix performance problems. To accomplish this, the chapters are presented so that you can pick and choose to read different parts of the book without reading the entire book straight through. The book is structured as follows:

The first chapter is devoted to the basic methods of performance problem hunting. It contains a series of non-Linux specific tips and suggestions that are useful for tracking down performance issues. These guidelines are general suggestions for performance problem hunting and could be applied to tracking down performance issues on any type of computer system.

The next few chapters, and the bulk of the book, present the individual tools available to measure different performance statistics on a Linux system. These chapters explain what a tool measures, how it is invoked, and an example of the tool being used. Each different chapter demonstrates tools that measure aspects of different Linux subsystems such as system CPU, user CPU, memory, network I/O and disk I/O. If a tool measures aspects of more than one subsystem, it is presented in more than one chapter. However, only the appropriate tools options for that subsystem are presented in a given chapter. Each chapter contains descriptions for multiple tools. The descriptions are in the following format:

  1. Introduction: This explains what the tool is meant to measure and how it operates.

  2. Performance tool options: This section does not simply rehash the tool's documentation. Rather, it explains which options are relevant to the current topic and what those options mean. For example, some performance tool man pages state the events that a tool measures, but never explain what the events mean. This section explains the meaning of the events, and how it is relevant to the current subsystem.

  3. Example: This gives one or more examples of the tool being used to measure performance statistics. This sections shows the tool being invoked as well as any output that it generates.

The next chapter is Linux specific and contains a series of steps to use when confronted with a slowly performing Linux system. It explains how to use the previously described Linux performance together to pinpoint the cause of the performance problem. This chapter is the most useful if you want to start with a misbehaving Linux system and simply diagnose the problem, without necessarily understanding the details of the tools.

The next three chapters show case studies where the methodologies and tools previously described are used together to solve real world problems. The case studies show the use of Linux performance tools in finding and fixing different types of performance problems: a CPU bound application, a latency sensitive application, and an I/O bound application.

The final chapter provides an overview of the performance tools and what opportunities that Linux has for improvement. The book also has two appendices. Appendix A will contain a table of the performance tools presented in the book, a URL to the latest version of each tool, and information on which Linux distributions the tool is supported. Finally, appendix B will contain information about how to install oprofile, a very powerful, but hard to install tool, on a few major Linux distributions.

© Copyright Pearson Education. All rights reserved.

Meet the Author

Phillip G. Ezolt has nearly a decade's experience optimizing Linux and Unix systems. For six years, he ported and designed Linux performance tools for Compaq's Alpha performance group. As Compaq's primary representative to the SPEC CPU subcommittee, he helped shape SPEC CPU 2000 and successor CPU benchmarks. Ezolt is known throughout the industry for his expertise in teaching Linux performance optimization to developers and administrators.

© Copyright Pearson Education. All rights reserved.

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >