In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you a sample analysis of CPU 100% anomaly troubleshooting in Linux system, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the details of this article.
1. The background of the question
Yesterday afternoon, I suddenly received an email alarm from the operation and maintenance staff, which showed that the cpu utilization rate of the data platform server reached 98.94%, and recently it has been more than 70%. It looks like hardware resources need to be expanded to the bottleneck, but after careful consideration, we will find that our business system is not a high concurrency or CPU-intensive application. This utilization rate is a bit exaggerated, and the hardware bottleneck should not come so soon. There must be something wrong with the business code logic somewhere.
Exception method logic: converts the timestamp to the corresponding specific date and time format
Upper layer call: calculate the number of seconds from the early morning of the day to the current time, convert it to the corresponding format and put it into set to return the result.
Logic layer: corresponding to the query logic of the real-time report of the data platform, the real-time report will come at a fixed time interval, and there are multiple (n) method calls in a query.
So we can come to the conclusion that if the time now is 10:00 in the morning, the number of calculations for a query is 10: 60 times 60 times n times = 36000 times times, and as time goes on, the number of single queries will increase linearly as it approaches midnight. Due to real-time query, real-time alarm and other modules, a large number of query requests need to call this method many times, resulting in the occupation and waste of a large number of CPU resources.
5. Summary
In the process of coding, we should not only realize the business logic, but also pay attention to the optimization of code performance. A business requirement, can be realized, and can be realized more efficiently and elegantly is actually the embodiment of two very different engineers' abilities and realms, and the latter is also the core competitiveness of engineers.
After the code has been written, do more review and think more about whether it can be implemented in a better way.
Online problems do not let go of any small details! Details are the devil, technical students need to have the root of the problem of curiosity and the pursuit of excellence, only in this way, can continue to grow and improve.
The above is a sample analysis of CPU 100% anomaly troubleshooting in Linux system. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.