In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to carry out Linux performance analysis and optimization, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
Preface
Generally speaking, Internet projects are deployed on the linux server. If there is something wrong with the linux server, then the high concurrency and stability we usually learn are meaningless, so it is very important to grasp the performance of linux. Of course, many students may think that these are the business of operation and maintenance students, but I don't think so, whether you are an architect or crud boy. Having overall control of the project is a very important basic quality, so summed up this article, hope to be useful to you, if you think my writing is good, remember to like it after reading it, click it again. Let's cut the crap and get straight to the point.
Factors affecting the performance of linux Server
Cpu
CPU is the foundation of the stable operation of the operating system, and the speed and performance of CPU largely determine the overall performance of the system. Therefore, the more the number of CPU and the higher the main frequency, the better the performance of the server.
Memory
The size of memory is also an important factor affecting the performance of Linux, memory is too small, the system process will be blocked, the application will become slow, or even lose response; too much memory, resulting in a waste of resources.
Disk IO
The performance of disk Icano directly affects the performance of the application. In an application with frequent reads and writes, if the performance of disk Icando is not satisfied, it will lead to application stagnation. Fortunately, today's disks use a number of methods to improve the performance of Imax O, such as the common disk RAID technology.
The network
All kinds of applications under Linux are generally based on network, so network bandwidth is also an important factor affecting performance. Low-speed and unstable network will lead to access blocking of network applications, while stable and high-speed network bandwidth can ensure that applications can run smoothly on the network. Fortunately, today's networks are generally gigabit bandwidth or optical fiber networks, and the impact of bandwidth problems on application performance is gradually decreasing.
Commonly used linux system performance monitoring commands
Uptime (overall system performance Evaluation)
It should be noted here that the output value of load average, the size of these three values generally cannot be greater than the number of system CPU.
So how do you check the number of cpu?
View information about the system cpu
Information in cat / proc/cpuinfo
Where cpu cores is the core number of cpu.
You can also use cat / proc/cpuinfo | grep "cores" | uniq to view directly
[root@test ~] # cat / proc/cpuinfo | grep "cores" | uniq cpu cores: performance evaluation of 2cpu using vmstat command to monitor cpu
Vmstat 2 10 (monitor 10 times every 2 seconds)
Procs
R indicates the number of processes running and waiting for cpu time slices. If this value is longer than the number of cpu, you need to increase the system cpu.
B indicates the number of processes waiting for resources
CPU
The us column shows the percentage of CPU time consumed by the user process. When the us is relatively high, it indicates that the user process consumes more cpu time. If the long-term consumption is more than 50%, you need to optimize the program and algorithm.
The sy column shows the percentage of cpu time consumed by kernel processes. When the sy value is high, the kernel consumes a lot of cpu resources.
As a rule of thumb, the reference value of us+sy is 80%. If us+sy is greater than 80%, there may be insufficient CPU resources.
Using sar command to monitor system cpu
The sar command adds overhead but has little impact.
Yum install sysstat installs sar command
Sar-u 3 5 (u shows the load status of all cpu in the system during the sampling time) Picture% user: percentage of time that the user process consumes cpu
% nice: percentage of cpu consumed by running a normal process
% system: percentage of cpu time consumed by the system
% percentage of cpu time spent by iowait:IO waiting
% steal: pagein forces steal operations on different pages in a relatively tight environment
% percentage of idle:cpu 's idle time
Memory performance evaluation
Using free instruction to monitor memory
Free-m # View memory usage in M
There is generally an empirical formula:
When the available memory of the application / the physical memory of the system is more than 70%, it indicates that the system memory resources are very sufficient and does not affect system performance.
Application available memory / system physical memory
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.