谷歌云 CPU 分析没有显示有用的数据

时间:2021-02-04 22:58:40

标签: node.js google-cloud-profiler

在我的应用程序在 dockerised 应用程序中以 400% 以上的 CPU 使用率运行后,我决定尝试使用 @google-cloud/profiler。设置很简单,但我对 UI 中的内容感到失望:

enter image description here

如您所见,消耗最多资源的是什么,我似乎无法调查,因为没有关于它的信息。它被标记为“(外部)”&无文件。我对 Google Cloud CPU Profiler 很陌生,但它似乎是开箱即用的。我的应用程序是一个多进程应用程序,它是导致高 CPU 负载的子进程,因此我在这些子进程的入口处调用 CPU 分析器'

src/cluster/worker/index.js

module.exports = async function() {
    try {
        await require('@google-cloud/profiler').start({
            projectId: process.env.GOOGLE_PROJECT_ID,
            serviceContext: {
                service: process.env.GOOGLE_SERVICE || 'app',
                version: process.env.GOOGLE_VERSION || '1.0.0'
            },
            // want to disable logging to the console
            logLevel: 0
        })

        ...
    } catch(err) {
        ...
    }
}

有许多子进程正在运行 (5 ish) 那么这可能是问题吗?此外,当我选择查看个人资料的历史记录时,我会得到:

enter image description here

如前所述,我一般不熟悉 Google Cloud 和 CPU 分析,因此我们将不胜感激。遗憾的是,我在 Google 论坛上找不到任何帮助,也没有人在 NPM 包本身上提出任何类似的问题。

0 个答案:

没有答案