[
202
]
Personally, I habitually use the
uptime
command to view the load average. This
command not only gives me the load average but also tells me how long the server
has been running.
The load average is broken down into three sections, each representing 1 minute, 5
minutes, and 15 minutes respectively. A typical load average may look something
like the following:
0.36, 0.29, 0.31
In this example, we have a load average of
0.36
in the 1-minute section,
0.29
in
the five-minute section, and
0.31
in the fifteen-minute section. In particular, each
number represents how many tasks were waiting for attention from the CPU for that
given time period. Therefore, these numbers are really good. The server isn't that
busy, since virtually no task is waiting for the CPU at any one moment (each number
is less than 1). This is contrary to something such as overall CPU percentages,
which you may have seen in task managers on other platforms. While viewing your
CPU usage percentage can be useful, the problem with this is that your CPUs will
constantly go from a high percentage of usage to a low percentage of usage, which
you can see for yourself by just running
htop
for a while. When a task does some
sort of processing, you might see your cores shoot up to 100 percent and then right
back down to a lower number. That really doesn't tell you much, though. With load
averages, you're seeing the trend of usage over three given time frames, which is
more accurate in determining whether your server's CPUs are running efficiently or
are choking on a workload they just can't handle.
The main question, though, is when you should be worried, which really depends on
what kind of CPUs are installed on your server. Your server will have one or more
CPUs, each with one or more cores. To Linux, each of these cores, whether they are
physical or virtual, is the same thing (a CPU). In my case, the machine I took the
earlier output from has a CPU with four cores. The more CPUs your server has, the
more tasks it's able to handle at any given time, which also means it can handle a
higher load average.
When a load average for a particular time period is equal to the number of CPUs on
the system, that means your server is at capacity. It's handling a consistent number
of tasks that are equal to the number of tasks it can handle. For example, if you have
an 8-core CPU and the load average is 8 for a given time frame, then the CPU is 100%
at its available capacity for that time frame. If your load average is consistently more
than the number of cores you have available, that's when you'd probably want to
look into the situation. It's fine for your server to be at capacity every now and then,
but if it always is, that's a cause for alarm.
Chapter 8
Do'stlaringiz bilan baham: |