在Linux系统中CPU使用率过高怎么办?

文章目录

CPU使用率过高,容易引起服务响应速度变慢、服务器登录不上等问题。可以创建 CPU使用率阈值告警,当 CPU 使用率超过阈值时,将及时通知管理员


CPU使用率过高排查的步骤大致为:定位消耗 CPU的具体进程,对 CPU占用率高的进程进行分析。如果为异常进程,可能是病毒或木马导致,可以自行终止进程,或者使用安全软件进行查杀;如果是业务进程,则需要分析是否由于访问量变化引起,是否存在优化空间;


下面将介绍 Linux 系统下如何定位出 CPU 使用率过高的进程。

定位工具介绍:top 命令

top:Linux 系统下常用的监控工具,用于实时获取进程级别的 CPU使用情况。下图是 top 命令的输出信息。

在Linux系统中CPU使用率过高怎么办?

上半部分显示 CPU 和内存资源的总体使用情况:
第一行:系统当前时间,当前登录用户个数以及系统负载。
第二行:系统总进程数、运行中进程数、休眠、睡眠和僵尸进程数量。
第三行:CPU 当前使用情况。
第四行:内存当前使用情况。
第五行:swap 空间当前使用情况。

下半部分以进程为维度显示资源的占用情况。
PID:进程 ID。
USER:进程所有者。
PR:进程优先级 NI:NICE 值,NICE 值越小,优先级越高。
VIRT:使用的虚拟内存大小,单位 KB。
RES:当前使用的内存大小,单位 KB。
SHR:使用的共享内存的大小,单位 KB。
S:进程状态。
%CPU:更新时间间隔内进程所使用的 CPU 时间的百分比。
%MEM:更新时间间隔内进程所使用的内存的百分比。
TIME+:进程使用的 CPU 时间,精确到 0.01s。
COMMAND:进程名称。

问题定位及处理

使用工具定位 CPU 使用率高的进程

前面介绍了 top 工具,下面介绍如何利用该工具定位出 CPU 使用率高的进程。

  1. 通过 SSH 或者 VNC 方式登录服务器
    说明:CPU 使用率过高,容易引起服务器登录不上,此时可以尝试使用 VNC 登录的方式。
  2. 输入 top 命令查看系统负载。
  3. 输入大写 P,进程按 CPU 使用率降序排列;通过排序,可以方便得获得占用 CPU 资源较多的进程,进行进一步的分析。
在Linux系统中CPU使用率过高怎么办?

4.分析占用 CPU 高的进程。

  1. 如果为业务进程,建议分析业务程序是否有优化空间,进行优化或者提升实例的资源配置。
  2. 如果为异常进程,实例可能中毒,可以自行终止进程、使用安全软件进行查杀或者进行数据备份后,重装系统。

使用 top 命令结束进程

  1. 键入小写 k,输入想要结束进程的 pid(默认为排序第一的进程),回车。
在Linux系统中CPU使用率过高怎么办?

2. 操作成功,界面会出现 Send pid 984 signal [15/sigterm] 的提示信息,回车确认即可。

在Linux系统中CPU使用率过高怎么办?

此教程来自固定链接:http://www.rakbuluo.com/p25/

原文链接:,转发请注明来源!

发表评论

  • 54 Responses to “在Linux系统中CPU使用率过高怎么办?”
    • ivermectin and scabies

      ivermectin and scabies https://ivermectin.mlsmalta.com/

      回复
    • FnrhAniny

      discrete viagra online paypal australia <a href="https://genqpviag.com/#">flavor viagra</a> viagra canada pfizer

      回复
    • cialis dosage information

      cialis dosage information https://tadalafili.com/

      回复
    • FqfAniny

      essay on the teacher <a href="https://essaywritingservicesjy.com/#">creative dissertation</a> argumentative essays

      回复
    • best online essay writing service

      Scholarship essay writing service <a href="https://essaywritingservicesjy.com/">https://essaywritingservicesjy.com/</a> essay on service to humanity

      回复
    • FsfAniny

      order dissertation <a href="https://essayhelpbgs.com/#">college essays how to</a> writing a motivational speech

      回复
    • FnsbAniny

      a dissertation <a href="https://customessaywriterbyz.com/#">science assignment help</a> college application essay titles

      回复
    • buy cheap essay

      Buy an essay online <a href="https://buyessayhelpbtg.com/">https://buyessayhelpbtg.com/</a> buy custom essay

      回复
    • FnrdAniny

      best place to buy real viagra online <a href="https://llviabest.com/#">buy viagra without prescription</a> viagra 365

      回复
    • Fgsprest

      customized research papers <a href="https://writemypaperbuyhrd.com/#">student coursework</a> write best man speech

      回复
    • Stituade

      Healthcare continues to be an formidable, but divisive political topic. Not surprisingly, 41 percent of available voters said healthcare was their explanation put in the mid-term elections in 2018.<a href=http://my-canadianpharmacyonline.com>viagra without a doctors prescriptions</a> In 2008, when the ACA became law, merely 46 percent of voters supported unique payer healthcare. That army has grown significantly to 59 percent authorization in beginning 2018.http://my-canadianpharmacyonline.com cialis samples for sale While Medicare-for-all legislation is unthinkable to pass both the Line and Senate in its in the air create, there is a paddle one's own canoe in community opinion with a solid more than half now in favor.

      回复
    • FtghAniny

      research paper 1st paragraph <a href="https://thesiswritinghelpsjj.com/#">umi dissertation services</a> practice essay writing online

      回复
    • Jgscblafe

      critical problem solving <a href="https://thesisbyd.com/#">free essay website</a> writing paper service

      回复
    • Dvscprest

      writing a best mans speech <a href="https://dissertationhelpvfh.com/#">harvard essay writing</a> best website to write essay

      回复
    • Kwgdboop

      help writing a best man speech <a href="https://researchpaperssfk.com/#">along these lines writing paragraphs and essays</a> write essays

      回复
    • FbsbAniny

      como dejar de tomar viagra <a href="https://genericrxxx.com/#">viagra receta medica</a> esclerosis multiple viagra

      回复
    • Fdbvprest

      viagra 30 mg <a href="https://hopeviagrin.com/#">viagra without a doctor</a> sildenafil 50

      回复
    • beUnjudge

      <a href="https://azithromycinx250.com/">urinary tract infection azithromycin dosage</a>
      https://azithromycinx250.com/# - urinary tract infection azithromycin dosage

      回复
    • vidalista 60 mg side effects

      vidalista 60 mg side effects https://vidalista.buszcentrum.com/

      回复
    • FbsgAniny

      tips on viagra use <a href="https://buybuyviamen.com/#">viagra tablets in hyderabad</a> how does it feel to take viagra

      回复
    • Jsweblafe

      real viagra pills <a href="https://mygoviagar.com/#">buy viagra without a script</a> where to buy sildenafil

      回复
    • Dbsfprest

      viagra brand canada <a href="https://lightvigra.com/#">buying sildenafil uk</a> best site to buy viagra online

      回复
    • Kbrgboop

      sildenafil 50 mg price in india <a href="https://miraclevigra.com/#">viagra 400 mg</a> cost of generic viagra in india

      回复
    • FhsbAniny

      durex al viagra <a href="https://buybuyviamen.com/#">buybuyviamen.com</a> how do i get a sample of viagra

      回复
    • viagra generics price judpharmacys

      viagra generics price judpharmacys http://droga5.net/

      回复
    • ivermectin toxicity in humans

      ivermectin toxicity in humans https://ivermectin.webbfenix.com/

      回复
    • Frbhprest

      viagra for sale cheap <a href="https://paradiseviagira.com/#">https://paradiseviagira.com/</a> female viagra wiki

      回复
    • dapoxetine costs at walmart

      dapoxetine costs at walmart https://salemeds24.wixsite.com/dapoxetine

      回复
    • Devkprest

      is a prescription needed for viagra <a href="https://paradiseviagira.com/#">bying viagra uk</a> viagra and alcohol consumption

      回复
    • Jivhblafe

      consumer reports viagra cialis levitra <a href="https://purevigra.com/#">viagra efectos secundarios en jovenes</a> wordpress viagra malware

      回复
    • Kmrfboop

      tomar viagra a los 16 aГ±os <a href="https://purevigra.com/#">https://purevigra.com</a> medical side effects of viagra

      回复
    • beUnjudge

      <a href="https://clomidweb.com/">clomiphene citrate tablets</a>
      https://clomidweb.com/# - clomiphene citrate tablets

      回复
    • naltrexone full prescribing information

      <A HREF='https://naltrexoneonline.confrancisyalgomas.com/'>naltrexone full prescribing information</A>

      回复
    • buy cialis online without a prescription

      <a href=http://www.lm360.us/>buy cialis online without a prescription</a>

      回复
    • JildcAniny

      generic viagra 2017 http://fmedrx.com/ <a href="http://fmedrx.com/#">viagra online canadian pharmacy</a> when will generic viagra be available in the us

      回复
    • cialis warnings and precautions

      <A HREF="http://cleckleyfloors.com/">cialis warnings and precautions</A>

      回复
    • order hydroxychloroquine 200mg

      <a href="https://hydroxychloroquine.webbfenix.com/">order hydroxychloroquine 200mg</a>

      回复
    • walmart viagra prices without insurance

      <a href="http://www.zolftgenwell.org/">walmart viagra prices without insurance</a>

      回复
    • amoxicillin 500 mg price

      <A HREF=https://amoxycillin1st.com/>amoxicillin 500 mg price</A>

      回复
    • KmrfAniny

      cheap viagra online canadian pharmacy http://usggrxmed.com/ <a href="http://usggrxmed.com/#">best site to buy generic viagra</a> best generic viagra online reviews

      回复
    • beUnjudge

      <a href="http://www.cialislex.com/">average cost of 20mg cialis</a>
      http://www.cialislex.com/# - average cost of 20mg cialis

      回复
    • beUnjudge

      <a href="https://cialistodo.com/">que es cialis</a>
      https://cialistodo.com/# - que es cialis

      回复
    • hydroxychloroquine vs chloroquine phosphate

      <a href="https://azhydroxychloroquine.com/">hydroxychloroquine vs chloroquine phosphate</a>

      回复
    • generic viagra online canadian pharmacy

      A silicone or saline implant may be used. <a href="http://siviagmen.com/">https://siviagmen.com</a> generic form of viagra

      回复
    • AUnjudge

      <a href="http://medscape.ru/go.php?http://viagrraver.com">viagra where to buy 93811035</a>
      http://medscape.ru/go.php?http://viagrraver.com# - viagra where to buy 10099107

      回复
    • beUnjudge

      <a href="http://viagrraver.com/">buy female viagra online</a>
      http://viagrraver.com/# - buy female viagra online

      回复
    • availability of hydroxychloroquine in usa

      <A HREF='https://chloroquine1st.com/'>availability of hydroxychloroquine in usa</A>

      回复
    • can women take viagra

      Learn More Contact Organizer Your message has been sent!
      <a href="https://saleviabuy.com/">saleviabuy.com</a> how long for viagra to work

      回复
    • acyclovir dosage for recurrent herpes

      <a href="https://www.herpessymptomsinmen.org/productacyclovir/">acyclovir dosage for recurrent herpes</a>

      回复
    • generic sildenafil citrate for sale

      <A HREF=https://buszcentrum.com/>generic sildenafil citrate for sale</A>

      回复
    • buying viagra online from pfizer

      <a href="http://grassfed.us/">buying viagra online from pfizer</a>

      回复
    • Stephenpeaky

      generic viagra walmart <a href=" http://sild100fast.com/# ">canadian pharmacy viagra</a> viagra without prescription

      回复
    • chloroquine prices

      <A HREF=https://www.herpessymptomsinmen.org/where-to-buy-hydroxychloroquine/>chloroquine prices</A>

      回复
    • bimatoprost ophthalmic solution cost

      <a href=https://carepro1st.com/>bimatoprost ophthalmic solution cost</a>

      回复