Load (computing)
   HOME

TheInfoList



OR:

In
UNIX Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, hardware and softw ...
, the system load is a measure of the amount of computational work that a computer system performs. The load average represents the average system load over a period of time. It conventionally appears in the form of three numbers which represent the system load during the last one-, five-, and fifteen-minute periods.


Unix-style load calculation

All Unix and Unix-like systems generate a dimensionless
metric Metric or metrical may refer to: Measuring * Metric system, an internationally adopted decimal system of measurement * An adjective indicating relation to measurement in general, or a noun describing a specific type of measurement Mathematics ...
of three "load average" numbers in the kernel. Users can easily query the current result from a
Unix shell A Unix shell is a Command-line_interface#Command-line_interpreter, command-line interpreter or shell (computing), shell that provides a command line user interface for Unix-like operating systems. The shell is both an interactive command languag ...
by running the
uptime Uptime is a Measurement, measure of system reliability, expressed as the period of system time, time a machine, typically a computer, has been continuously working and available. Uptime is the opposite of downtime. It is often used as a measure ...
command: $ uptime 14:34:03 up 10:43, 4 users, load average: 0.06, 0.11, 0.09 The w and top commands show the same three load average numbers, as do a range of
graphical user interface A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
utilities. In operating systems based on the
Linux kernel The Linux kernel is a Free and open-source software, free and open source Unix-like kernel (operating system), kernel that is used in many computer systems worldwide. The kernel was created by Linus Torvalds in 1991 and was soon adopted as the k ...
, this information can be easily accessed by reading the /proc/loadavg file. To explore this kind of information in depth, according to the Linux's
Filesystem Hierarchy Standard The Filesystem Hierarchy Standard (FHS) is a reference describing the conventions used for the layout of Unix-like systems. It has been made popular by its use in Linux distributions, but it is used by other Unix-like systems as well. It is main ...
, architecture-dependent information are exposed on the file /proc/stat. An idle computer has a load number of 0 (the idle process is not counted). Each
process A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic. Things called a process include: Business and management * Business process, activities that produce a specific s ...
using or waiting for CPU (the ''ready queue'' or run queue) increments the load number by 1. Each process that terminates decrements it by 1. Most UNIX systems count only processes in the ''running'' (on CPU) or ''runnable'' (waiting for CPU)
states State most commonly refers to: * State (polity), a centralized political organization that regulates law and society within a territory **Sovereign state, a sovereign polity in international law, commonly referred to as a country **Nation state, a ...
. However, Linux also includes processes in uninterruptible sleep states (usually waiting for disk activity), which can lead to markedly different results if many processes remain blocked in I/O due to a busy or stalled I/O system. This, for example, includes processes blocking due to an NFS server failure or too slow
media Media may refer to: Communication * Means of communication, tools and channels used to deliver information or data ** Advertising media, various media, content, buying and placement for advertising ** Interactive media, media that is inter ...
(e.g.,
USB Universal Serial Bus (USB) is an industry standard, developed by USB Implementers Forum (USB-IF), for digital data transmission and power delivery between many types of electronics. It specifies the architecture, in particular the physical ...
1.x storage devices). Such circumstances can result in an elevated load average, which does not reflect an actual increase in CPU use (but still gives an idea of how long users have to wait). Systems calculate the load ''average'' as the exponentially damped/weighted moving average of the load ''number''. The three values of load average refer to the past one, five, and fifteen minutes of system operation. Mathematically speaking, all three values always average all the system load since the system started up. They all decay exponentially, but they decay at different ''speeds'': they decay exponentially by ''e'' after 1, 5, and 15 minutes respectively. Hence, the 1-minute load average consists of 63% (more precisely: 1 - 1/''e'') of the load from the last minute and 37% (1/''e'') of the average load since start up, excluding the last minute. For the 5- and 15-minute load averages, the same 63%/37% ratio is computed over 5 minutes and 15 minutes, respectively. Therefore, it is not technically accurate that the 1-minute load average only includes the last 60 seconds of activity, as it includes 37% of the activity from the past, but it is correct to state that it includes ''mostly'' the last minute.


Interpretation

For single-CPU systems that are
CPU bound A central processing unit (CPU), also called a central processor, main processor, or just processor, is the primary Processor (computing), processor in a given computer. Its electronic circuitry executes Instruction (computing), instructions ...
, one can think of load average as a measure of system utilization during the respective time period. For systems with multiple CPUs, one must divide the load by the number of processors in order to get a comparable measure. For example, one can interpret a load average of "1.73 0.60 7.98" on a single-CPU system as: * During the last minute, the system was overloaded by 73% on average (1.73 runnable processes, so that 0.73 processes had to wait for a turn for a single CPU system on average). * During the last 5 minutes, the CPU was idling 40% of the time, on average. * During the last 15 minutes, the system was overloaded 698% on average (7.98 runnable processes, so that 6.98 processes had to wait for a turn for a single CPU system on average). This means that this system (CPU, disk, memory, etc.) could have handled all the work scheduled for the last minute if it were 1.73 times as fast. In a system with four CPUs, a load average of 3.73 would indicate that there were, on average, 3.73 processes ready to run, and each one could be scheduled into a CPU. On modern UNIX systems, the treatment of threading with respect to load averages varies. Some systems treat threads as processes for the purposes of load average calculation: each thread waiting to run will add 1 to the load. However, other systems, especially systems implementing so-called M:N threading, use different strategies such as counting the process exactly once for the purpose of load (regardless of the number of threads), or counting only threads currently exposed by the user-thread scheduler to the kernel, which may depend on the level of concurrency set on the process. Linux appears to count each thread separately as adding 1 to the load.


CPU load vis-à-vis CPU utilization

The comparative study of different load indices carried out by Ferrari et al.Ferrari, Domenico; and Zhou, Songnian;
An Empirical Investigation of Load Indices For Load Balancing Applications
, Proceedings of Performance '87, the 12th International Symposium on Computer Performance Modeling, Measurement, and Evaluation, North Holland Publishers, Amsterdam, the Netherlands, 1988, pp. 515–528
reported that CPU load information based upon the CPU queue length does much better in load balancing compared to CPU utilization. The reason CPU queue length did better is probably because when a host is heavily loaded, its CPU utilization is likely to be close to 100%, and it is unable to reflect the exact load level of the utilization. In contrast, CPU queue lengths can directly reflect the amount of load on a CPU. As an example, two systems, one with 3 and the other with 6 processes in the queue, are both very likely to have utilizations close to 100%, although they obviously differ.


Reckoning CPU load

On Linux systems, the load-average is not calculated on each clock tick, but driven by a variable value that is based on the HZ frequency setting and tested on each clock tick. This setting defines the kernel clock tick rate in
hertz The hertz (symbol: Hz) is the unit of frequency in the International System of Units (SI), often described as being equivalent to one event (or Cycle per second, cycle) per second. The hertz is an SI derived unit whose formal expression in ter ...
(times per second), and it defaults to 100 for 10 ms ticks. Kernel activities use this number of ticks to time themselves. Specifically, the timer.c::calc_load() function, which calculates the load average, runs every ticks, or about every five seconds: unsigned long avenrun static inline void calc_load(unsigned long ticks) The avenrun array contains 1-minute, 5-minute and 15-minute average. The macro and its associated values are defined in sched.h: #define FSHIFT 11 /* nr of bits of precision */ #define FIXED_1 (1<>= FSHIFT; The "sampled" calculation of load averages is a somewhat common behavior; FreeBSD, too, only refreshes the value every five seconds. The interval is usually taken to not be exact so that they do not collect processes that are scheduled to fire at a certain moment. A post on the Linux mailing list considers its tick insufficient to avoid Moiré artifacts from such collection, and suggests an interval of 4.61 seconds instead. This change is common among Android system kernels, although the exact expression used assumes an HZ of 100.


Other system performance commands

Other commands for assessing system performance include: *
uptime Uptime is a Measurement, measure of system reliability, expressed as the period of system time, time a machine, typically a computer, has been continuously working and available. Uptime is the opposite of downtime. It is often used as a measure ...
the system reliability and load average *
top Top most commonly refers to: * Top, a basic term of orientation, distinguished from bottom, front, back, and sides * Spinning top, a ubiquitous traditional toy * Top (clothing), clothing designed to be worn over the torso * Mountain top, a moun ...
for an overall system view * vmstat vmstat reports information about runnable or blocked processes, memory, paging, block I/O, traps, and CPU. *
htop htop is an interactive system monitor process viewer and process manager. It is designed as an alternative to the Unix program top (software), top. It shows a frequently updated list of the processes running on a computer, normally ordered by t ...
interactive process viewer * dool (formerly dstat), atop helps correlate all existing resource data for processes, memory, paging, block I/O, traps, and CPU activity. *
iftop Iftop is a free software command-line system monitor tool developed by Paul Warren. It produces a real-time stream of incoming and outgoing network communications from the operating system iftop is running within. By default, the connections are ...
interactive network traffic viewer per interface * nethogs interactive network traffic viewer per process * iotop interactive I/O viewer * iostat for storage I/O statistics *
netstat In computing, netstat is a command-line network utility that displays open network sockets, routing tables, and a number of network interface (network interface controller or software-defined network interface) and network protocol statistic ...
for network statistics * mpstat for CPU statistics * tload load average graph for terminal * xload load average graph for X * /proc/loadavg text file containing load average


See also

* CPU usage


References


External links

* * * Explanation using an illustrated traffic analogy. * * {{cite web , author = Karsten Becker , title = Linux OSS load monitoring toolset , url = http://www.loadavg.com , publisher = LoadAvg Operating system technology Articles with example C code