[Linux] Understanding Load Average

[Linux] Understanding Load Average

I am writing this quick article to help understand the importance of Load Average in Linux for a Performance Engineer when debugging an issue.

Load average on a system can be obtained by different ways:

1.Using "top" command. This gives the current live load average.

2. Using "cat /proc/loadavg" command. This gives a snapshot of the load average as the command is executed.



3.Using command "uptime". This also gives a snapshot of the load average as the command is executed.

4.Using command "sar -q". This is very useful method, if you are trying to diagnose a problem that has already occurred and passed by. Since sar collects historic data, you can extract historic load average details using "sar -q" command.

Now that we know how to get the load average values, lets try to make sense of what these load average values mean. As you can see, in all the above ways load average is a set of three numbers. These three numbers are the load averages on the system in [last 1min] [last 5mins] [last 15mins]. These three sets of values help in understanding if the load on the system is increasing/decreasing or is steady over time.

In simple words, load average means the number of processes in active state waiting to be executed. So the values of load average tell us if the CPU's have a large number of waiting processes to be served or they are good to serve the processes without making them wait long. Note : In the above sentence by "CPU's" I mean logical CPU's. Details explanation of what logical/virtual CPU is can be found in my other article here.

Now that we know what load average values mean, how to decide if a load average value is good or bad? The answer to this depends on the capacity of CPU that you have on your system.

Lets assume that we have a 8 core CPU installed on our machine. Each of these cores can at any given time can serve one process. In this case a load average value of 8 would mean each core are serving a process and are running to their capacity. It's handling a consistent number of tasks that are equal to the number of tasks it can handle. 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.

It is important to note that CPU percentage on a system and load average are different. CPU percentage refers to the resources used by the process running on the CPU and load average refers to the number of processes in active state waiting to be served by the CPU.

Load average is a very important parameter as it gives a picture of run queue on a server. When the load averages are pretty high, you might want to take a bunch of thread dumps to see what is making this run queue grow and what the current served processes are doing on the CPU.

Hope this article helps.

Vandan Saiya

Assistant Manager| Technical Lead | Software Architecture|Laravel

6 年

Can you help me out with few articles about? how to debug slow running web application ? ?

回复
Akshay Deshpande

Architect, Engineering

7 年

Thank you.

回复
Prasad Lele

Performance Engineer | AWS | Jmeter | Load Runner | APM Tools | CICD

7 年

Nice Article

回复
Sai Pavan Kumar Polisetty

Senior Software Development Engineer (Level 3) at Hitachi Vantara

7 年

Very nice and useful article Akshay ??

回复

要查看或添加评论,请登录

Akshay Deshpande的更多文章

  • [Performance] : What does CPU% usage tell us ?

    [Performance] : What does CPU% usage tell us ?

    [Edit] -- All my latest articles are not published at - https://performanceengineeringin.wordpress.

    6 条评论
  • [Performance] : Understanding CPU Time

    [Performance] : Understanding CPU Time

    As a Performance Engineer, time and again you will come across a situation where you want to profile CPU of a system…

    4 条评论
  • Performance Engineering Checklists

    Performance Engineering Checklists

    Checklists; something that I truly believe in having for everything. Right from list of things to check before leaving…

    5 条评论
  • Random module in Python

    Random module in Python

    Time and again if you are building a small game or if you are trying to pick something randomly in Python, you will…

  • Understanding Physical and Logical CPUs

    Understanding Physical and Logical CPUs

    Here is a quick write up on what actually Physical and Logical CPU mean, and how are they different. To begin with, the…

    3 条评论
  • Counter in Python

    Counter in Python

    Counters is the best thing that has happened to Python when you think as a Data analyst. Counters can be used as an…

    2 条评论
  • Jprofiler - CPU profiling

    Jprofiler - CPU profiling

    Jprofiler can serve many purposes, and CPU profiling and analysis is one of them. This article is more about how to…

    1 条评论
  • Learning how to learn [Python]

    Learning how to learn [Python]

    As Brain Herbert has rightly said: It is very much important to learn new things (anything) as learning never ends…

社区洞察

其他会员也浏览了