Alok Pandey
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ## What is Load Average in Linux? Load average is a metric that Linux users use to measure the average number of threads that are running or waiting in a queue at a given time. This metric can help users understand how system resources are being used at that moment. The load average can be used to monitor the performance of a Linux system and to identify potential problems. It is a useful tool for system administrators and developers who need to keep an eye on the health of their systems. A low load average indicates that the system is not very busy, while a high load average indicates that the system is under heavy load. A load average that is consistently high can be a sign of a problem, such as a memory leak or a CPU-intensive process. ### Multiple Processors vs Multiple Cores There is a distinction in Linux load averages between multiple processors and multiple cores. Let us look at how each scenario affects load averages: **Multiprocessor System**: Each processor in a system that has multiple processors is treated as an independent entity. In this scenario, the load average reflects the average number of tasks operating or waiting for CPU time across all CPUs. The load average number represents the total workload of the system and its ability to handle the given load. For example, if you have a system with two processors and the load average is 2.0, it means that on average, there are two processes waiting for CPU time across the entire system. It indicates that the aggregate workload on both CPUs has reached its limit. **Multicore system**: The load average calculation remains the same in a system that has multiple cores within a single processor as it does in a system with a single processor. The load average is the total number of processes that are running or waiting for CPU time across all cores. Multiple cores and multiple processors differ from one another in terms of architecture and resource sharing. The load average considers the total workload on all the cores, providing an overall view of system performance. It reflects the combined demand for CPU resources across all cores, similar to a system with multiple processors. //CREATE IMAGE TAG ![](https://hackmd.io/_uploads/BJBHJpCF3.png) Here is a simpler explanation of how load averages are interpreted in Linux: **Load average less than 1.0:** This means that the system is not under much load. There are few processes that are ready to run, and the CPU is not being heavily utilized. **Load average equal to 1.0**: This means that the system is at its limit. There are as many processes that are ready to run as there are CPUs. The system is able to handle all of the current requests, but it will not be able to handle any new requests without slowing down. **Load average greater than 1.0**: This means that the system is under heavy load. There are more processes that are ready to run than there are CPUs. The system is not able to handle all of the current requests, and it will start to slow down. ## How to Check the Load Average in Linux? Monitoring the load average in Linux enables users to track performance and optimize the system resource utilization. There are multiple methods available for checking the load average in Linux, allowing users to assess the system workload effectively. We can use the following commands to check the Load Average in Linux. ### uptime Command The `uptime` command is a Linux utility that provides information about the system's current time, how long the system has been running, the number of users logged in, and the load average for the past 1, 5, and 15 minutes. It is a simple and convenient way to quickly check the system's load. To check the load average open terminal and write this command: ``` uptime ``` ![](https://hackmd.io/_uploads/rJiCUnRKn.png) ### top Command The `top (table of processes) ` command is a very useful tool for monitoring the performance of a Linux system. It provides a real-time view of the system's CPU usage, memory usage, and other resources. It can also display a list of the processes that are currently running and their resource usage. To check the load average open terminal and write this command: ``` top ``` ![](https://hackmd.io/_uploads/rJt0HhAFh.png) ### with cat command The `cat` command in Linux can be used to view the load average on a system. To print the load average in the first three columns using the `cat` command, access the /proc/loadavg file. Its contents contain the load average values. To check the load average open terminal and write this command: ``` cat /proc/loadavg ``` ![](https://hackmd.io/_uploads/H1FDShRF2.png) ### With the w command The `w` command displays information about the system's currently logged-in users and their associated processes. The header of the `w` command output displays the current time, system uptime, the number of users logged in, and the system load averages for the past 1, 5, and 15 minutes. To check the load average open terminal and write this command: ``` w ``` ![](https://hackmd.io/_uploads/Hk--U30K3.png) ### glances command Glances is a powerful system monitoring tool designed for Linux that offers a comprehensive overview of system resources. It serves a similar purpose as the `top` command, providing detailed information about various aspects of the system. It provides users with information on CPU consumption, memory utilisation, disc I/O, network traffic, and other critical data. It has an easy-to-use UI and real-time monitoring capabilities. Since glances does not come preloaded on Linux, use the following methods to install and run it ``` sudo apt install glances ``` ![](https://hackmd.io/_uploads/rJz3HhAYn.png) After the installation of the package completes, run: ``` glances ``` ![](https://hackmd.io/_uploads/Bke9r2RYn.png) ## How to Increase Load Average in Linux? A high load average often indicates that a system is under stress and may struggle to handle it properly. However, there are some situations where deliberately boosting the load average is desirable, such as during system stress tests. * **Increase the number of concurrent users**- This can be done by creating more user accounts or by using a load balancer to distribute traffic across multiple servers. * **Schedule more tasks to run automatically**- This can be done using a scheduler like cron. Cron is a built-in utility that allows you to schedule commands or scripts to run at specified intervals. * **Optimize code or run processes in parallel**- This can help to decrease the time each process takes to complete, which will increase the load average. * **Run more CPU-intensive tasks**- This can be done by running programs that perform mathematical calculations, encryption, or compression. * **Increase the number of threads a process uses to work**- This can be done by using a multithreaded application or by modifying a single-threaded application to use multiple threads. * **Increase the number of processes**- This can be done by running more applications or starting processes that use more resources. ## How to Decrease Load Average in Linux? To reduce the average load on a Linux system, first identify the source of the high load using monitoring tools such as `top`, `htop`, or `ps`. Once the source of the excessive load has been discovered, there are many options for reducing the load average: * **Upgrade your hardware**- If your system is not powerful enough to handle the load, you may need to upgrade your hardware. This may involve adding more RAM, getting a faster CPU, or adding more disks. * **Kill unnecessary processes**- If you have a bunch of unnecessary processes running in the background, you can kill them to free up CPU and memory resources. You can use the `ps` command to list all the running processes, and the `kill` command to terminate a process. * **Schedule tasks**- Utilize scheduling tools like cron, anacron, or at to schedule background tasks to run at specific times. This helps distribute the workload and prevent simultaneous execution of resource-intensive processes. * **Containerization**- Consider using containerization technologies like Docker or Kubernetes to isolate and manage processes. This can provide better resource allocation and control over the system's load. * **Limit concurrent users**- If feasible, restrict the number of concurrent users accessing the system or encourage users to utilize the system at different times. This helps spread out the workload and reduces the overall load average. * **Optimize disk I/O**-Improve the performance of disk I/O operations by implementing techniques like disk caching, optimizing file systems, or utilizing faster storage technologies such as solid-state drives (SSDs). ## Learn More [Linux Operating System](https://www.scaler.com/topics/linux-operating-system/) [File Permissions in Linux](https://www.scaler.com/topics/linux-tutorial/file-permissions-in-linux/) [Scheduling Tasks with the Cron Command on Linux](https://www.scaler.com/topics/linux-tutorial/cron-job-scheduling/) [Linux Containers (Docker, LXC)](https://www.scaler.com/topics/linux-tutorial/linux-containers/) [Linux Cron Cheat Sheet](https://www.scaler.com/topics/cron-job-in-linux/) ## Conclusion * Load average measures the average number of threads running or waiting in a queue at a given time. * Load average provides insights into how system resources are being utilized and helps monitor system performance. * A low load average suggests that the system is not heavily burdened, indicating efficient resource usage. * A high load average indicates a heavy workload and may imply potential performance issues or resource constraints. * Increasing the load average can be achieved through various methods, including increasing the number of concurrent users, scheduling more tasks to run automatically using a scheduler like cron, optimizing code or running processes in parallel, running more CPU-intensive tasks, increasing the number of threads a process uses, and increasing the number of processes. * To reduce the load average, it is crucial to identify the source of the high load using monitoring tools like `top`, `htop`, or `ps`. * Decreasing the load average can be achieved through various methods, including Upgrading your hardware, killing unnecessary processes, scheduling tasks, containerization, and Optimizing disk I/O. ## MCQ 1. What is Load Average in Linux? 1. The total number of processes running on a system. 1. The average CPU usage percentage. 1. The average number of processes waiting for CPU time. 1. The total memory usage on the system. Correct Answer: 3 1. Which of the following strategies can help reduce the Load Average in Linux? 1. Increase the number of concurrent users- 1. Run more CPU-intensive tasks 1. Increase the number of threads a process uses to work 1. Kill unnecessary processes Correct Answer: 4 1. Which of the following strategies can help increase the Load Average in Linux? 1. Limit concurrent users 1. Kill unnecessary processes 1. Optimize disk I/O 1. Increase the number of concurrent users Correct Answer: 4

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully