In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The company has always had a server with high CPU usage. It is analyzed that the Java usage of Hang Seng monitoring program is very high, and only one of the three Java programs is very high. It needs to be solved by Hang Seng, which has not been solved, resulting in weekly restart. Our operation and maintenance have to manually set the program correlation, which brings trouble to operation and maintenance.
In order to solve the duplication of operation and maintenance work, we plan to see if it can be implemented by script. By querying online data, we can set the program correlation through powershell. The reference links are as follows:
https://www.pstips.net/setting-process-running-under-specific-cpu.html
Therefore, the following powershell script was written to achieve automatic program settings cpu high java program dependency settings.
Set the number of cpu runs.ps1 script as follows:
#Get java processes with CPU higher than 40%, because there are three java processes on the machine, and the paths are consistent.
$id=Get-Process | Where-Object {$.Name -eq "java"} | Where-Object {$.CPU -gt 40}
#Set the first 4 CPUs to run, freely configure which CPUs to run. ProcessorAffinity
$id.ProcessorAffinity=15
Create a callpowershell.bat to run powershell scripts.
powershell set cpu run number.ps1
Finally, configure callpowershell.bat on the delayed startup tool to delay startup for 2 minutes.
After the above steps, after restarting the server for 2 minutes every week, the Java process that occupies 100% CPU will automatically specify 4 CPUs. It solves the duplication of labor in the operation and maintenance process.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.