Linux system optimization ideas

  
 

LinuxOperating System
is an open source product and a practice and application platform for open source software. There are countless open source software support under this platform. Our common apache, tomcat, mysql, php, etc. The biggest idea of ​​open source software is freedom and openness. Then Linux as an open source platform, the ultimate realization is through the support of these open source software, to achieve the best performance at the lowest cost. Therefore, when it comes to performance issues, the main implementation is the best combination of Linux
operating system
and applications.

System performance refers to the effectiveness, stability, and responsiveness of the operating system to complete tasks. Linux system administrators may often encounter problems such as unstable system and slow response. For example, a web service is built on linux. It often happens that web pages cannot be opened and opened slowly. When encountering these problems, some people will Complaining that the Linux system is not good, in fact, these are superficial phenomena. When the operating system completes a task, it is closely related to the system's own settings, network topology, routing devices, routing policies, access devices, and physical lines. Any problem in one link will affect the performance of the entire system. Therefore, when there is a problem with the linux application, it should be comprehensively checked from the application, operating system, server hardware, network environment, etc., where the positioning problem occurs, and then centralized solution. In terms of applications, operating systems, server hardware, network environment, etc., the most influential performance is the application and operating system, because the problems in these two aspects are not easy to detect, and the concealment is very strong. As long as there are problems in the hardware and network, they can usually be located immediately. This chapter mainly explains the performance tuning of the operating system. The application requires specific problems to be treated.

General Ideas for Solving System Performance Problems The following describes the general ideas and methods for optimizing Linux from three aspects: factors affecting operating system performance, performance optimization tools, and system performance evaluation criteria.

Factors affecting Linux performance 1. CPUCPU is the fundamental operation of the operating system. The speed and performance of the CPU determine the overall performance of the system. Therefore, the more the number of CPUs and the higher the frequency, the better the server performance. But the truth is not entirely true. At present, most CPUs can only run one thread at a time. Hyper-threaded processors can run multiple threads at the same time. Therefore, you can use the hyper-threading feature of the processor to improve system performance. Under Linux, only SMP is running. The kernel can support hyperthreading, but the more CPUs are installed, the less performance gains from hyperthreading. In addition, the Linux kernel will recognize multi-core processors as multiple CPUs, such as two 4-core CPUs, which will recognize eight CPUs under Linux. However, from a performance point of view, the two 4-core CPUs and the eight single-core CPUs are not completely equivalent. According to the test conclusions drawn by the authoritative department, the overall performance of the former is 25%-30% lower than the latter. Applications that may have CPU bottlenecks include mail servers, dynamic web servers, etc. For such applications, the configuration and performance of the CPU should be placed at the main location. 2. The size of memory is also an important factor affecting Linux performance. Memory is too small, system processes will be blocked, applications will become slow, and even lose response, memory is too large, resulting in wasted resources. The Linux system adopts the concept of physical memory and virtual memory. Although virtual memory can alleviate the shortage of physical memory, but the excessive virtual memory, the performance of the application will be significantly reduced, to ensure the high-performance operation of the application, the physical memory must be It should be large enough, but too much physical memory will waste memory resources. For example, on a 32-bit processor Linux operating system, more than 8G of physical memory will be wasted. Therefore, to use more memory, it is recommended to install a 64-bit operating system, while turning on the large memory kernel support of Linux. Due to the limitation of the processor's addressing range, on a 32-bit Linux operating system, an application can only use up to 2G of memory per single processor. This way, even if the system has more memory, the application cannot use “ The solution is to use 64 as the processor, install 64-bit operating system, under 64-bit operating system, can meet the memory usage requirements of all applications [g1], almost no limit. Applications that may experience memory performance bottlenecks include print servers, database servers, static web servers, etc. For such applications, the memory size is placed at the primary location. 3. The I/O performance of disk I/O broadband disks directly affects the performance of the application. In an application with frequent reads and writes, if the disk I/O performance is not met, the application will be stalled. Fortunately, today's disks use a number of methods to improve I /O performance, such as common disk RAID technology. The full name of RAID in English is: Redundant Array of Independent Disks. Translation into Chinese is a redundant array of independent disks, referred to as a disk array. RAID provides a higher disk I/O performance and data redundancy than a single hard disk by combining multiple independent disks (physical hard disks) in different ways to form a disk group (logical hard disk). A disk group consisting of RAID technology is equivalent to a large hard disk. Users can format and format the file system, and create a file system. The only difference is the I/O performance ratio of the RAID disk group. A single hard drive is much higher, and the security of the data is greatly improved. Depending on the combination of disks, RAID can be divided into RAID0, RAID1, RAID2, RAID3, RAID4, RAID5, RAID6, RAID7, RAID0+1, and RAID10. Common RAID levels are RAID0, RAID1, RAID5, and RAID0+1. Here is a brief introduction: l RAID 0: Improve the performance and throughput of the disk by bonding multiple hard disks into a larger hard disk group. This method is low in cost and requires at least two disks, but it has no fault tolerance and data repair functions, so it can only be used in an environment where data security is not demanding. l RAID 1: is also a disk image. By mirroring the data of one disk to another disk, it can ensure the reliability and repairability of disk data to the greatest extent. It has high data redundancy, but the disk utilization is only 50%, therefore, the highest cost, used in the case of saving important data. l RAID5: Disk segmentation plus parity is used to improve system reliability. RAID5 has high readout efficiency and general write efficiency. It requires at least 3 disks. Allows a disk to fail without affecting the availability of data. l RAID0+1: Combining RAID0 and RAID1 technologies becomes RAID0+1, requiring at least 4 hard disks. In addition to being distributed across multiple disks, each disk has its own mirrored disk, providing full redundancy while allowing one disk failure without compromising data availability and fast read/write capabilities. Through the introduction of each RAID level, we can choose the RAID level that suits us according to the different characteristics of the application, so as to ensure the optimal performance of the application in terms of disk. 4. Network I/O Broadband Linux applications are generally network-based, so network bandwidth is also an important factor affecting performance. Low-speed, unstable networks will cause network application access blocking, and stable, high-speed. The bandwidth ensures that the application runs unimpeded on the network. Fortunately, today's networks are typically gigabit bandwidth, or fiber-optic networks, and the impact of bandwidth issues on application performance is steadily declining. 5. Summarizing through the above four aspects, it is not difficult to see that each aspect is interdependent, can not isolate the problem from a certain aspect, when there is a performance problem in one aspect, it often leads to other aspects problem. For example, a large number of disk read and write will inevitably consume CPU and I /O resources, and the lack of memory will lead to frequent memory page writes to disk, disk write to memory operations, resulting in disk I /O bottlenecks, while a large amount of network traffic It also causes CPU overload. Therefore, when dealing with performance issues, it is necessary to look at the overall situation and consider all aspects.

Copyright © Windows knowledge All Rights Reserved