• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • Life always offers you a second chance ... Its called tomorrow !!!

    Saturday, June 07, 2014

    Understanding Load Average in Linux and when to be worried about it?

    The one of the most important task of any Linux Admin includes performance monitoring which includes a parameter "Load Average" or "CPU Load".

    Load Average is the value which represents the load on your system for a specific period of time. Also it can be considered the ratio of the number of active tasks to the number of available CPUs.

    How to check?

    You can use either top or uptime command to view the load average. The output would look like as shown below
    $ uptime
     00:07:00 up 4 days,  6:14,  1 user,  
    load average: 0.11, 0.14, 0.09

    $ top
    top - 00:07:12 up 4 days,  6:15,  1 user,  load average: 0.09, 0.13, 0.09

    What are the three values?

    As you can see three values representing the load average column. These show the load on your system over a significant period of time (one or current, five and fifteen minutes averages).

    How do you know your system has a high load?

    The most important question as in most cases I have seen how do you determine your system has high load.
    Does a high value represents high load average and that your system requires atention?
    What is the threshold value for load average?
    How can we conclude if the load average value is good or bad?

    Before I answer these question first let us understand about multi core and multi processor CPU.

    A Central Processing Unit in earlier days used to be having only one processor and the core concept was not their in those days. But with the advancement in technology and the urge of higher speed to meet up demands of IT industry multiple processor were integrated in the same CPU making it multi-processor.

    However increasing the no. of processor did increased the working speed of many tasks and performance but it also leads to increase in size, complexity and heat issues. So, in order to continue improvement of performance the core concept was introduced.

    Instead of having two CPUs and a motherboard capable of hosting them, two CPUS are taken together and combined to form a dual core processor which will utilize an individual socket using less power and size capable of performing the same amount of task as dual processor CPU.

    Bottom Line is that Load value depends on the no. of cores in your machine. For example a dual core is relevant to 2 processor or 2 cores and quad core is relevant to 4 processor or four cores as the maximum value for load.

    How do I check the no. of cores on my Linux system?

    The information which you see under /proc/cpuinfo can be confusing at times. If you run the below command
    $ less /proc/cpuinfo | grep processor
    processor       : 0
    processor       : 1
    processor       : 2
    processor       : 3
    processor       : 4
    processor       : 5
    processor       : 6
    processor       : 7
    processor       : 8
    processor       : 9
    processor       : 10
    processor       : 11
    processor       : 12
    processor       : 13
    processor       : 14
    processor       : 15

    So as per the above command my system has 16 processors in it. However it really has 8 processors with hyper threading enabled. The hyper threading presents 2 logical CPUs to the operating system for each actual core so it effectively doubles the no. of logical CPU in your system

    How to find if hyper threading is enabled
    Look out for "ht" in the flags section inside cpuinfo with the below command
    $ less /proc/cpuinfo | grep flags | uniq | grep -i  "ht"
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss
    ht tm syscall nx rdtscp lm constant_tsc nonstop_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm

    Next let us continue on the calculation of no. of core

    The fields we need to compare to find the no. of core are "physical id" and "core id". Run the below command
    $ less /proc/cpuinfo | grep "physical id" | sort|uniq | wc -l

    $ less /proc/cpuinfo | grep "core id" | sort|uniq | wc -l

    So the no. of cores would be 2x4 = 8 cores

    Coming back to our primary question

    Understanding Load Average

    If the number of active tasks utilizing CPU is less as compared to available CPU cores then the load average can be considered normal but if the no. of active tasks starts increasing with respect to available CPU cores then the load average will start rising.

    For example in my case I can see
    $ uptime
     00:43:58 up 212 days, 14:19,  4 users,  load average: 6.07, 7.08, 8.07

    So as per the no. of cores I calculated i.e 8 cores and seeing the value 6.07 I shouldn't be worried much unless it crosses the red line value i.e. 8 for my case.

    I hope I made myself clear.

    Related Articles
    Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
    9 examples to help you understand top command usage in Unix/Linux
    15 tips to enhance security of your Linux machine
    How to check all the currently running services in Linux

    Follow the below links for more tutorials

    How to secure boot loader (grub menu) with password in RHEL 6
    How to check last login time for users in Linux
    What is the difference/comparison between Unix and Linux ?
    RAID levels 0, 1, 2, 3, 4, 5, 6, 0+1, 1+0 features explained in detail
    Step by Step Linux Boot Process Explained In Detail
    What is GRUB Boot Loader ?
    Why is Linux more secure than windows and any other OS
    What is the difference between "su" and "su -" in Linux?
    What is kernel-PAE in Linux?
    What is swappiness and how do we change its value?
    How to secure Apache web server in Linux using password (.htaccess)
    How to register Red Hat Linux with RHN (Red Hat Network )
    How to do Ethernet/NIC bonding/teaming in Red Hat Linux
    How to install/uninstall/upgrade rpm package with/without dependencies
    What is the difference between ext3 and ext4 filesystem in Linux ?


    1. In the section "How do I check the no. of cores on my Linux system?" we can also check the cpu cores by using "top" command and Press 1 (one), when the top command is running, which will break the CPU down and show details for all the individual CPUs running on the system.

      1. Hello Dipanjan,

        As what you are saying is about the logical CPU which can not be mistaken with no of core your system has. As explained in my calculation above the logical CPU or processor is calculated as

        2 (physical ID) x 4 (core-id) x 2 (hyper threading) = 16 processors

        From what I wrote above
        The hyper threading presents 2 logical CPUs to the operating system for each actual core so it effectively doubles the no. of logical CPU in your system

        # less /proc/cpuinfo | grep "cpu cores" | uniq
        cpu cores : 4

        With ht enabled it becomes 4 x 2 = 8 cores

        I hope I make sense.

      2. Hyperthreading does not magically give you more physical cores. It does NOT effectively double the number of logical cores on your system.

        Hyperthreading is nice because it does reduce the cost of switching processes on a core, but it cannot reduce that cost to 0. A hyperthreaded core will perform better than a single core, but not nearly as fast as 2 physically separate cores.

        Here is a good article explaining how much of a performance boost you might be able to expect: http://www.dasher.com/blog/will-hyper-threading-improve-processing-performance/

      3. I agree with you it just gives an impression to the running processes of doubling the physical processor creating logical processors the same way we use virtual CPUs in VMware with a single core CPU server.

        Since the article was about Load Average so I skipped explaining much for hyper threading but thanks for the info.

      4. Just exicute top command and press 1 so now you can see the number of cores

    2. Easily understandable..thanx