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

Logseq on Linux is still very CPU hungry #4175

Open
l8l opened this issue Feb 9, 2022 · 32 comments
Open

Logseq on Linux is still very CPU hungry #4175

l8l opened this issue Feb 9, 2022 · 32 comments
Labels
electron os:linux :type/performance Performance related, speed or cpu usage. upstream Blocked by upstream deps

Comments

@l8l
Copy link

l8l commented Feb 9, 2022

What happened?

In this recent issue, many people described that logseq was extremely CPU hungry on Linux. The issue was closed after some people reported that the nightly build of logseq helped them to resolve the issue.

Unfortunately, the issue persists even if I install the nightly build and thus I request to re-open the issue.

Background data of my system

OS: Arch Linux, Gnome Desktop
Hardware: Intel i5, dual core, 8GB RAM

Detailed problem description

Even when just scrolling through a page without any images, logseq uses about 16% of the CPU. If I additionally open a graph (with only 3 nodes for example) on the right hand side, then it jumps to over 30%. My fans go wild as well whenever I open the side bar. This presently makes logseq unfortunately unusable for me.
As I wrote, I ran the nightly build (and previously uninstalled my old version) and the issue persists. I can see in the settings menu that I am really running the nightly release ("0.5.9+nightly.20220129").

Thanks a lot for considering this issue again.

@andelf andelf added the :type/performance Performance related, speed or cpu usage. label Feb 9, 2022
@cnrpman
Copy link
Collaborator

cnrpman commented Feb 9, 2022

Any error noticed in console?

@l8l
Copy link
Author

l8l commented Feb 9, 2022

Thanks for getting back to me!

Console output:

$ ./Logseq 
[27117:0209/205426.135032:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.
20:54:27.508 › Logseq App(0.5.9) Starting... 

That's all.

@Haptein
Copy link

Haptein commented Feb 9, 2022

This is partly related to #4119. It's not only the CPU but the GPU as well.
Screenshot from 2022-02-09 17-45-14
The first half is a small graph open, the second is just scrolling continuously on a page without any graph open. rcs0 (top left, red) is GPU rendering. This is on 0.5.9.

I'm getting the same message as well.

› Logseq App(0.5.9) Starting...
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[53870:0209/175118.958815:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.

@l8l
Copy link
Author

l8l commented Feb 10, 2022

@Haptein seems that you get a libva error in addition to the error I get.

In my case, mainly the CPU consumption is high but maybe it is related to a GPU problem since I do not have a dedicated GPU.

Screenshot1

@Haptein
Copy link

Haptein commented Feb 10, 2022

@l8l What I showed was on a mobile intel iGPU using intel-gpu-overlay. I'm honestly not sure if the libva error is related to this but I think it's good that you pointed it out.

@vibl
Copy link

vibl commented Feb 11, 2022

I have a constant 20% usage of one CPU core even when the app has been idle for hours and only a basic page is displayed (with no plugin activated).

That only seems to happen after I've opened (and closed) the graph view.

Is this the same issue or should I create a new issue?

OS: Kubuntu 21.10

Hardware: Intel i7, 16GB RAM

@andre-sb
Copy link

All recent releases of Logseq uses approximately 15% of my CPU when open, even if I'm not interacting with the program at all.
I noticed the CPU usage drops to 0% when I minimize the window.
Reindexing the graph doesn't change the situation.
I'm currently using 0.7.4, on Ubuntu 20.04, Intel i7, 32 GB Ram

@bpauw
Copy link

bpauw commented Jun 20, 2022

I've observed the same behavior on my system.

For single-core utilization, logseq idles between approximately 11% - 15% for me.

This seems to happen regardless of how I have used the program.

Here is the view of logseq in Gnome System Monitor when I disable "divide cpu use by number of cpus".

image

Logseq: 0.7.4 from flathub
OS: Fedora 36
Processor: Intel 11800H
Memory: 32 GB

@cnrpman cnrpman added the ux label Jun 20, 2022
@bpauw
Copy link

bpauw commented Jun 21, 2022

I've now tested this both with Logseq from flathub, which runs in xwayland, as well as the 0.7.4 logseq appimage, with --enable-features=UseOzonePlatform --ozone-platform=wayland.

When running the appimage with OzonePlatform it was missing the title bar. However I verified that it was running in wayland, and I was able to load one of my graphs in it.

From a quick spot test, it appeared that the CPU use was roughly the same between the flatpak running in xwayland and the appimage running in wayland.

@JuneKelly
Copy link

JuneKelly commented Jul 16, 2022

I have the same problem. Logseq, while idle, chews up about 20% of a CPU core.

I'm using version 0.7.6, installed via flatpak, on Fedora 36 (with Wayland). By comparison, the Obsidian desktop app consumes barely anything.

@cnrpman
Copy link
Collaborator

cnrpman commented Jul 16, 2022

@JuneKelly @bpauw @andre-sb
We need to locate the issue.
Starting from which version the abnormal CPU consumption is observed?

@bpauw
Copy link

bpauw commented Jul 16, 2022

@cnrpman I seem to be getting better performance now than I did before. I'm using logseq 0.7.6 at the moment.

Between the two active logseq processes, it seems to be idling at roughly 4.5-6%.

@JuneKelly
Copy link

JuneKelly commented Jul 17, 2022

Update: I get the same results when logged in to an Xorg session. So it seems to be independent of Wayland/Xorg.

EDIT: I also don't recall when the problem began. I just noticed the machine seemed to be under an unusual amount of pressure considering what was running, and that prompted me to check the performance monitor.

@andre-sb
Copy link

@cnrpman I noticed the issue since I started using Logseq in January/22. Sorry I can't recall the exact version.

@bpauw
Copy link

bpauw commented Jul 18, 2022

I've been watching LogSeq's idle CPU usage over the past 3 days, and it seems to be quite variable.

In my test from 2 days ago, I booted up Logseq and tried viewing a few pages that I thought had high cpu usage before. In that test, none of them seemed to go above 4.5-6%.

I usually keep Logseq open all day, and so I've been keeping an eye on the cpu usage as I go about my day. When I check I'll always watch the cpu monitor for a few seconds to give Logseq a chance to level off its cpu usage.

Yesterday and today I've seen my logseq instance idle cpu at 4.5%, 15%, 30%, and (currently) 70% (single core equivalent).

I'm not sure how to be more helpful in diagnosing this because I can't seem to intentionally replicate this. When I start logseq from cold, it usually idles at 4.5 - 6% (single core equivalent). But when I leave it on throughout the day I see all kinds of widely varying amounts of cpu use when it is idling.

@winterlich
Copy link

winterlich commented Jul 27, 2022

It seems like are reported cpu usage issues are from linux based operating systems, so far. In my case, this issue occures not only on my debian based workstation, but also my windows11-based laptop utilizing a up-to-date cpu (and gpu). If i recall correctly, these kind of problems started for me during the last months....

@cnrpman
Copy link
Collaborator

cnrpman commented Jul 28, 2022

@winterlich Sound it's related to the content.
Do you mind sharing your graph for us to debug?

There's another report on Windows, which says has realized the lag for a while: #6198

@tiensonqin
Copy link
Contributor

Do you guys use flashcards? How many cards do you have? This might be an issue related to cards because logseq will calculate the cards periodically. If possible, can anyone send us a recorded profile?

Figma has a nice short post on how to record a performance profile here https://help.figma.com/hc/en-us/articles/360041468414-Record-a-Chrome-Performance-Profile.

@cnrpman
Copy link
Collaborator

cnrpman commented Jul 28, 2022

Sounds to be related to #6152 if it's related to the number of cards

@andre-sb
Copy link

andre-sb commented Jul 28, 2022 via email

@cnrpman
Copy link
Collaborator

cnrpman commented Jul 29, 2022

@andre-sb Thank you for your information.

@JuneKelly
Copy link

JuneKelly commented Jul 29, 2022

I don't use flashcards, and I don't have that many pages/nodes.

@cnrpman
Copy link
Collaborator

cnrpman commented Jul 29, 2022

@andre-sb @JuneKelly Can you record a profile and share?

Figma has a nice short post on how to record a performance profile here https://help.figma.com/hc/en-us/articles/360041468414-Record-a-Chrome-Performance-Profile.

@JuneKelly
Copy link

Sure, here's a 20-second profile with logseq sitting idle: https://www.dropbox.com/s/jnahdux6ln7q13v/june-k-logseq-profile-20220801.json?dl=0

@cnrpman
Copy link
Collaborator

cnrpman commented Aug 1, 2022

@JuneKelly Interesting. Seems the JS process of Logseq is quite idle according to the performance profile...

@JuneKelly
Copy link

Interesting. I wonder if this is relevant? In htop, it's these processes with --type=renderer that seem to be running all the time.

Screenshot from 2022-08-01 11-20-50

@cnrpman
Copy link
Collaborator

cnrpman commented Aug 1, 2022

@JuneKelly Sounds to be an issue of the upstream (electron).

@cnrpman cnrpman added upstream Blocked by upstream deps electron labels Aug 1, 2022
@y1450
Copy link

y1450 commented Aug 1, 2022

I am also facing the same issue, but I noticed that when local graph is shown in the sidebar, the cpu usage
is around 15-25 % , if you don't use the graph then it is around 3-5%.

Maybe this information would be helpful to debug the problem. Let me know if you want any logs , video etc.

@Haptein
Copy link

Haptein commented Aug 2, 2022

I am also facing the same issue, but I noticed that when local graph is shown in the sidebar, the cpu usage is around 15-25 % , if you don't use the graph then it is around 3-5%.

FWIW this is similar to what I experienced on #4119.

@andre-sb
Copy link

andre-sb commented Aug 3, 2022

@andre-sb @JuneKelly Can you record a profile and share?

@cnrpman, here is a short profile, hope it helps:
Profile-20220802T120927.zip

@jirutka
Copy link

jirutka commented Aug 6, 2022

I’m facing the same problem. I use Logseq in Flatpak on Linux (5.15.57), Sway, XWayland (Logseq doesn’t even start in wayland mode due to electron/electron#32487), integrated GPU. I just started using it, so my graph is tiny, no flashcards.
Electron is no doubt a horrible piece of crap, but I don't have this problem with other electron craps apps. Maybe it’s also related to that outdated Electron version Logseq uses?

@cnrpman
Copy link
Collaborator

cnrpman commented May 18, 2023

Any update on this?

@cnrpman cnrpman removed the ux label May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
electron os:linux :type/performance Performance related, speed or cpu usage. upstream Blocked by upstream deps
Projects
Status: 🗄 Backlog
Development

No branches or pull requests