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

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 ...

See more details below
Paperback
$40.48
BN.com price
(Save 26%)$54.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (9) from $7.85   
  • New (5) from $37.59   
  • Used (4) from $7.85   
Sending request ...

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.

Read More Show Less

Editorial Reviews

From Barnes & Noble
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

Read More Show Less

Product Details

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

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.

Read More Show Less

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.

Read More Show Less

Table of Contents

Preface

1. Performance Hunting Tips.

General Tips.

Take Copious Notes (Save Everything).

Automate Redundant Tasks.

Choose Low-Overhead Tools If Possible.

Use Multiple Tools to Understand the Problem.

Trust Your Tools.

Use the Experience of Others (Cautiously).

Outline of a Performance Investigation.

Finding a Metric, Baseline, and Target.

Track Down the Approximate Problem.

See Whether the Problem Has Already Been Solved

The Case Begins (Start to Investigate).

Document, Document, Document.

Chapter Summary

2. Performance Tools: System CPU.

CPU Performance Statistics

Run Queue Statistics.

Context Switches.

Interrupts.

CPU Utilization.

Linux Performance Tools: CPU.

vmstat (Virtual Memory Statistics).

top (v. 2.0.x).

top (v. 3.x.x).

procinfo (Display Info from the /proc File System).

gnome-system-monitor.

mpstat (Multiprocessor Stat).

sar (System Activity Reporter).

oprofile.

Chapter Summary

3. Performance Tools: System Memory.

Memory Performance Statistics.

Memory Subsystem and Performance.

Memory Subsystem (Virtual Memory).

Linux Performance Tools: CPU and Memory.

vmstat (Virtual Memory Statistics) II.

top (2.x and 3.x).

procinfo II.

gnome-system-monitor (II).

free.

slabtop.

sar (II).

/proc/meminfo.

Chapter Summary

4. Performance Tools: Process-Specific CPU.

Process Performance Statistics.

Kernel Time Versus User Time.

Library Time Versus Application Time.

Subdividing Application Time.

The Tools.

time.

strace.

ltrace.

ps (Process Status).

ld.so (Dynamic Loader).

gprof.

oprofile (II).

Languages: Static (C and C++) Versus Dynamic (Java and Mono).

Chapter Summary.

5. Performance Tools: Process-Specific Memory.

Linux Memory Subsystem.

Memory Performance Tools.

ps.

/proc/.

memprof.

valgrind (cachegrind).

kcachegrind.

oprofile (III).

ipcs.

Dynamic Languages (Java, Mono).

Chapter Summary.

6. Performance Tools: Disk I/O.

Introduction to Disk I/O.

Disk I/O Performance Tools.

vmstat (ii).

iostat.

sar.

lsof (List Open Files).

What’s Missing?

Chapter Summary.

7. Performance Tools: Network.

Introduction to Network I/O.

Network Traffic in the Link Layer.

Protocol-Level Network Traffic.

Network Performance Tools.

mii-tool (Media-Independent Interface Tool).

ethtool.

ifconfig (Interface Configure).

ip.

sar.

gkrellm.

iptraf.

netstat.

etherape.

Chapter Summary

8. Utility Tools: Performance Tool Helpers.

Performance Tool Helpers.

Automating and Recording Commands.

Graphing and Analyzing Performance Statistics.

Investigating the Libraries That an Application Uses.

Creating and Debugging Applications.

Tools.

bash.

tee.

script.

watch.

gnumeric.

ldd.

objdump.

GNU Debugger (gdb).

gcc (GNU Compiler Collection).

Chapter Summary

9. Using Performance Tools to Find Problems.

Not Always a Silver Bullet.

Starting the Hunt.

Optimizing an Application.

Is Memory Usage a Problem?

Is Startup Time a Problem?

Is the Loader Introducing a Delay?

Is CPU Usage (or Length of Time to Complete) a Problem?

Is the Application’s Disk Usage a Problem?

Is the Application’s Network Usage a Problem?

Optimizing a System.

Is the System CPU-Bound?

Is a Single Processor CPU-Bound?

Are One or More Processes Using Most of the System CPU?

Are One or More Processes Using Most of an Individual CPU?

Is the Kernel Servicing Many Interrupts?

Where Is Time Spent in the Kernel?

Is the Amount of Swap Space Being Used Increasing?

Is the System I/O-Bound?

Is the System Using Disk I/O?

Is the System Using Network I/O?

Optimizing Process CPU Usage.

Is the Process Spending Time in User or Kernel Space?

Which System Calls Is the Process Making, and How Long Do They Take to Complete?

In Which Functions Does the Process Spend Time?

What Is the Call Tree to the Hot Functions?

Do Cache Misses Correspond to the Hot Functions or Source Lines?

Optimizing Memory Usage.

Is the Kernel Memory Usage Increasing?

What Type of Memory Is the Kernel Using?

Is a Particular Process’s Resident Set Size Increasing?

Is Shared Memory Usage Increasing?

Which Processes Are Using the Shared Memory?

What Type of Memory Is the Process Using?

What Functions Are Using All of the Stack?

What Functions Have the Biggest Text Size?

How Big Are the Libraries That the Process Uses?

What Functions Are Allocating Heap Memory?

Optimizing Disk I/O Usage.

Is the System Stressing a Particular Disk?

Which Application Is Accessing the Disk?

Which Files Are Accessed by the Application?

Optimizing Network I/O Usage.

Is Any Network Device Sending/Receiving Near the Theoretical Limit?

Is Any Network Device Generating a Large Number of Errors?

What Type of Traffic Is Running on That Device?

Is a Particular Process Responsible for That Traffic?

What Remote System Is Sending the Traffic?

Which Application Socket Is Responsible for the Traffic?

The End.

Chapter Summary.

10. Performance Hunt 1: A CPU-Bound Application (GIMP).

CPU-Bound Application.

Identify a Problem.

Find a Baseline/Set a Goal.

Configure the Application for the Performance Hunt.

Install and Configure Performance Tools.

Run Application and Performance Tools.

Analyze the Results.

Jump to the Web.

Increase the Image Cache.

Hitting a (Tiled) Wall.

Solving the Problem.

Verify Correctness?

Next Steps.

Chapter Summary

11. Performance Hunt 2: A Latency-Sensitive Application (nautilus).

A Latency-Sensitive Application.

Identify a Problem.

Find a Baseline/Set a Goal.

Configure the Application for the Performance Hunt.

Install and Configure Performance Tools.

Run Application and Performance Tools.

Compile and Examine the Source.

Using gdb to Generate Call Traces.

Finding the Time Differences.

Trying a Possible Solution.

Chapter Summary

12. Performance Hunt 3: The System-Wide Slowdown (prelink).

Investigating a System-Wide Slowdown.

Identify a Problem.

Find a Baseline/Set a Goal.

Configure the Application for the Performance Hunt.

Install and Configure Performance Tools.

Run Application and Performance Tools.

Simulating a Solution.

Reporting the Problem.

Testing the Solution.

Chapter Summary.

13. Performance Tools: What’s Next?

The State of Linux Tools.

What Tools Does Linux Still Need?

Hole 1: Performance Statistics Are Scattered.

Hole 2: No Reliable and Complete Call Tree.

Hole 3: I/O Attribution.

Performance Tuning on Linux.

Available Source.

Easy Access to Developers.

Linux Is Still Young.

Chapter Summary.

Appendix A. Performance Tool Locations.

Appendix B. Installing oprofile.

Fedora Core 2 (FC2).

Enterprise Linux 3 (EL3).

SUSE 9.1.

Index.

Read More Show Less

Preface

Preface

1.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.

Read More Show Less

Introduction

Preface

1.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 asystem 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?

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 adminis 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.


Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)