很多途径都能观察到:
我们看一下 JFR 中的事件(截图由 @吃泡面的女娲 https://space.bilibili.com/395445925 提供,感谢):
通过 -Xlog:safepoint=debug:file=${LOG_PATH}/safepoint%t.log:utctime,level,tags:filecount=10,filesize=10M 这个参数观察 safepoint 日志,可以看到流量第一次到达的时候,有大量的 ICBufferFull 这种 JIT 相关:
[2022-06-20T07:13:22.518+0000][info ][safepoint] Safepoint "ICBufferFull", Time since last: 505901458 ns, Reaching safepoint: 203535 ns, At safepoint: 15007 ns, Total: 218542 ns
[2022-06-20T07:13:22.745+0000][info ][safepoint] Safepoint "ICBufferFull", Time since last: 226749494 ns, Reaching safepoint: 229619 ns, At safepoint: 11684 ns, Total: 241303 ns
[2022-06-20T07:13:22.938+0000][info ][safepoint] Safepoint "ICBufferFull", Time since last: 192997437 ns, Reaching safepoint: 207982 ns, At safepoint: 12948 ns, Total: 220930 ns
[2022-06-20T07:13:23.126+0000][info ][safepoint] Safepoint "ICBufferFull", Time since last: 187535899 ns, Reaching safepoint: 300756 ns, At safepoint: 14449 ns, Total: 315205 ns
[2022-06-20T07:13:23.247+0000][info ][safepoint] Safepoint "ICBufferFull", Time since last: 120311192 ns, Reaching safepoint: 249434 ns, At safepoint: 14875 ns, Total: 264309 ns
[2022-06-20T07:13:23.340+0000][info ][safepoint] Safepoint "ICBufferFull", Time since last: 92724282 ns, Reaching safepoint: 232015 ns, At safepoint: 12110 ns, Total: 244125 ns
[2022-06-20T07:13:23.411+0000][info ][safepoint] Safepoint "ICBufferFull", Time since last: 70987313 ns, Reaching safepoint: 211428 ns, At safepoint: 13071 ns, Total: 224499 ns
[2022-06-20T07:13:23.635+0000][info ][safepoint] Safepoint "ICBufferFull", Time since last: 223611196 ns, Reaching safepoint: 254973 ns, At safepoint: 18280 ns, Total: 273253 ns
[2022-06-20T07:13:23.749+0000][info ][safepoint] Safepoint "ICBufferFull", Time since last: 114334671 ns, Reaching safepoint: 222406 ns, At safepoint: 13293 ns, Total: 235699 ns
[2022-06-20T07:13:23.770+0000][info ][safepoint] Safepoint "ICBufferFull", Time since last: 20734555 ns, Reaching safepoint: 226780 ns, At safepoint: 15401 ns, Total: 242181 ns
CPU Usage 与 Throttling
对于因为 CPU 出现的性能瓶颈,通过 CPU Usage 可能看不出来:CPU Usage 的实现,只能看平均值,最短周期是 1s,瞬时流量看不出来。这个只能通过 CPU Throttling 看出来。
举个比较极端的例子来说明这两个指标:比如两个线程,每个执行,每个都需要占满 CPU 跑 200ms,只有一个 CPU,不考虑 Linux 线程抢断式切换以及调度算法。 从 CPU Usage 看,就是 40%(200+200)/1000 从 CPU Throttling 看,这时候 CPU 限流发生了 200ms,就是一个线程等了 200ms。
再举一个微服务的例子,这个微服务在高峰的时候,已经有瓶颈,接口开始超过 1s,通过 CPU Usage 看,问题不大,但是其实从 CPU Throttling 看打,已经比较高了:
CPU Usage:
CPU Throttling:
如何观察到 CPU Throtlling?
我们主要做了3件事:
个人简介:个人业余研究了 AI LLM 微调与 RAG,目前成果是微调了三个模型:
目前,准确率已经非常高了。大家如果有想要我制作的视频,欢迎关注留言。
另外,一如即往的是,全网的所有收益,都会捐赠给希望工程,坚持靠爱与兴趣发电。