Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Penumbra is getting high cpu usage even when not encrypting or decrypting #214

Closed
yaronvhop opened this issue Mar 12, 2022 · 5 comments
Closed

Comments

@yaronvhop
Copy link

yaronvhop commented Mar 12, 2022

Can be reproduced with a very small code on chrome 99:

// This is all of the Penumbra-relevant code:
const onReady = async (
  { detail: { penumbra } } = {
    detail: self,
  },
) => {
  penumbra.setWorkerLocation('/worker.penumbra.js');
};

if (!self.penumbra) {
  self.addEventListener('penumbra-ready', onReady);
} else {
  onReady();
}
<HTML>
<HEAD></HEAD>
<Body>
    <script src="main.penumbra.js" async defer></script>
    <script src="index.js"></script>
</Body>
</HTML>

Usually it uses high CPU for ~1min, but sometimes I see it going over an hour!

image

On FF does not seem to happen at all.

When profiling on Chrome, all I can see is a bunch of empty "Task" in the flame chart, without any JS code.

Any idea?

Thanks!

@eligrey
Copy link
Member

eligrey commented Mar 12, 2022

Interesting. I will definitely look into this next week, as we shouldn't be doing anything in the background without jobs running.

If I had to guess, it could potentially be misreported usage due to idle worker overhead.

@yaronvhop
Copy link
Author

Hey,
I see the high CPU in Windows Task manager as well

image

In my PC 3 percent is a full core (32 threads CPU), it seems the numbers do match Chrome Task Manager, both in CPU % and in CPU time.

Thanks!

@yaronvhop
Copy link
Author

A screenshot from the profiler, a very weird empty tasks

image

Seems to be some internal chrome issue. I am 100% clueless
Hope you will have a better idea
Thanks again!

@eligrey
Copy link
Member

eligrey commented Jun 22, 2022

This issue seems to be gone in Chrome 103 with Penumbra 6.0

@eligrey eligrey closed this as completed Jun 22, 2022
@eligrey
Copy link
Member

eligrey commented Jun 22, 2022

If I had to guess this was overhead simply due to number of threads. It uses 1 thread per available logical CPU thread. The 3% CPU usage you were witnessing was likely OS overhead.

The flame chart looks much better now in Chrome 103 though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants