Operation and maintenance with this "nirvana", Linux performance tuning stability of!

"The system is very slow, and open a website, too card, and the response was not any!" I believe we have encountered this complaint, which is the application of system performance problems, needs tuning.

Performance tuning, the requirements of computer hardware, operating systems and applications have considerable depth understanding.

Regulate the relationship between the three, the whole system (hardware, operating system, application) to optimize performance, continue to meet current business needs.

Why is performance tuning?

In the final analysis on two reasons:

Better system performance

Meet growing business needs

By tuning, you can use less hardware resources to support a greater number of business development, so as to achieve the purpose of saving hardware investment.

Meanwhile, can the limited resources, the expansion of the situation can not improve the response capacity of the system, giving users a better experience.

Three tuning system

Let us focus during our performance optimization, hardware, operating system, applications, these three systems, some details need attention and specific optimization ideas:

Hardware optimization. Mainly for the selection of hardware, such as CPU, memory, disk, and network cards.

Operating system optimization. Mainly it contains the operating system parameters, kernel parameters, process parameters, file system, disk IO and so on.

Application optimization. Mainly it includes the application software optimization, such as: Apache, Nginx, Redis, MySQL, Keepalived, Kafka and so on.

The following describes the three major expansion system optimization.

Hardware optimization

Before a business on-line system, you first need to purchase hardware. Standard features of the hardware purchase is to run business systems and occupancy of resources.

For example one: if we are to a Redis cluster on line

Redis is a memory database, characterized by a very large memory footprint. Hardware resources when purchasing important consideration is the memory, the first memory is larger, the second memory resources to be scalable.

Redis on disk read and write and not very frequent, while disk space will not be much. Procurement disk, you can not require too much disk space, a common SAS disks can be.

Example II: If we want to on the line is a database system

Characteristics of the database system is consuming the CPU, the memory is also more cost, high data security requirements.

Whether you are using MySQL, SQL Server or Oralce, all you need to configure fast enough CPU, enough memory, enough stable and reliable hard drive, the hard drive needs to be done RAID, RAID10 best.

Operating system optimization

Between the operating system and the hardware application functions as a connecting role.

Related system parameters related to the priority of the efficient use of memory, IO call mechanism, the file system, process scheduling.

Linux-based operating system performance optimization, specific optimization includes the following aspects:

Operating system installation optimization

Tuning Process Management

Tuning memory resources

IO scheduler tuning

File system tuning

Tuning network transmission

The following figure shows the internal structure of Linux and mechanisms of assistance and hardware, is very important.

13534957-a66e349ee632545c

The bottom, is a hardware device (Hardware); cure is up to the program hardware (Firmware); followed by a device driver (Driver), is a specific form of software programs to interact with hardware devices.

Part of the operating system level, is the first system kernel (Kernel), the kernel is the basis of system operation system libraries, shared libraries, the library must file (Libraries).

The top layer is the application (Applications) running on the system that we installed in the system, various application software, such as MySQL, Samba, FTP and so on.

It can be seen, the operating system from the underlying hardware optimization is a software application to the upper, step by step process of optimization.

Application Optimization

The most intuitive performance is abnormal from the log and then comprehensive judgment optimization draw conclusions based on the log of strange.

The most easily overlooked is the code optimization, code for some performance issues entirely unreasonable. For example, for too many cycles, made a lot of unnecessary condition judgment, the same logic is repeated a plurality of times and the like.

After exclusion of the code level, we need to consider the architectural level, the level of configuration parameters and other aspects.

Tuning architecture includes separate read and write level, tuning means from the library multiple load balancing, horizontal and vertical sub-library sub-table, but also the connection pool tuning, excellent tone database parameters.

Finally, tune the MySQL database through a simple sum up what aspects need attention:

MySQL installation compiler optimization

MySQL configuration file optimization

MySQL storage engine optimization

Optimization table type (or the InnoDB MyISAM)

Query Cache Optimization

SQL statement optimization

Lock mechanism optimization

Optimization MySQL server (operating system parameters, storage disks such as SSD change)

See, performance tuning is really a big topic, just one aspect, there is a lot to be optimized content.

* Disclaimer: Content and images are from the network (part of the contents Edit), belongs to original author, as the source of information is incorrect or the rights, please contact us, or delete the authorization.

Reproduced in: https: //www.jianshu.com/p/d5298b9391c5

Guess you like

Origin blog.csdn.net/weixin_34007291/article/details/91307700