uptime, load average, and # cpus


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers uptime, load average, and # cpus
# 1  
Old 10-30-2008
uptime, load average, and # cpus

I was told that there is a correspondance between the number of cpus, the load averages, and when the cpus reach 100% capacity.

I have 4 cpus and said that once the numbers hit 4.00, my CPUs are 100% at capacity. load average: 0.08, 0.09, 0.11

Is that correct?

Thank you
# 2  
Old 10-30-2008
Assuming single-core CPUs - yes.
# 3  
Old 10-31-2008
I disagree.
Load avg is calculated from various system parameters. the highest weight has the nr of processes in the kernel runqueue which indicates high cpu usage but can also be caused by iowait.
load avg of 4 in a 4 cpu machine gives you a breath hint that your system is on heavy load but you may also see loads of 12 and higher when your system is really overloaded. following your these this would meen each core is used by 300%.
Use sar if you want to do detailed diagnostics
# 4  
Old 10-31-2008
Well,
the OP asked:

Quote:
I have 4 cpus and said that once the numbers hit 4.00, my CPUs are 100% at capacity
As far as I recall (I may be missing something) load average gives only the number of processes receiving service
from the CPUs at any given time and the load factor is calculated as load avg/#CPUs and a load factor > 2
could indicate that the CPU may be a bottleneck.

Quote:
... high cpu usage but can also be caused by iowait
...

Quote:
Originally Posted by www.linuxjournal.com/article/9001
The state in question is CPU load—not to be confused with CPU percentage. In fact, it is precisely the CPU load that is measured, because load averages do not include any processes or threads waiting on I/O, networking, databases or anything else not demanding the CPU.
For more detailed explanation see this article.
I suppose that the above could be OS dependent.
# 5  
Old 10-31-2008
I agree with the disagreement. The load value is calculated by scanning the processing table and it includes running processes, processes waiting for a cpu, and processes waiting with a priority lower than PZERO. That final category includes processes waiting for "fast i/o" to complete and other processes expected to need a cpu very soon. A load of 2 or 3 is not generally not a deal big on a single cpu system and it would be unusual for that to result in a cpu running at 100%. That would mean that the cpu is the bottleneck. Usually disk is the bottleneck. On a multi-cpu system, I tend to find that a load of 2 or 3 times the number of cpu's is generally tolerable. But the extra processes are generally increasing the load on the disk bottleneck and so the system must be balanced... it needs the i/o bandwidth to handle the extra processes.

But each system is different too. You really need to evaluate your own system to see what's going on.
# 6  
Old 10-31-2008
I cannot personally comment if avg load includes I/O waits or not
(I was searching and reading on Internet) and I assume that
Perderabo gave the correct answer.
I also believe that I misread the following statement: CPUs are 100% at capacity.
I wanted to point out that a load factor of 1 means the CPU(s) is/are not overloaded and
is/are running at capacity (my misunderstanding of the english expression, I suppose).
And that a load factor between 1 and 2 it should be generally OK,
as far as the CPU capacity is concerned, and that more than 2
could indicate overloading (i.e. there are processes in runnable state).

P.S. Yet another reason not to post when the answer should include more than oneline Smilie

Last edited by radoulov; 10-31-2008 at 01:06 PM..
# 7  
Old 11-01-2008
The load average is a statistic invented at BSD and the concept has migrated from there to most versions of unix pretty much intact. Linux was a complete reimplementation and I too find conflicting information in various Linux articles on the Internet. So I read the kernel source code to get a straight answer. The statistic is calculated in the module called timer.c This excerpt is relevant:
Code:
/*
 * Nr of active tasks - counted in fixed-point numbers
 */
static unsigned long count_active_tasks(void)
{
	struct task_struct *p;
	unsigned long nr = 0;

	read_lock(&tasklist_lock);
	for_each_task(p) {
		if ((p->state == TASK_RUNNING ||
		     (p->state & TASK_UNINTERRUPTIBLE)))
			nr += FIXED_1;
	}
	read_unlock(&tasklist_lock);
	return nr;
}

/*
 * Hmm.. Changed this, as the GNU make sources (load.c) seems to
 * imply that avenrun[] is the standard name for this kind of thing.
 * Nothing else seems to be standardized: the fractional size etc
 * all seem to differ on different machines.
 */
unsigned long avenrun[3];

static inline void calc_load(unsigned long ticks)
{
	unsigned long active_tasks; /* fixed-point */
	static int count = LOAD_FREQ;

	count -= ticks;
	if (count < 0) {
		count += LOAD_FREQ;
		active_tasks = count_active_tasks();
		CALC_LOAD(avenrun[0], EXP_1, active_tasks);
		CALC_LOAD(avenrun[1], EXP_5, active_tasks);
		CALC_LOAD(avenrun[2], EXP_15, active_tasks);
	}
}

So a task is counted if it is in the states:
TASK_UNINTERRUPTIBLE
TASK_RUNNING

TASK_UNINTERRUPTIBLE is the exact equivalent of sleeping with a priority lower than PZERO and this does indeed include all "fast I/O". TASK_RUNNING does not mean it currently has a CPU, rather it like the Unix run queue. So even in Linux, the "load" is a count of processes that need CPU now or very soon.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Load average unit

Hi, On load average graph, unit is 100m, 200m, 300...800m. I don't understand what it means. Thx for helping (3 Replies)
Discussion started by: Michenux
3 Replies

2. UNIX for Dummies Questions & Answers

Help with load average?

how load average is calculated and what exactly is it difference between cpu% and load average (9 Replies)
Discussion started by: robo
9 Replies

3. Solaris

Load Average and Lwps

NPROC USERNAME SWAP RSS MEMORY TIME CPU 320 oracle 23G 22G 69% 582:55:11 85% 47 root 148M 101M 0.3% 99:29:40 0.3% 53 rafmsdb 38M 60M 0.2% 0:46:17 0.1% 1 smmsp 1296K 5440K 0.0% 0:00:08 0.0% 7 daemon ... (2 Replies)
Discussion started by: snjksh
2 Replies

4. UNIX for Advanced & Expert Users

Load average in UNIX

Hi , I am using 48 CPU sunOS server at my work. The application has facility to check the current load average before starting a new process to control the load. Right now it is configured as 48. So it does mean that each CPU can take maximum one proces and no processe is waiting. ... (2 Replies)
Discussion started by: kumaran_5555
2 Replies

5. Shell Programming and Scripting

Extracting load average from uptime command

The output ofthe uptime command gives: 9:40am up 9 days, 10:36, 4 users, load average: 0.02, 0.01, 0.00 How can i extract the portion "load average: 0.02, 0.01, 0.00". (3 Replies)
Discussion started by: proactiveaditya
3 Replies

6. HP-UX

why uptime display "load average: inf, inf, inf"

Hi, Does anyone seem this kind of output from uptime and top where "load average: inf, inf, inf" is this possible problem with the processor? Cpu states: CPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS 0 0.10 5.4% 0.0% 4.0% 90.6% 0.0% 0.0% 0.0% 0.0%... (1 Reply)
Discussion started by: robertngo
1 Replies

7. UNIX for Dummies Questions & Answers

Please Help me in my load average

Hello AlL,.. I want from experts to help me as my load average is increased and i dont know where is the problem !! this is my top result : root@a4s # top top - 11:30:38 up 40 min, 1 user, load average: 3.06, 2.49, 4.66 Mem: 8168788k total, 2889596k used, 5279192k free, 47792k... (3 Replies)
Discussion started by: black-code
3 Replies

8. Solaris

load average query.

Hi, i have installed solaris 10 on t-5120 sparc enterprise. I am little surprised to see load average of 2 or around on this OS. when checked with ps command following process is using highest CPU. looks like it is running for long time and does not want to stop, but I do not know... (5 Replies)
Discussion started by: upengan78
5 Replies

9. UNIX for Dummies Questions & Answers

Load Average

Hello all, I have a question about load averages. I've read the man pages for the uptime and w command for two or three different flavors of Unix (Red Hat, Tru64, Solaris). All of them agree that in the output of the 2 aforementioned commands, you are given the load average for the box, but... (3 Replies)
Discussion started by: Heathe_Kyle
3 Replies

10. UNIX for Advanced & Expert Users

load average

we have an unix system which has load average normally about 20. but while i am running a particular unix batch which performs heavy operations on filesystem and database average load reduces to 15. how can we explain this situation? while running that batch idle cpu time is about %60-65... (0 Replies)
Discussion started by: gfhgfnhhn
0 Replies
Login or Register to Ask a Question