After my application was running @ 400%+ CPU usage in a dockerised app, I decided to try using @google-cloud/profiler. The setup was easy enough but I am disappointed with what I see in the UI:
As you can see, what is consuming the most resources, I can't seem to look into as there's no info about it. It's labelled as "(external)" & no file. I am very new to Google Cloud CPU Profiler but it seems quite out of the box. My application is a multi-process one & it is the child process' that are causing the high CPU load so I invoke the CPU profiler on the entry of these child process'
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) {
...
}
}
There are many child process' running (5 ish) so could this be the issue? Also, when I select to view the history of the profile, I get this:
As mentioned, I am new to Google Cloud & CPU profiling in general so any help would be appreciated. Sadly, I cannot find any help in Google forums & no one has raised any similar issues on the NPM package itself.