Reproduced Unix/linux's Load primary explanation

Source: Internet
Author: User

Original link: http://dbanotes.net/arch/unix_linux_load.html

Unix/linux's Load primary explanation

Almost every engineer on a Unix-like operating system knows how to view the system load. But the work mechanism of this thing is exactly how, probably not much can say clearly. Compare some of the relevant information, add your own understanding, make notes.

What is Load? What is Load Average?

Load is a measure of how much a computer is working (wikipedia:the system load is a measure of the amount of work, a computer system is doing). It is also simple to say the length of the process queue. Load Average is the average load over a period of time (1 minutes, 5 minutes, 15 minutes). "Best reference article: Unix®load Average part 1:how It Works"

Here is a uptime command output:

$ uptime
18:57:48 up 423 days, 3:55, 2 users, load average:1.16, 1.12, 1.20

Although the definitions of various sources of information are uncertain. One thing you can be sure of is that you can't get the Load of the current time accurately . The minimum computational granularity is 5 seconds (calc_load per 5HZ, 5HZ for 5 seconds, where HZ is a system-defined variable). See the Linux Kernel code:

869        Count-= ticks;870        if (unlikely (count < 0)) {871                active_tasks = Count_active_tasks (); 872 do                {873                        
874 Calc_load (avenrun[1], exp_5, active_tasks);
875 calc_load (avenrun[2], exp_15, active_tasks);
876 Count + = load_freq;877 } while (count < 0); 878

How can I tell if the system has over Load?

For the general system, according to the number of CPUs to judge, as the above example, if the average load is always under 1.2, and you are 2 CPU machine. There is not enough CPU usage. That is, Load averages less than the number of CPUs.

This is the recommended evaluation method for Solaris performance and tools (Solaris performance Tools). "I would recommend this book here, although the Load is not as detailed as I expected." But the book reveals a lot of performance information. A required book for each DBA, architect. 】

That actually brings two other questions:

1 If it is multi-core CPU/Hyper-Threading machine How to judge? For such machines, my advice is to see how the operating system recognizes the CPU, judging by the number of logical CPUs identified by the system. If you want to consider performance factors, it is recommended that you refer to Oracle's charges for multi-core CPUs under different architectures.

2 If the application is thread-oriented how to judge? This is actually related to the M:N threading model. What's your system like? Take this question into consideration.

In most cases, high Load is not necessarily related to CPU. One exception, perhaps, is the problem with the application scenario . For example, a single CPU machine to do high concurrent Web server, the trouble is coming

Load and capacity planning (capacity planning)

Any relatively mature site will use tools such as CACTI (RRDtool-based) for capacity planning. The crawled Load will pass the 1, 5, 15-minute column values past, which of the three measures is used? 15 minutes is preferred "see Gunther PPT".

Load and System alerts

Many environments with high availability requirements have a mail or SMS alert mechanism in place. There are also times when the Load alarm threshold has been developed. It is recommended here that the Critical value (if you know what this is by using Nagios tools like this) is capped at the number of physical CPUs (of course you can set it lower than this). But higher than this value, the meaning is not much. For example, the database server has 4 CPUs, then Load above 4 should alarm out, set than 4 high may not mean much, because the alarm and the response time of the person ...

Misunderstanding one: The system Load high must be a performance problem.

Truth: The system Load is also probably due to CPU-intensive computations (such as compiling)

Misunderstanding two: System Load high must be CPU capacity problem or insufficient quantity.

The truth: Load High simply means that the queue that needs to run accumulates too much. But the tasks in the queue may actually be CPU-intensive or I/O or even other factors.

Misunderstanding three: The system long-term Load high, preferred to increase the CPU.

The truth: Load is just an appearance, not a substance. Additional CPU will temporarily see the system Load drop, but the symptoms do not cure.

A little Load is actually a lot of stress. English information is actually more complete, try to make sure to add a little new information to this article. If you see any unreasonable place or objection, please correct or advise.

--eof--

FAQs1: Database server suddenly CPU 100% busy, what to do?

A: In general, this is caused by bad SQL. It is recommended to crawl Slow Query Log for SQL optimized for large I/O overhead (focus on full table scan). Based on experience, each CPU Core can process 100-400MB data in one second. If there is a large amount of concurrent I/O operations, the CPU may be "stuffed" even though the throughput of the storage may not be that large.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.