What Those Three Linux “CPU Usage” Numbers Mean

By admin
Just a quick note to self (and anyone looking for the same information). A common question I get for my free

WordPress
ORG

plugin,

Dashboard Widgets Suite
ORG

(

DWS
ORG

), is “what do the CPU Usage” numbers mean? Users get curious because the

DWS
ORG

plugin displays something like this on

the WordPress Dashboard
LOC

:

Displaying CPU Usage and other stats on the WP Dashboard (click image for full-size view)

Notice in the screenshot, where it shows the

three
CARDINAL

numbers for “CPU Usage”:


0.75
CARDINAL

,

0.55
CARDINAL

,

0.51
CARDINAL

As explained in more detail elsewhere, those

three
CARDINAL

numbers are referred to as Load Average. They are a measure of the load (resource usage) on the CPU . The numbers are based on the number of cores used by your

Linux
PRODUCT

server. Exactly how the

three
CARDINAL

numbers are calculated is all a bit esoteric, proprietary, and “mathy”, so let’s look at a few concrete examples to get a better idea of how it works..


One
CARDINAL

core:

0.50
CARDINAL

,

0.50
DATE

,

0.50
CARDINAL

= server using

50%
PERCENT

of CPU

1.00
CARDINAL

,

1.00
CARDINAL

,

1.00
CARDINAL

= server using

100%
PERCENT

of CPU

2.00
CARDINAL

,

2.00
CARDINAL

,

2.00
CARDINAL

= server using

200%
PERCENT

of CPU

Two
CARDINAL

cores:

0.50
CARDINAL

,

0.50
DATE

,

0.50
CARDINAL

= server using

25%
PERCENT

of CPU

1.00
CARDINAL

,

1.00
CARDINAL

,

1.00
CARDINAL

= server using

50%
PERCENT

of CPU

2.00
CARDINAL

,

2.00
CARDINAL

,

2.00
CARDINAL

= server using

100%
PERCENT

of CPU

Three
CARDINAL

cores:

0.50
CARDINAL

,

0.50
DATE

,

0.50
CARDINAL

= server using

16.6%
PERCENT

of CPU

1.00
CARDINAL

,

1.00
CARDINAL

,

1.00
CARDINAL

= server using

33.3%
PERCENT

of CPU

2.00
CARDINAL

,

2.00
CARDINAL

,

2.00
CARDINAL

= server using

66.6%
PERCENT

of CPU

Four
CARDINAL

cores:

0.50
CARDINAL

,

0.50
DATE

,

0.50
CARDINAL

= server using

12.5%
PERCENT

of CPU

1.00
CARDINAL

,

1.00
CARDINAL

,

1.00
CARDINAL

= server using

25%
PERCENT

of CPU

2.00
CARDINAL

,

2.00
CARDINAL

,

2.00
CARDINAL

= server using

50%
PERCENT

of

CPU
ORG

Those are idealized numbers to make things simpler to understand. In practice, the

three
CARDINAL

numbers will vary, possibly quite a bit. In the examples above, notice how the usage percentages (e.g.,

50%
PERCENT

,

100%
PERCENT

,

200%
PERCENT

) decrease as the number of cores increase. Which makes sense because more cores typically means more resources, and thus lighter loads.

Math formula

To understand the front-end math for the

three
CARDINAL

numbers, consider the simplest case:


One
CARDINAL

core:

1.00
CARDINAL

,

1.00
CARDINAL

,

1.00
CARDINAL

= server using

100%
PERCENT

of CPU

Makes sense. Now add another core and the load is split in

half
CARDINAL

, and thus the

CPU
ORG

usage is decreased to

50%
PERCENT

, like so:


Two
CARDINAL

cores:

1.00
CARDINAL

,

1.00
CARDINAL

,

1.00
CARDINAL

= server using

50%
PERCENT

of CPU

And so forth. In general, here is the mathematical formula calculate the percentage of

CPU
ORG

usage based on load average and the number of cores:

(load average ×

100
CARDINAL

) / (number of cores) = % CPU usage

So returning to the opening example averages:


0.75
CARDINAL

,

0.55
CARDINAL

,

0.51
CARDINAL

..we can calculate the percent CPU usage on the server for each of the

three
CARDINAL

numbers:


Two
CARDINAL

cores: (

0.75
CARDINAL

×

100
CARDINAL

) / 2 =

37.5%
PERCENT

CPU usage (

0.55 × 100
CARDINAL

) / 2 =

27.5%
PERCENT

CPU usage (

0.51 × 100
CARDINAL

) / 2 =

25.5%
PERCENT

CPU usage

..which (for me at least) is a comfortable running load average for the server.


Fifteen minutes
TIME

Another thing to understand is that the

three
CARDINAL

numbers represent the load average over

the past 15 minutes
TIME

. The

first
ORDINAL

number represents

1 minute ago
TIME

. The

second
ORDINAL


number 5 minutes ago
TIME

, and the

third
ORDINAL

number

15 minutes ago
TIME

. To illustrate:


1 minute
TIME

,

5 minutes
TIME

,

15 minutes 0.75
TIME

,

0.55
CARDINAL

,

0.51
CARDINAL

In general, lower numbers are better. For example, on a

1
CARDINAL

-core server, once the numbers approach

1.00
CARDINAL

, it means the server is processing at

100%
PERCENT

capacity. Likewise as the numbers go

higher than 1.00
CARDINAL

, it means the

CPU
ORG

is running at maximum capacity and there are tasks waiting to run as soon as other tasks finish.

Healthy numbers

So what do “healthy” load averages look like? Really it depends entirely on the server and how it’s set up and configured. In general you want lower numbers.

For example, the

three
CARDINAL

numbers above (

0.75
CARDINAL

,

0.55
CARDINAL

,

0.51
CARDINAL

) are typical of averages on my own server, which get fairly heavy traffic. In other cases, I’ve watched servers operate near or

over 100%
PERCENT

capacity for

weeks
DATE

or more. It really depends on a lot of factors. Just basically keep an eye on it and ask your web host if you have any questions or concerns.

For a deeper dive into the fun world of server performance, check out the related article,

Understanding CPU Utilization
WORK_OF_ART

, plus tons more stuff online to surf around.