go-sigma / sigma

OCI-Native artifact manager
https://docs.sigma.tosone.cn
Apache License 2.0
129 stars 10 forks source link

有规律的高CPU使用 #343

Closed Sokwva closed 6 months ago

Sokwva commented 6 months ago

每隔5秒左右,sigma的进程会出现大约20-30%的CPU使用,在那一阶段并没有使用镜像的服务,但是也会出现这样的有规律的占用问题。

tosone commented 6 months ago
curl -s http://127.0.0.1:8081/__debug/profile?seconds=60 > ./cpu.out
curl -s http://127.0.0.1:8081/__debug/heap > ./heap.out

当配置文件的 log.level 为 debug 的时候,以上的 pprof 的路径才会可以访问,你可以收集 memory 和 cpu 的数据,我来观察一下。以上你只需要替换 host 和 port 应该就可以了。

除此之外你也可以按照 demo-server 里的 prometheus 和 grafana 的部署方式,可以做到类似这里,实时监控 sigma 的资源占用情况。

Sokwva commented 6 months ago
log:
    level: debug
curl -s http://127.0.0.1:8081/__debug/profile?seconds=60
{
    "message": "Not Found"
}
tosone commented 6 months ago
curl -s http://127.0.0.1:8081/__debug/pprof/profile?seconds=60 > ./cpu.out
curl -s http://127.0.0.1:8081/__debug/pprof/heap > ./heap.out

是这样的路径,不好意思弄错了。

curl -s https://sigma.tosone.cn/__debug/pprof/heap > ./heap.out

demo server 可以这样访问。

tosone commented 6 months ago

在配置文件里 workqueue.type 目前多支持一种消息通知类型 inmemory,基于 channel 实现,可以用最新的镜像试一下: docker pull tosone/sigma:nightly-alpine

完整的配置文件及说明:https://docs.sigma.tosone.cn/docs/configuration

tosone commented 6 months ago

使用 inmemory 问题已经得到解决,但是这种配置仅限使用在单架构部署的情况下,在集群高可用的情况下请使用 redis 或者 kafka 的外置中间件来作为消息通知。其他有问题的朋友可以重新打开这个 issue 来讨论 ^_^