CHAPTER 2 N
34 CHAPTER 2 N
CHAPTER 2 N
36 CHAPTER 2 N
CHAPTER 2 N
38 CHAPTER 2 N
CHAPTER 2 N
40 CHAPTER 2 N
CHAPTER 2 N
42 CHAPTER 2 N
CHAPTER 2 N
CHAPTER 3
Performance Monitoring
Finding Performance Problems
on Ubuntu Server
Running a server is one thing. Running a server that works well is something else. On
a server whose default settings haven’t been changed since installation, things may just
go terribly wrong from a performance perspective. Finding a performance problem on
a Linux server is not that easy. You need to know what your computer is doing and how to
interpret performance monitoring data. In this chapter you’ll learn how to do just that.
To give you a head start, you’ll have a look at pkl first. Though almost everyone
already knows how to use the pkl utility, few know how to really interpret the data that
pkl provides. The pkl utility is a very good starting place when analyzing performance on
your server. It gives you a good indication of what component is causing performance
problems in your server. After looking at pkl, we’ll consider some advanced utilities that
help to identify performance problems on particular devices. Specifically, we’ll look at
performance monitoring on the CPU, memory, storage, and network.
Interpreting What Your Computer Is Doing: top
Before you start to look at the details produced by performance monitoring, you should
have a general overview of the current state of your server. The pkl utility is an excellent
tool to help you with that. As an example for discussion, let’s start by looking at a server
that is restoring a workstation from an image file, using the Clonezilla imaging solution.
The pkl output in Listing 3-1 shows how busy the server is that is doing the restoration.
45
46 CHAPTER 3 N
CHAPTER 3 N
48 CHAPTER 3 N
CHAPTER 3 N
50 CHAPTER 3 N
CHAPTER 3 N
52 CHAPTER 3 N
CHAPTER 3 N
54 CHAPTER 3 N
CHAPTER 3 N
56 CHAPTER 3 N
CHAPTER 3 N
58 CHAPTER 3 N
CHAPTER 3 N
60 CHAPTER 3 N
CHAPTER 3 N
62 CHAPTER 3 N
CHAPTER 3 N
64 CHAPTER 3 N
CHAPTER 3 N
66 CHAPTER 3 N
CHAPTER 3 N
68 CHAPTER 3 N
CHAPTER 3 N
70 CHAPTER 3 N
CHAPTER 3 N
72 CHAPTER 3 N
CHAPTER 3 N
74 CHAPTER 3 N
CHAPTER 3 N
76 CHAPTER 3 N
CHAPTER 3 N
78 CHAPTER 3 N
CHAPTER 3 N
80 CHAPTER 3 N
CHAPTER 3 N
CHAPTER 4
Performance Optimization
Tuning Ubuntu Server
Like a Racing Car
No matter on which kind of server you install it, Ubuntu Server will always be installed
with the same settings. To give an example, the area of reserved memory in RAM for
packets coming in to the network board will always be the same, no matter if your server
has 128 MB or 128 GB of RAM. As you can guess, there’s something to gain here! In this
chapter you’ll read about performance optimization. We’ll explore what possibilities
there are to optimize performance of the CPU, RAM, storage, and network. I’ll also give
a few hints on optimizing performance for network services like Samba and NFS. If every-
thing goes well, at the end of this chapter, your server will be performing a lot better.
Strategies for Optimizing Performance
You can look at performance optimization in two different ways. For some people, it
just means changing some parameters and seeing what happens. That is not the best
approach. A much better approach is to start with performance monitoring first. This
will give you some crystal-clear ideas about what exactly is happening with performance
on your server. Before optimizing anything, you should know what exactly to optimize.
For example, if the network performs badly, you should know whether the problems are
caused by the network or caused by an insufficient amount of memory allocated for the
network packets coming in and going out. So make sure you know what to optimize.
About /proc and sysctl
Once you know what to optimize, it comes down to actually doing it. In many situa-
tions, optimizing performance means writing a parameter to the +lnk_ file system. This
83
84 CHAPTER 4 N