• 请不要在回答技术问题时复制粘贴 AI 生成的内容
fxjson
V2EX  ›  程序员

后端如何判断是内存不够了,还是 cpu 到瓶颈了

  •  
  •   fxjson · Aug 27, 2022 via Android · 2733 views
    This topic created in 1361 days ago, the information mentioned may be changed or developed.

    一直作为一线研发,线上出问题不知道怎么识别是内存问题还是 cpu 问题,以及新客户买硬盘大概需要多大空间的,这个又怎么计算呢?或者大家有没有这方面的书籍呢,还是全靠经验

    random1221
        1
    random1221  
       Aug 27, 2022
    top
    20015jjw
        2
    20015jjw  
       Aug 27, 2022 via iPhone
    htop
    kenneth104
        3
    kenneth104  
       Aug 27, 2022
    CPU 不够用,可能很多情况都看得出,但内存不够用觉得很难量化
    例如内存带宽不够用,例如内存延迟太高,等等
    e9pWeUbh9PGCnp95
        4
    e9pWeUbh9PGCnp95  
       Aug 27, 2022
    Systems Performance 2nd Edition : Enterprise and the Cloud
    spicecch
        5
    spicecch  
       Aug 27, 2022
    top 啦
    microxiaoxiao
        6
    microxiaoxiao  
       Aug 27, 2022 via Android
    这种要周期性统计,不是瞬时的。利用 ps ,vmstat 定时统计当前系统的内存资源,利用 iostat 统计 io 延时,cpu 资源。还有就是系统日志,如果内存异常,会触发 oom ,要综合分析。举个例子,如果内存泄露,那么会发现它的 vss 字段持续增加,最后可能触发 oom ,如果是 IO 延时,那一般会出现多进行进入 stuck 状态。
    Jooooooooo
        7
    Jooooooooo  
       Aug 27, 2022
    看监控啊.
    xuanbg
        8
    xuanbg  
       Aug 27, 2022
    有监控看监控,没有自己 top 简单看一下也凑合。
    paopjian
        9
    paopjian  
       Aug 27, 2022
    内存不够会 OOM,CPU 不够不就是运算时间长了吗
    deorth
        10
    deorth  
       Aug 29, 2022 via Android
    找运维看
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4322 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 71ms · UTC 05:33 · PVG 13:33 · LAX 22:33 · JFK 01:33
    ♥ Do have faith in what you're doing.