Linux Performance Tuning combat

Have you ever like me, read a lot, learned a lot of Linux performance tools, but in the face of Linux performance issues, or do nothing? In fact, performance analysis and optimization has always been a sore point for most software engineers. However, the face of difficulties, we really have no solution yet?

Of course, the complexity of the performance problems increase the learning curve, but this can not be our advanced road "stumbling block." In my opinion, most people performance problems "surrender", probably only two.

One is you do not find an effective way to learn the principles, heard the "system", "bottom" these words will timid, that he must not learn things too hard, naturally can not go in-depth study, and thus can not establish performance the view of the situation.

Another is that you see the root cause of performance problems are too complex, not only do not know how to analyze, identify bottlenecks can not unraveling.

You might be thinking, anyway, the program is a problem, it wants to search the Internet, using other people's methods, gulping try more than once, it is possible to solve. So, why did you bother to get to the bottom of these methods effectively, but do not know why, many ways in someone else's environment effectively, to you here to die.

So, committing the same error is repeated, the same situation is repeated.

In fact, performance problems and you do not have to imagine that hard, as long as you understand a few basic principles of a small number of applications and systems, and then a large number of practical exercises, to establish a global view of the overall performance, optimization of performance problems will most matter of course.

I have seen many engineers, in the performance of third-party components used in analytical applications, these components are not familiar with programming languages, but still can analyze the root causes of the problem on the line, and through a number of methods to optimize, such as modifying the application calls the logic to them, or to adjust the configuration options and other components.

Again, you do not need to know all the implementation details of each component , as long as they can understand the basic working principles and collaborative way, you can do it.

What are performance indicators?

The first step in learning performance optimization, must understand the "performance" concept.

When you see the performance, what would you think of it first? I believe that "high concurrency" and "quick response" must be the first to appear in your mind two words, but they are also correspond to the two core indicators of performance optimization - "throughput" and "delayed." These two indicators are from the perspective of application workloads to examine the performance of a direct impact on the user experience product terminals. Correspondence with them, are from the perspective of system resources index starting, such as resource utilization, saturation and so on.

We know that with the increase of the applied load, the use of system resources will rise, even up to the limit . The nature of performance problems, is the system resources has reached a bottleneck, but processing the request still not fast enough to support more requests.

Performance analysis, in fact, identify bottlenecks application or system, and try to avoid or alleviate them, so that more efficient use of system resources to handle more requests. This includes a series of steps, such as the following six steps.

Select the application and performance evaluation system;

Set performance goals for applications and systems;

Performance benchmarks;

Positioning performance bottleneck analysis;

Optimizing systems and applications;

Performance monitoring and alerting.

Understand these basic indicators related to performance and core steps, how to learn it? Next, I want to learn it said several important issues Linux performance optimization.

This column needs to learn what basis

First you have to understand that this column is the core of our analysis and optimization of performance, rather than the most basic Linux operating system to use.

Therefore, I wish you the best used Ubuntu or other Linux operating system, and then to have some basic programming, such as

Learn to use Linux commonly used commands;

You know how to install and manage software packages;

You know how a programming language to develop applications and so on.

In this way, when I talk about performance, you are more likely to understand the principles behind the performance, especially when combined column in the case of practice, performance analysis can have a more intuitive experience.

This column will not be as textbook as detailed teach you all the details of the operating system, algorithm theory, network protocols as well as a variety of programming languages, but some important system principle or essential. I will teach you step by step with actual cases, throughout the various components from the application to the operating system.

What is the focus on learning?

Want to learn good performance analysis and optimization, the establishment of a global view of the overall performance of the system is the core topic. thus,

Understand the basic knowledge of the principles of several systems;

Have the necessary performance tools;

The actual exercise scene throughout the different components.

These three points, the most important is that we learn. I will be in each article in column, for different scenarios, these three aspects clear to you, you also must take time and effort to digest them.

In fact, when it comes to performance tool, you will have to mention the master performance in the field of Brendan Gregg (Brendan Gregg). He is not only the author of the DTrace dynamic tracing tool, also developed many performance tools. I'm sure you've seen Linux Performance Tools Atlas he described:

 

This figure is one of the most important resources for Linux performance analysis, it tells you different subsystems in the Linux performance problems, what kind of tools should be used to observe and analyze.

For example, when it comes to I / O performance problems, you can refer to the bottom of the picture I / O subsystem, use iostat, iotop, blktrace bottleneck analysis tools such as disk I / O's. You can survive this figure, reference queries when needed.

In addition, I would also like to stress that the choice of performance tools . There is a saying, the correct choice is better than a thousand times the effort. Although a bit exaggerated, but the appropriate choice of performance tools, we can really simplify the whole performance optimization process. What kind of tools in what scene selection, and learn how to choose the right tools, all I want to teach you something.

But remember, do not put all the performance as a tool for learning. It means only tool to solve the problem, the key lies in your usage. Only truly understand the principles behind them, and the combination of different components specific scenario, mastery of the system, you can really master them.

最后,为了让你对性能有个全面的认识,我画了一张思维导图,里面涵盖了大部分性能分析和优化都会包含的知识,专栏中也基本都会讲到。你可以保存或者打印下来,每学会一部分就标记出来,记录并把握自己的学习进度。

链接:https://pan.baidu.com/s/1v5gm7n0L7TGyejCmQrMh2g 提取码:x2p5

免费分享,但是X度限制严重,如若链接失效点击链接或搜索加群 群号936682608

怎么学更高效?

前面我给你讲了 Linux 性能优化的学习重点,接下来我再跟你分享一下,我的几个学习技巧。掌握这些技巧,可以让你学得更轻松。

技巧一:虽然系统的原理很重要,但在刚开始一定不要试图抓住所有的实现细节。

深陷到系统实现的内部,可能会让你丢掉学习的重点,而且繁杂的实现逻辑,很可能会打退你学习的积极性。所以,我个人观点是一定要适度。

你可以先学会我给你讲的这些系统工作原理,但不要去深究 Linux 内核是如何做到的,而是要把你的重点放到如何观察和运用这些原理上,比如:

有哪些指标可以衡量性能?

使用什么样的性能工具来观察指标?

导致这些指标变化的因素等。

技巧二:边学边实践,通过大量的案例演习掌握 Linux 性能的分析和优化。

只有通过在机器上练习,把我讲的知识和案例自己过一遍,这些东西才能转化成你的。我精心设计这些案例,正是为了让你有更好的学习理解和操作体验。

所以我强烈推荐你去实际运行、分析这些案例,或者用学到的知识去分析你自己的系统,这样你会有更直观的感受,获得更好的学习效果。

技巧三:勤思考,多反思,善总结,多问为什么。

想真正学懂一门知识,最好的方法就是问问题。当你能提出好的问题时,就说明你已经深入了解了它。

你可以随时在留言区给我留言,写下自己的疑问、思考和总结,和我还有其他的学习者一起讨论切磋。你也可以写下自己经历过的性能问题,记录你的分析步骤和优化思路,我们一起互动探讨。学习之前,你的准备作为一个包含大量案例实践的课程,我会在每篇文章中,使用一到两台 Ubuntu 18.04 虚拟机,作为案例运行和分析的环境。如果你只是单纯听音频的讲解,却从不动手实践,学习的效果一定会大打折扣。

所以,你是不是可以准备好一台 Linux 机器,用于课程案例的实践呢?任意的虚拟机或物理机都可以,并不局限于 Ubuntu 系统。

 

Guess you like

Origin www.cnblogs.com/it-chen/p/11653614.html