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

High CPU usage on macOS from the Renderer process #3219

Open
MitchellCash opened this issue Jun 28, 2022 · 17 comments
Open

High CPU usage on macOS from the Renderer process #3219

MitchellCash opened this issue Jun 28, 2022 · 17 comments

Comments

@MitchellCash
Copy link

Bug Report

Current Behavior

I notice that Compass causes high CPU usage on my machine and it seems to stem from the Electron renderer process (see screenshot).

My machine is running a 2.6 GHz 6-Core Intel Core i7 and I wouldn't expect the Compass app to be averaging 15%-20% of the CPU when connected to a database.

Code/Gist

N/A

Expected Behavior/Code

Less CPU usage.

Environment

Compass: Version 1.32.2 (1.32.2)
OS: macOS Monterey 12.4
CPU: 2.6 GHz 6-Core Intel Core i7
Memory: 16 GB 2667 MHz DDR4

Possible Solution

I do notice the Electron version being used is v13 when v19 is available, which of course is not a guaranteed fix for the problem, but probably doesn't hurt seeing as v13 isn't supported/updated any more.

I also noticed some anecdotal data, which isn't exactly an "apples to apples" comparison, but I will include nonetheless. The high CPU usage seems to be when I connect to a MongoDB 4.4.11 Community instance with 8GB of data using a TLS certificate. When I connect to a MongoDB 5.0.9 Enterprise instance with 10MB of data without using a TLS certificate the CPU usage is about half (~8% usage).

So the differences between the comparison is MongoDB version, logical size or the TLS certificate.

Mongo version Logical size Connect with TLS certificate Compass CPU usage
MongoDB 4.4.11 Community 8 GB True 15%-20%
MongoDB 5.0.9 Enterprise 10 MB False 8%

From these I wonder if the use of a TLS certificate is causing the much higher CPU usage?

Additional Context/Screenshots

MongoDB Compass Renderer process CPU usage

@dumbasPL
Copy link

This issue is not specific to macOS.
The same exact thing happens on Linux as well.

@john-g-davies
Copy link

Same here, still 1 year later.
MacOS version 13.3.1, Compass version 1.36.4.

@glintik
Copy link

glintik commented May 29, 2023

Compass still has this bug, very annoying.
Apple M1 Max
MacOS 13.2.1 (22D68), Compass 1.37.0.

Anybody wants to debug this?

@slavag
Copy link

slavag commented Jun 13, 2023

Same here, high CPU usage, MacOS version 13.3.1. M1.
Compass version 1.37.0

@abdimussa87
Copy link

Why isn't this fixed till now? Experiencing the same high CPU usage

@lerouxb
Copy link
Contributor

lerouxb commented Jul 13, 2023

What kinds of percentages are you all seeing? Is it significantly different to slack or vscode's renderer processes?

@dumbasPL
Copy link

Is it significantly different to slack or vscode's renderer processes?

Slack, Discord, Teams, and two instances of vscode combined use less than compass alone on my machine.
The only one that comes close to the background usage of compass is Chrome with a shit load of tabs and extensions.

@himanshusinghs
Copy link
Contributor

Hi @dumbasPL!
Thank you for confirming. It would be super helpful if you could also answer the following:

  • Are these occasional usage spikes or is Compass consistently on high CPU usage?
  • Does keeping Compass idle (both connected to a cluster and not), still reports the same CPU usage?

@dumbasPL
Copy link

Are these occasional usage spikes or is Compass consistently on high CPU usage?

Occasional spikes on the renderer process are a normal thing and will happen in any electron app when there are changes being made. The problem is that there are no (visible) changes being made but both the renderer and gpu-process processes are constantly eating CPU cycles even where there is seemingly nothing happening.

Does keeping Compass idle (both connected to a cluster and not), still reports the same CPU usage?

While connected yes. It's a constant ~9% or so for me. No matter what tab I'm on, even when connected to an empty database.

While disconnected, it drops down to a near-perfect 0% on idle, just like any other electron app.

So my guess is that there is maybe some sort of animation or some other thing that is constantly updating the DOM that's causing this. If you are actually interested in fixing this then I could profile it and figure out exactly what's causing this.

@glintik1
Copy link

Compass eats ~30% of CPU on Apple M1 Max even sitting in background. Starts eating CPU after some time, can be hours or days.
Do you want some profiles or charts? I can record it from DevTools.

@MitchellCash
Copy link
Author

My experience is very similar to @dumbasPL. Definitely higher CPU usage than the other big name Electron apps.

Also agree that when not connected to a cluster the CPU usage is not an issue, but as soon as I make a connection the CPU usage on the renderer process will hover around ~10% consistently. Then as soon as I open up a collection in a tab the CPU will jump and remain at around ~20% CPU usage.

I would expect the CPU to use a few extra resources while fetching and displaying a collection initially, but once the collection is in view I would think there is nothing to be done as it's not like the Compass UI "auto refreshes" or anything similar to that. I assume, once the data has been fetched, it's a static view that won't change until another button is pressed and shouldn't use many resources?

@tomerb
Copy link

tomerb commented Jul 19, 2023

I'm seeing this exactly on Linux (Fedora 38, 6.3.12-200.fc38.x86_64).

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
231291 tomer 20 0 36.7g 195680 61680 S 21.3 1.6 30:15.77 MongoDB Compass

@ff-charles-mccrary
Copy link

Still seeing this. Using between 10 and 25% cpu in the background.

MacOS, Compass Version 1.40.4

@mcasimir
Copy link
Contributor

mcasimir commented Nov 8, 2023

An update on this one, we managed to isolate the issue and we will work on a fix soon.

@vermi321
Copy link

vermi321 commented Jan 3, 2024

... opened this issue on Jun 28, 2022 oh no. Guess what, I have the same issue on M1 Mac, OS version 14.1.1

@himanshusinghs
Copy link
Contributor

Hi @vermi321! Could you please confirm what version of Compass are you using? We released a fix for this issue in v1.41.0 (check here for the release notes). Thank you.

@Anlele1701
Copy link

I still have the same issue, using a MacBook Air M2
When I let it Idle, not using Mongo it used up to 99% and make my Mac go hot hot hot
Currently using V1.43.0

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