Rakesh Jain Profile picture
Sep 25, 2021 β€’ 22 tweets β€’ 5 min read β€’ Read on X
What is CPU Load Average?

#Linux #DevOps #Compute

A thread πŸ‘‡
Load averages are the three numbers shown with the uptime and top commands - they look like this:

load average: 0.09, 0.05, 0.01 Image
The three numbers represent averages over progressively longer periods of time (one, five, and fifteen-minute averages), and that lower numbers are better. Higher numbers represent a problem or an overloaded machine.
But, what's the threshold?

What constitutes "good" and "bad" load average values?

When should you be concerned over a load average value, and when should you scramble to fix it ASAP?
First, a little background on what the load average values mean. We'll start out with the simplest case: a machine with one single-core processor.

The traffic analogy:
A single-core CPU is like a single lane of traffic.
Imagine you are a bridge operator. Sometimes your bridge is so busy there are cars lined up to cross. You want to let folks know how traffic is moving on your bridge. A decent metric would be how many cars are waiting at a particular time.
If no cars are waiting, incoming drivers know they can drive across right away. If cars are backed up, drivers know they're in for delays.

So, Bridge Operator, what numbering system are you going to use? How about:
0.00 means there's no traffic on the bridge at all. In fact, between 0.00 and 1.00 means there's no backup, and an arriving car will just go right on.

1.00 means the bridge is exactly at capacity. All is still good, but if traffic gets a little heavier, things are going to slow.
over 1.00 means there's backup. How much? Well, 2.00 means that there are two lanes worth of cars total -- one lane's worth on the bridge, and one lane's worth waiting. 3.00 means there are three lanes worth total -- one lane's worth on the bridge, and two lanes' worth waiting. Image
This is basically what CPU load is. "Cars" are processes using a slice of CPU time (crossing the bridge) or queued up to use d CPU. Unix refers this as the run-queue length: the sum of d number of processes that are currently running plus d number that are waiting (queued) to run
Like the bridge operator, you'd like your cars/processes to never be waiting. So, your CPU load should ideally stay below 1.00. Also, like the bridge operator, you are still ok if you get some temporary spikes above 1.00. but when you're consistently above 1.00, you need to worry
So you're saying the ideal load is 1.00?

Well, not exactly. The problem with a load of 1.00 is that you have no headroom. In practice, many sysadmins will draw a line at 0.70:
The "Need to Look into it" Rule of Thumb: 0.70 If your load average is staying above > 0.70, it's time to investigate before things get worse.
The "Fix this now" Rule of Thumb: 1.00. If your load average stays above 1.00, find the problem and fix it now. Otherwise, you're going to get woken up in the middle of the night, and it's not going to be fun.
Uff it's 3 AM WTF?" Rule of Thumb: 5.0- If your load average is above 5.00, you could be in serious trouble, your box is either hanging or slowing way down, and this will (inexplicably) happen in the worst possible time like in the middle of the night. Don't let it get there.
What about Multi-processors? My load says 3.00, but things are running fine!

Got a quad-processor system? It's still healthy with a load of 3.00.

On a multi-processor system, the load is relative to the number of processor cores available.
The "100% utilization" mark is 1.00 on a single-core system, 2.00, on a dual-core, 4.00 on a quad-core, etc.
If we go back to the bridge analogy, the "1.00" really means "one lane's worth of traffic". On a one-lane bridge, that means it's filled up. On a two-lane bridge, a load of 1.00 means it's at 50% capacity -- only one lane is full, so there's another whole lane that can be filled.
Multicore vs. multiprocessor

The "number of cores = max load" Rule of Thumb: on a multicore system, your load should not exceed the number of cores available.
The "cores is cores" Rule of Thumb: How the cores are spread out over CPUs doesn't matter. Two quad-cores == four dual-cores == eight single-cores. It's all eight cores for these purposes.
Which average should I be observing? One, five, or 15 minutes?

For the numbers we've talked about (1.00 = fix it now, etc), you should be looking at the five or 15-minute averages. Frankly, if your box spikes above 1.0 on the one-minute average, you're still fine.
So # of cores is important to interpreting load averages ... how do I know how many cores my system has?

cat /proc/cpuinfo to get info on each processor in your system.

To get just a count, run it through grep and word count:

grep 'model name' /proc/cpuinfo | wc -l

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Rakesh Jain

Rakesh Jain Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @devops_tech

Jul 18
Advanced Ansible Guide πŸ› οΈ

#Ansible #DevOps PS: https://e1.pxfuel.com/desktop-wallpaper/21/1012/desktop-wallpaper-how-to-install-and-setup-ansible-on-ubuntu-20-04-ansible.jpg
πŸ” Using Ansible Vault:

Encrypt sensitive data for enhanced security. Ansible Vault helps protect your secrets like passwords and API keys. πŸ›‘οΈ #Ansible #DevSecOps

Example:
ansible-vault encrypt_string 'my_secret_password' --name 'my_var'
⚑ Speed Up Playbooks:

Use asynchronous actions with async and poll. This allows long-running tasks to run in the background. #Ansible

Example: Image
Read 22 tweets
Jul 14
Ansible Guide!

Easy Understanding Concepts of Ansible for beginner! PS: https://developers.redhat.com/sites/default/files/Dev%20Spaces%20Ansible%20LP%20Featured%20image.png
1/20 🧡✨ Let's dive into Ansible, your friendly automation tool! Whether you're a beginner or just need a refresher, this thread is for you! πŸš€ #Ansible #DevOps
2/20 πŸ€” What is Ansible?

It's an open-source tool for IT automation, configuration management, and application deployment. No more repetitive tasks! πŸ”„ #Automation
Read 22 tweets
Jul 13
Terraform Guide!

Easy Understanding Concepts of Terraform for beginners πŸ‘‡ Ps: https://miro.medium.com/v2/resize:fit:1200/0*_cDhqi094nCleWqp.jpg
1️⃣ πŸŒπŸš€ Welcome to the ultimate Terraform guide for beginners! Let's dive into the world of Infrastructure as Code (IaC) and make your cloud deployments a breeze. #Terraform #DevOps
2️⃣ πŸ› οΈ What is Terraform?

Terraform is an open-source tool by HashiCorp that allows you to define and provision infrastructure using a simple, declarative configuration language. #Terraform #IaC
Read 22 tweets
Jul 11
Linux Guide!

A thread explaining Basic to Advanced Linux concept! PS: https://images5.alphacoders.com/118/thumb-1920-1186357.jpg
🧡 1/20: πŸš€ Welcome to Basic to Advanced Linux Concepts! Let's dive deeper into the powerful features and capabilities of Linux. #Linux #AdvancedLinux
🧡 2/20: πŸ› οΈ Kernel Modules:
Extend the functionality of the Linux kernel without rebooting. Use lsmod, modprobe, and rmmod to manage them. #KernelModules #LinuxKernel
Read 22 tweets
Jul 10
Docker Guide!

Easy Understanding Concepts of Docker 🐳

#docker #Containers PS: https://codesphere.ghost.io/content/images/2022/03/Getting-started-with-Docker.png
1/ 🐳 What is Docker?

Docker is a platform that allows you to package applications into containersβ€”standardized units that include everything needed to run the app: code, runtime, libraries, and dependencies.
2/ πŸ› οΈ Why Use Docker?

Docker ensures consistency across multiple development and release cycles and across various environments, making apps easier to develop, test, and deploy.
Read 21 tweets
Jul 9
Kubernetes Guide!

Easy Understanding Concepts of Kubernetes πŸ•ΈοΈ PS: https://wallpapercave.com/wp/wp10034193.png
1. Kubernetes Basics:
● Pods: Smallest deployable units in Kubernetes that can hold one or multiple containers.

● Nodes: Worker machines in Kubernetes.

● Clusters: A set of worker machines, called nodes, that run containerized applications.
● Kubectl: cmd line tool for interacting with a Kubernetes cluster

● Kubelet: An agent running on each node in the cluster

● API Server: Front-end to the cluster's control plane
Read 42 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(