System optimization should be a commonplace topic.
Whether you're using Linux, Windows or some UNIX systems or other systems for minicomputer, optimizing this topic is almost never going to be avoided.
Never the fastest only faster, the human to the efficiency of the demanding is greedy, of course, this is also one of the important driving force of human technology progress.
How should optimization be optimized? There are some principles or criteria for optimization, and the answer is yes.
First of all we must first clarify a question, what optimization are we optimizing? Optimization is the object and goal, if the object and target to talk about the optimization is almost a headless false proposition. Recall, under what circumstances would we blurt out the word "optimization"? Many friends estimate that there is a similar experience, that is, when we are not satisfied with the current situation of the system or unsatisfied. These situations usually include two major aspects, one is time, and the other is space. We are merely dissatisfied with one or both of these two things in our current situation. We can hardly find a third thing to measure. And to support these two factors, such as CPU, memory, disk, network, these factors we call resources.
In half, we should do one thing before we make optimization, that is, make a judgment, judge whether the resource is insufficient, or the resource allocation is unreasonable.
Common scenarios may include the following, for example, when a process runs on a server, but the speed is really slower than we expected, and the bandwidth of the CPU and disk is largely idle, in which case the resource configuration is obviously unreasonable. Because resources are not enough, they are not exploited because of thread scheduling, or algorithms, or some other reason. In this case, it is usually possible to try to start several processes or threads, let each process or thread process a part of the entire job, and end with a "merge" operation to improve parallelization and improve resource utilization.
For example, in order to cache some data to do iterative operations, the disk occurs very frequently read and write, a few gigabytes per time (the amount is smaller, at least the memory can be hosted), but one processing may have to read and write hundreds of times, which will be a lot of disk IO. In this case, try to make an in-memory virtual or partition a separate space for IO use. This increases the efficiency by converting the IO between the CPU and the disk into IO between the CPU and the memory, which can be up to thousands of times times higher.
There is, in the process of disk IO, is not scanned some disk blocks that can not be scanned. There are many ways to deal with this problem, such as the index in the database. Also, using column storage in a data warehouse is essentially the way to circumvent unnecessary chunks of data being scanned.
The situation of unreasonable allocation of resources is better solved, is to find out in the system CPU, memory, disk, network, which resources are a lot of idle, if the use of can improve parallelism, basically is such a thought.
Low-resource situations are usually troublesome, because if you observe that the CPU, disk IO, and network IO on the server are very busy, try to figure out whether it is unreasonable or unexpected resource requests that are caused by negligence in the design of business logic, or "true" resources are insufficient. If a resource request is too concentrated due to some omission, it can be solved by debugging or optimizing the business logic. But if none of these problems are true, then resources are indeed less than objective needs. A typical example is when I save my log, the business requires a lossless permanent archive, but even when I enable compression without redundancy, I quickly fill up the disk, which is a typical lack of disk resources.
In short, according to my opinion, we should first use some methods to determine whether the allocation of resources is inadequate or unreasonable, and then "low-cost" resources in exchange for "high-cost" resources.
This article is from the "7727197" blog, please be sure to keep this source http://7737197.blog.51cto.com/7727197/1727359
Basic principles of System optimization