-
Notifications
You must be signed in to change notification settings - Fork 51
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
org-roam-server slows down unrelated interactive commands #44
Comments
First I thought it is related to org-roam-server/org-roam-server.el Line 316 in a245296
org-roam-server/org-roam-server.el Line 341 in a245296
but it is only executed if the file is an org-roam file and it has nothing to with httpd--filter . Does the performance issue persist after some time? Maybe it is taking some time to export and load all of the files. I have 68 org files and haven't had any issues like this.
(defun httpd--filter (proc chunk)
"Runs each time client makes a request." |
After initial high CPU usage caused by fancy animation of aligning items in browser window (I like it) and maybe some exporting (even though my files currently don't have any content, only majority of them have backlinks), CPU goes idle. This performance issues occurs anytime after that. Currently I have emacs running where I started This of course doesn't happen when org-roam-server-mode isn't on. |
Does the same thing happen if the |
No it doesn't. |
It shouldn't be a problem but to see if the size of the db is causing this, can you
|
With only 62 files, my "hold some movement key for couple of seconds" test produces better results: emacs freezes only for ~200ms every ~2 or 3 seconds and performance of other parts of emacs is acceptable. With 200+ files, emacs freezes for almost for ~1 second every 2 or 3 seconds when there is movement key pressed and all other usual heavy operation like filtering So yes, there is a correlation between number of files and performance. It corresponds to what I have been experiencing since I begun my brain-dump about 4 days ago. I first noticed slight drop of performance when there was about 50 files and when I was above 150, I begun to worried. If I understand the issue correctly, server is running inside of emacs and it receives request from client (browser) in semi-regular intervals. If the server (emacs) is busy with something else, addressing request from client at top of that may result in choking and lagging. |
I can't find anything that might be causing this issue. If I had a fast computer, I would think that I can't see this issue because it is handled so quickly but as you can see from the The only thing that came to my mind is full RAM. It is probably not but can you check your RAM while using the program.
|
I opened a http server in python and then tried to open org-roam-server to see if they will interfere with each other but of course as the socket is occupied it didn't start. |
Now I even tried this with vanilla emacs (just ivy/counsel, evil and org stuff). At the time of the test I had slightly over 2GB of RAM full. Afterwards consumption went to Some observation on this:
At the time when emacs occupies more then 4GB of RAM, the memory consumption rate speeds up to additional 100MB every 2 or 3 seconds according to But I am able to experience the performance choking issue right from the beginning when there is a plenty of RAM available. I have practically same hardware specs as you and my graph is proportionally larger, maybe slightly complicated. screenshot I will try this with emacs 26.3 and emacs 28 (now I am using 27.0.91 build few days ago). |
when
I am okay with anything random that can be tried because I am out of ideas. Your graph looks cool :D |
I have some updates: memory leak occurs with both emacs 27 and 28, it is serious (within 40 minutes emacs goes to 6+GB) and it doesn't occur with emacs 26 booting without apparmor and running browser without firejail didn't had any affect as expected For me the issue is performance of I am planing to have thousands of files across two or three slipboxes (roams). I really want to put everything out of my head, bytes are cheap I am telling myself. I expect the number of edges and nodes hit more then 1 thousand per slipbox. I first thought that maybe using hash tables and some kind of "intelligent" caching for those repeating calls would solve this, but now I am more inclined to implementing server functionality outside of emacs even if that means some compromises on functionality. But things like keeping track of current buffer would be still possible. I am not familiar with the whole functionality of org-roam-server, so maybe there will be some issue. I will start researching how to do this, I would like to come with some proof of concept as soon as possible. |
My graph is quite a bit larger than either posted in this thread, and performance is definitely an issue for me. I've started looking into this myself - I think you're right that ultimately we just can't be recomputing the whole graph every few seconds. I'm trying out web-server.el right now in a branch in my fork, which has a proper WebSocket implementation. Hopefully I can get it to a point where we watch I have no real point to make here, just wanted to post about it for visibility's sake. If anyone has any thoughts I'm happy to hear them. |
Only the json is calculated and if there is a change the network is calculated but of course adding a node doesn’t require a lot of computing. Does calculating the json slow down with large db? |
|
And with that much node, I assume you also have lots of edges. I don't know if it helps or works for this issue but maybe this can be added Checking for changes in a folder is a good idea but when only an edge is added it won’t be registered
@wohanley |
@wohanley As I said, I added |
Yes, this is a huge help to me! Everything is smooth with |
I am glad, it is solved. It is merged to master. The naming also changed from autoreload to poll. |
I am back with basic external org-roam-server hacked together in python. Performance is amazing. I had to do it because even with the Now I am enjoying org-roam without any limit. |
Awesome! |
Hi, I am relatively new to
org-roam
world, and I've been using it just few days. But I started to notice weird performance issues occurring when executing unrelated interactive commands and I think this issue is related toorg-roam-server
.Steps to reproduce
org-roam-server-mode
onorg-roam-directory
with ~200 filesorg-roam-find-file
in emacs andorg-roam-protocol
click inorg-roam-server
browser windowjk
scroll for couple of seconds (basically DoSing emacs)Now you can see that aside from expected
redisplay_internal
, there ishttpd--filter
taking most of the CPU time.full report
When I do something more natural in emacs, like searching for something in
M-x
and switching between few buffers, it is aserver-process-filter
which takes most of the CPU time.full report
Expectations
Emacs should not feel sluggish when doing things unrelated to
org-roam
.My setup
emacs 27.0.91, Arch Linux, vanilla doom emacs with
org-roam
andorg-roam-server
from github. Everything latest and up-to-date.The text was updated successfully, but these errors were encountered: