How high is the Linux Load Average appropriate? CPU Load Utilization Check

If your computer (computer) is slow, you may want to check if the system is under high load?

Recently, there is aInternet marketingThe officer stated that he was responsible forE-commerceThe website was inaccessible due to a situation some time ago...

This website is based onWordPress website, 在Linux VPS server setup.

  • The configuration of the Linux VPS server has only 1 CPU core and 1GB RAM memory.

Log in to the Linux VPS server background to check the problem, and find that the load average is very high, reaching above 10.0.

On Linux systems, we usually useuptimecommand to view it (wcommand andtopcommand is also available).

Additionally, they also work with Apple's Mac computers.

If you find that the load average is too high, try to solve the problem!

  • When the load average load is too high,Chen WeiliangThe solution given is to increase the number of CPU cores.
  • Then, decisively upgrade the configuration to2 CPU cores,8 GB RAM memory.
  • The high load average load situation was quickly resolved.

XNUMX. Check the system load

In an SSH terminal window, type the following command▼

uptime

The system will return a line of information ▼

How high is the Linux Load Average appropriate? CPU Load Utilization Check

The second half of the line says "load average" which means "the average load of the system"

  • With 3 numbers inside, can we determine whether the system load is large or small?

Server load? top command/CPU usage/load average calculation method

Why are there 3 numbers?

  • They represent the average load of the system in minutes of 1 minute, 5 minutes and 15 minutes.
  • If you keep looking, it will also tell you that when the CPU is completely idle, the load average is 0;
  • When the CPU workload is saturated, the load average is 1.

What does CPU mean?

  • CPU is the central processing unit.
  • (English Central Processing Unit, CPU)
  • The CPU is the computing core and control core of a computer.

CPU usage

  • CPU usage is the statistical information of the CPU usage status over a period of time.
  • This indicator shows the CPU usage (when the CPU is occupied).
  • If the CPU is occupied for a long time, you need to consider whether the CPU is overloaded. ?
  • Long-term overload operation is a kind of damage to the machine itself.
  • Therefore, the CPU utilization must be controlled to a certain ratio to ensure the normal operation of the machine.

What is Load Average?

  • Load Average is the CPU load, and the information it contains is the statistics of the CPU usage status within a segment.
  • It is a statistic of the sum of CPU processing and the number of processes waiting for CPU processing for a period of time.
  • That is, the queue length statistics used by the CPU.

Obviously, the lower the value of "load average", such as 0.2 or 0.3, means that the workload of the computer (computer) is less and the system load is lighter.

  • However, when can you see that the system is under heavy load?
  • In the end is equal to 1 hour?Or is it equal to 0.5?Or is it equal to 1.5?
  • What should I do if these three values ​​are different within 1 minute, 5 minutes and 15 minutes?

XNUMX. Analogy

To determine if your system is overloaded, you must understand what load average really means.

Next,Chen WeiliangThis question will be explained in the most plain language possible.

First, we assume that in the simplest case, your computer has only one CPU, and all operations must be performed by this CPU.

Let's imagine the load Average of this CPU as a bridge:

There is only one lane on the bridge and all vehicles must cross this lane.

(Obviously, the bridge can only be used in one direction.)

When the system load is 0, it means there is no car on the bridge ▼

When the system load is 0, it means there is no car on the bridge

The system load is 0.5, which means there are half the cars on the bridge ▼

The system load is 0.5, which means there are half cars on the bridge 4th sheet

The system load is 1.0, which means there are cars on all parts of the bridge, which means the bridge is "full" ▼

The system load is 1.0, which means there are cars on all parts of the bridge, which means the bridge is "full" sheet 5

  • But it must be pointed out that the bridge can still be passed smoothly here.

The system load is 1.7, which means there are too many vehicles and the bridge is full (100%).

  • Vehicles waiting on the bridge accounted for 70% of the bridge vehicles.

By analogy, and so on, the system load is 2.0:

  • Meaning there are as many vehicles waiting as there are bridge decks.
  • A system load of 3.0 means there are twice as many vehicles waiting on the bridge as the deck.
  • When the system load is greater than 1, the rear vehicle must wait;
  • The greater the system load, the longer the waiting time for crossing the bridge▼

The heavier the system load, the longer the waiting time to cross the bridge. Sheet 6

  • The system load of the CPU is basically equal to the capacity of the above-mentioned analog bridge, which is the maximum workload of the CPU.
  • The vehicle on the bridge is a process waiting for the CPU to process.

If the CPU processes a maximum of 100 processes per minute, the system load is 0.2, which means that the CPU only processes 1 processes in this 20 minute;

A system load of 1.0 means that the CPU handles 1 processes in this 100 minute;

1.7 This means that in addition to the 100 processes the CPU is processing, there are 70 processes waiting to be processed by the CPU.

In order to run the computer smoothly, the system load should not exceed 1.0, so there is no need to wait for any process and all processes can be processed first.

Obviously, 1.0 is a key value.

If this value is exceeded, the system is not optimal.You have to intervene.

XNUMX. How much is the system load load average appropriate?

Is 1.0 an ideal value for system load?

Not necessarily, sysadmins tend to leave a little space.

When this value reaches 0.7, you should know something like this:

  • When the system load continues to be greater than 0.7, you must start investigating the problem and prevent the situation from getting worse.
  • When the system load continues to be greater than 1.0, you must find a solution and lower the value.
  • When the system load reaches 5.0, it indicates that there is a serious problem with the system, and it has not responded for a long time, or almost crashed.You should not let the system reach this value.

Four, multiple CPU processors

The above is assuming that your computer (computer) has only one CPU.

What happens if your computer (computer) has 2 CPUs installed?

2 CPUs means that the processing power of the computer (computer) is doubled, and the number of processes that can be processed at the same time is doubled.

Chen WeiliangThe bridge is still used as an analogy here. 2 CPUs means that the bridge has 2 channels, and the traffic capacity is doubled ▼

Chen Weiliang still uses the bridge as an analogy here. 2 CPUs means that the bridge has 2 passages, and the traffic capacity is doubled.

  • So, 2 CPUs means that the system load can reach 2.0, and each CPU can reach 100% workload.
  • For a computer with n.0 CPUs, the acceptable system load is up to n.0 CPUs.

Five, multi-core CPU processor

Chip suppliers usually have multiple CPU cores inside 1 CPU, which is called "multi-core CPU".

A multi-core CPU is similar to a multi-CPU in terms of system load.

Therefore, when considering system load, you must consider how many CPUs does your computer have?And how many cores does each CPU have?

Then, by dividing the system load by the total number of cores, as long as the load per core does not exceed 1.0, the computer will run as usual.

How to know how many CPU cores a computer has?

Using the command, allows you to view CPU information ▼

cat /proc/cpuinfo

Commands that directly return the total number of cores of the CPU▼

grep -c 'model name' /proc/cpuinfo

XNUMX. Which load average time should I look at?

last question:

The "load average" load average returns a total of three averages:

  • 1 minute system load, 5 minute system load, 15 minute system load.

Which value should I refer to?

  • If the system load is greater than 1 for only 1.0 minute, the other 2 time periods are less than 1.0, which indicates that this is only a temporary phenomenon and the problem is not serious.
  • If the average system load is greater than 15 within 1.0 minutes (after increasing the number of CPU cores), the problem is still there, not a temporary phenomenon.
  • Therefore, you should mainly observe "15 minutes system load" as an indicator that the computer (computer) is operating normally.

The following is more about top command/CPU usage/load average calculation method ▼

What should I do if the VPS load is too high?

Now my website cannot be accessed because the load is too high, what should I do?

top – 20:44:30 up 12 min, 1 user, load average: 2.21, 8.39, 6.48

  • Your server is self-managing, what you should do is check your server itself via SSH.
  • Check what is it running?What process and so on?
  • If necessary, try restarting the server.
  • If after restarting the server, the load is still too high, try to identify the overloaded process and stop it.
  • If necessary, restart the process (not the server) individually.
  • Or after consulting the customer service "why the VPS/server load is too high", there is still no way to do it, and finally the only way is to increase the server configuration.

How much space is suitable for a foreign trade company's website?

How to choose the right server configuration?Click the link below to view the daily average 1 IP server solution ▼

Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) shared "How much is the Linux Load Average too high? CPU Load Utilization Check" will help you.

Welcome to share the link of this article:https://www.chenweiliang.com/cwl-1027.html

Welcome to the Telegram channel of Chen Weiliang's blog to get the latest updates!

🔔 Be the first to get the valuable "ChatGPT Content Marketing AI Tool Usage Guide" in the channel top directory! 🌟
📚 This guide contains huge value, 🌟This is a rare opportunity, don’t miss it! ⏰⌛💨
Share and like if you like!
Your sharing and likes are our continuous motivation!

 

Comment

Your email address will not be published. Required fields * Callout

scroll to top