In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "what is the relationship among CPU, memory and disk IO". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the relationship among CPU, memory and disk IO?"
I. interpretation of nouns
CPU: workers, workers, judgments, and logical processing.
Memory: workshop, where workers work, where raw materials are processed in the workshop. When there are no raw materials in the workshop, raw materials are taken from the warehouse and processed.
The memory itself has a certain storage space, and the speed of processing the data in the memory is much faster than that of fetching the data from the hard disk.
Hard disk: warehouse, raw materials, data storage.
Second, the relationship between the three
CPU judges and logically processes the data, and cannot store the data itself, so cpu can access the data from within for logical calculation. If there is no data in the memory, the data will be read from the hard disk to the memory, and then the data will be processed.
Just like people eat, cpu is people, memory is bowls, hard drives are rice pots!
When the cpu process waits, it will increase the memory overhead, and when the memory is insufficient, the virtual memory will be used, resulting in the increase of virtual memory, then the disk IO overhead will increase, the system mode sy% will increase, and the cpu overhead will increase; only when there is not enough data in memory will the data be fetched from the disk.
Third, high performance factors
1. What is the reason for the high CPU utilization of the system?
Frequent system interruptions and switches consume CPU, competition for shared resources, and a large number of io interactions. CPU is too poor, the dominant frequency is too low, are described as poor CPU.
Apple's system has always been single-threaded because it reduces the interruption and deceleration caused by multiple queue-jumping requests.
2. What is the reason for the high utilization of users' CPU?
Large amount of computation, such as operation, join query, data statistics
Non-idle wait, such as IO wait, resource contention (the same resource is requested by different threads, and this resource needs to be consistent, only the former can be released and the latter can be released.
Visit again, which leads to waiting)
If there are too many system calls, the system call will call the program interface provided by the operating system, such as logging in the Java project, and will call the system interface to write the log, so that
Will cause the system CPU utilization to be too high.
Too many interrupts, interrupts are the mechanism that CPU uses to respond to requests, such as keyboard input, mouse clicks, etc. will produce interrupts, interrupts are to inform CPU that a task is required
To respond, CPU stops the executing program to respond to the current interrupt
3. What is the reason for the tight memory?
Mostly excessive page swapping and memory leaks
Page swap: when there is not enough memory to store the needed data, the operating system releases (removes or saves to disk) some of the contents of the original memory, and then sets the
The process of loading content is called page swapping
4. What are the reasons for the high IO?
A large amount of reading and writing; the disk is too slow, or because the speed is slow, or the head is small, or the RAID model is not too OK (RAID has 0 1 5 10 100, etc., some can be used as storage disk, some can be used as backup disk)
When there is insufficient memory, the operating system will use virtual memory, and the swap area of the system must be used, such as LINUX's SWAP, which will result in more paging.
If you are the boss, how do you check the efficiency (performance) of wage earners? We usually use the following information to judge whether wage earners are lazy or not:
(1) how many tasks were accepted and completed by the wage earners and reported to the boss (interruption)
(2), the wage earners communicate with the boss and negotiate the progress of each work (context switch)
(3) are wage earners' work lists all full (runnable queue)
(4) how efficient the wage earners are, and whether they are lazy (CPU utilization)
Context switching, running queue and so on in the system
Context switching: each CPU (or each core of a multicore CPU) can only execute one thread at a time, and Linux uses preemptive scheduling.
When thread execution reaches a time slice, if the thread has IO blocking or a high priority thread to execute, Linux will perform the thread switch, saving the
The pre-thread executes the state (on-site) and restores the state of the thread to be executed, a process called context switching. In Java applications, file IO, network IO, lock waiting, line
The procedure Sleep operation causes the thread to block or sleep, triggering a context switch. Frequent context switching will cause the kernel to take up a high amount of CPU, making
Response speed slows down.
Run queue: each CPU core maintains a runnable queue, such as a 4-core CPU, starts 8 threads, and 8 threads are runnable, on average
In the case of allocation, there are 2 threads in the runnable queue of each core. Generally speaking, the load of the system is determined by the CPU run queue, assuming that the above state is maintained
After 1 minute, the system load is 2 within 1 minute. The higher the running queue value, the longer it takes for the thread to complete. It is usually recommended that each core run
The queue is 1-3.
Utilization: CPU utilization refers to the five percentages of user process, kernel, interrupt handling, IO wait and idle. These five values are used to analyze CPU consumption.
Key indicators of the situation. Linux System and NetWork Performent Monitoring recommends a process / kernel consumption ratio of 65%, 70% and 30%, respectively.
About 5%.
At this point, I believe you have a deeper understanding of "what is the relationship between CPU, memory, and disk IO". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.