Disclaimer

Sunday, 24 November 2024

Understand Load Average in Linux

 

top - 17:46:47 up 45 min,  1 user,  load average: 5.46, 18.73, 34.34
Tasks: 465 total,   5 running, 459 sleeping,   0 stopped,   1 zombie
%Cpu(s): 60.3 us,  6.0 sy,  0.0 ni, 31.3 id,  0.2 wa,  1.8 hi,  0.4 si,  0.0 st
MiB Mem :  13413.7 total,   3252.9 free,   4580.3 used,   5580.5 buff/cache
MiB Swap:  47680.0 total,  47489.2 free,    190.8 used.   5660.3 avail Mem

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
  52764 grid      20   0 4860708 576112  17268 S 114.6   4.2   0:09.50 java
   1396 root      20   0  636688  11360   9236 S  15.0   0.1   0:50.59 vmtoolsd
  14675 oracle    20   0 2486392 153564 143928 S   2.3   1.1   0:42.34 ora_svcb_orcl2
   8214 root     -30   0 1231232 182336 113352 S   2.0   1.3   1:42.77 osysmond.bin
   7069 grid      20   0  972568  74028  32364 R   1.0   0.5   0:24.10 gipcd.bin
   8316 grid      rt   0 1273368 266368 118976 S   0.7   1.9   0:56.86 ocssd.bin
   9709 root      20   0 1446240 132988  89968 S   0.7   1.0   0:26.40 orarootagent.bin




The top command provides insights into system performance. 


Understanding the load average Values

The load average values indicate the system's workload over three time intervals (1 minute, 5 minutes, and 15 minutes):

  • 5.46: Average number of processes waiting for CPU or I/O in the last 1 minute.
  • 18.73: Average load over the last 5 minutes.
  • 34.34: Average load over the last 15 minutes.


How to Interpret These Values

  • Load average represents the number of tasks (processes) waiting to run on the system.
  • A load value equal to the number of CPU cores indicates the system is fully utilized.
  • Example:
    • If the system has 4 CPU cores, a load average of 4.0 means it's fully utilized.
    • In this case, the load average of 5.46, 18.73, and 34.34 suggests:
      • 1 minute (5.46): Slightly overloaded if the system has fewer than 6 cores.
      • 5 minutes (18.73) and 15 minutes (34.34): The system has been significantly overloaded recently.




%CPU (114.6%)

  • This value shows how much CPU time a process is consuming, relative to the total available CPU capacity.
  • Modern CPUs have multiple cores, so a %CPU value greater than 100% indicates that the process is using more than one core.
    • Example: If the system has 4 CPU cores, the total possible CPU usage is 400%.
    • Process (PID 52764):
      • The java process is using 114.6% CPU, which means it is utilizing more than one core.

What to Understand:

  • The java process is CPU-intensive and could be a potential bottleneck if the load is high or system responsiveness is affected.
  • High CPU usage like this is common for processes like JVM (Java Virtual Machine), especially in application servers or database-related operations.




What Should You Check?

  1. Load Average:

    • If the load is significantly higher than the number of cores (e.g., load > 8 on a 4-core system), you need to investigate:
      • CPU-intensive processes (e.g., the java process here).
      • I/O bottlenecks causing processes to queue.
    • To check the number of cores, run:
      lscpu
  2. High CPU Usage:

    • Investigate why the java process is consuming so much CPU:
      • Check its logs or application behavior.
      • Monitor for infinite loops or resource-intensive operations.
  3. Disk I/O:

    • If the load average is high but CPU usage is moderate, it might indicate disk I/O bottlenecks.
    • Check I/O stats using:
      iostat -x
  4. Memory:

    • Ensure there's enough free memory. If not, high swapping might also contribute to the load.





Summary

  • Load average shows how busy the system is over time. Compare it to the number of CPU cores.
  • %CPU > 100% means a process is utilizing more than one CPU core.
  • Investigate processes causing high CPU or I/O load, such as the java process in this case.



No comments:

Post a Comment

How to recovery PDB when PDB database is dropped in Oracle

  How to recovery PDB when PDB database is dropped :) [oracle@rac01 ~]$ sqlplus '/as sysdba' SQL*Plus: Release 21.0.0.0.0 - Product...