-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 Consumed #4370
Comments
Thanks for opening your first issue here! |
Sounds like you have a handle on the problem already! Seriously though, memory problems are the biggest issue in Bisq UI at the moment and unfortunately seem to be inherent to the underlying (GUI) JavaFX library. For instance if you run the command line version of Bisq (seed_node) it consumes only 10% of the memory than the one that includes a GUI. The most promising solution would be to use Bisq as a daemon running on the same box as your fullnode, and connect to its API via a lightweight client. This is not ready, but coming soon! (TM) |
Firefox as a web browser is significantly more complex than Bisq, yet consumes far less CPU, unless I have half a dozen charting tabs open, or streaming videos. And graphically speaking, Bisq, by comparison is far less complicated. I can also regularly run Firefox with a couple tabs of say, Github, reddit, or Facebook, rarely breaking 30% CPU, and only when I'm loading a page. I say all of that to prevent anyone from just hand waving this away. Just sitting there doing nothing in a totally separate workspace should not be consuming 90% of my CPU every 20 seconds. I had a similar problem with the Monero wallet, and they replied with a solution related to QML_SCENE within 15 minutes, which totally fixed the issue. I just now tried allocating 12GB of memory to my BTC Node / Bisq VM, bu that did very little. My password, from the moment the popup arrived, to actually accepting the input, was about 2-3 minutes total. Typed the password and hit enter, and watched for 60 more seconds for Bisq to catch up ... character .... by ......... character ..... by ......[you get the idea]. To sum up: Yes it's inconvenient not having OpenGL, but this is not a showstopper for other apps I use that are far more graphically intensive than Bisq. I personally would find it preferable to fix, I'm guessing a not insignificant number of people use Bisq on Qubes. But I also admit I have no idea how difficult this problem would be understand root cause and fix. I suppose I can abandon the GUI and go CLI if the GUI ever becomes totally unusable for me. |
Those issues are all related to Linux versions. The RAM usage is likely a JVM setting issue, I have not followed the discussions but I think some people have found already something. I dont know about Qubes but might be that the JVM/JFX implementation has issues there. |
Did you setup the qube as described in #4386 (or similar)? Particularly relevant are the RAM and CPU settings. |
I also see a lot of CPU consumption of bisq GUI on gentoo linux after manually building bisq with JDK 11. Perhaps, using java GUI was a mistake? |
Make sure you have enough free RAM available (about 4GB). Also have a look at https://bisq.wiki/Performance_Tips |
I have 32GB RAM. |
@crocket If you cpu is a more or less decent one there should not be a problem. I can run several bisq nodes without issues (OSX). I guess it some local config issue on linux. Also 1 GB ram is normal that bisq consumed, not much more. Max. 2 GB. Java takes what it gets from the OS so if u have 32GB it takes more, but that if there is not enough ram it can run even with 500 MB (as i saw when i started 10-20 apps) and it still worked just getting slower when switching between apps. There have been a GH issue with recommended settings for Linux. Should be added to the wiki page... |
I think that is mainly issue on Linux. We really should collect the information gathered to solve that. I think it was some JVM setting which has on Linux a weird default value. |
@ghubstan has investigated it while back can here was his conclusion: @ghubstan: Are those recommended settings confirmed/tested? If so @ripcurlx can we get those added to the linux builds? If not, we should add it to the https://bisq.wiki/Performance_Tips page. Here was some other investigation: |
A few minutes after startup, bisq-desktop stops consuming a lot of CPU resource and its GUI becomes useable. |
Have you tried the settings described in above links? |
Are you telling me to assign more RAM to JVM? |
No, its about limiting RAM. |
From @crocket
A long chain sync at startup locks up the UI thread until it's done, gobbles This is a problem I have not been able to solve. The only way I know of giving the large amount of off heap memory Bisq used to sync the chain back to the OS: From @crocket
Don't fiddle with the jvm ram options. I'll expain more in some of the following comments. |
I spent a lot of time in Feb 2020 profiling Bisq's RAM usage on Linux (Ubuntu), followed by some conclusions detailed here. Long story short, I found three types of problems, but no perfect solutions yet.
Setting JVM's MaxRAM My OpenJDK 11 JVM is configured with a default MaxRAM setting of 128 Gb, while my machine has only 32 Gb. To check yours...
I show how adjusting (lowering) the jvm's Today, the bisq-desktop startup script sets this value to 4Gb by including the setting on the java command: JavaFX Memory Leaks One of the major sources of these problems is the JFX 11 dependency. The upgrade to JDK 15 will allow us to also upgrade Bisq's JFX dependency, which I do hope will not be as leaky. The newer JFX will have many leak related bug fixes -- and hopefully not too many new leak related bugs. Pasted from an earlier comment on the subject.
Well, that sucks. Yes, it does. If anyone can advise on how solve these difficult problems, do tell! I would get right to work, but moving off Java is not an option in the near or medium term. I'm not going to spend time here defending or bashing Java because I'm more worried about my nice, fast GPU's native GPU driver that crashes my machine at random times, sometimes right after clicking a browser tab. |
BitcoinJ is woing its work on a dedicated thread but as it takes 100% of available CPU it also slows down the userthread. The DAO sync is running on userthread but the BSQ tx verification itself is super fast and the the problem. I think the problme is some client code reacting on state changes and doing expensive operations (e.g. lookups). There have been done some improvements already but I think there is more needed, but not a trivial task... To isolate the problem to BitcoinJ sync one can add --daoActivated=false, so the DAO sync will not be done (whole DAO domain is not activated). |
@oscarguindzberg Are you aware of any memory issues from BitcoinJ side at block download? Might be that it is only an issue on Linux (and maybe only at some distributions). |
Have you tried with a headless app to see if it related to JavaFx? |
Is that Linux only? |
@ripcurlx How long do you think it takes for the Java upgrade? Maybe we should increase priority and work force to get that out asap as those problems are repeating since too long and we lose for sure a lot of users by that. |
I suspect its the concurrent seednode connections via tor, that happen during "Synchronizing DAO". Last time I checked, tor connections go via some sort of io-blocking bottleneck. I noticed similar effects with the connections to the bitcoin nodes - connecting to them via clearnet caused less CPU overhead and was generally faster. Similar effect if I chose to use 1 tor bitcoin node, vs multiple (1 node was faster, smaller CPU spike). This was a few months ago, so not sure if it's still the case. But it might indicate that highly-active concurrent tor connections may cause/contribute to the CPU spike due to how multi-threading/IO is managed there. |
I am not. |
This is expected as Tor is slower and as the connections get clogged by multiple requests.
So in the worst case we do 3 data requests at the same time: Btc blocks, Bisq data, BSQ blocks. Additional there are price feed requests (I think those are quite lite compared to the rest). The initial data requests have been improved by 50% in 1.4.2 and in 1.5.2. we get anoute 25% less data (AccountAgeWitness data will be handled via HistoricalDataStore). So that will help overall to reduce bandwith requirements. |
Yes, the headless daemon needs far less heap and off-heap memory. I've not seen a single OOME using the api daemon to sync the entire chain. But, I have never let the api daemon run for days or weeks. I want to add (edit) here... if you remove that new The virtual memory files without that jvm setting are also much larger. Using the |
I think most of the complaints about JFX leaks are Linux related, and I can only talk about the problems I've seen while profiling on Linux. (I don't have a Windows machine.) I have seen problems on OSX, but I have a mac-mini with 8Gb of ram and a slow processor; it is not a fair comparison. |
Is there a way to make the thread run in the background? The priority of the thread should be low so that it doesn't slow down other programs. |
Could it be related to this? #4649 (comment) From what I've seen, "Synchronizing DAO" (which shows the progress bar) is dirrectly correlated with UI sluggishness. Whether it happens on startup, or periodically while Bisq is running:
|
Doing the chain download off the main jfx application thread was attempted, but didn't work. (Not sure when it was tried -- a long time before I started working on Bisq.) |
You refer to the BTC block download? That is threaded... The DAO parsing is not the bottleneck, that is very fast and the risk and complexity to do that threaded was not worth the performance difference, in fact it was slower due threading overhead. The problem is likely client code which gets executed on DAO state change, and some expensive methods (iteration, lookups). There have been done some improvements already but it requires more. |
@BawdyAnarchist we disabled some CPU-intensive animations in the latest release - the "Synchronizing DAO" progress bar in the footer and the spinner shown when querying if an offer can be taken. Since you reported performance issues with Bisq, I wonder if you could try v1.5.5 and see if there is any improvement? |
@crocket we disabled some CPU-intensive animations in the latest release - the "Synchronizing DAO" progress bar in the footer and the spinner shown when querying if an offer can be taken. Since you reported performance issues with Bisq, I wonder if you could try v1.5.5 and see if there is any improvement? |
I just tested 1.5.5. CPU consumption is still high during synchronization, but other GUI programs don't stutter while bisq-desktop is synchronizing. Detach synchronization from bisq GUI. You will see smoother bisq GUI. I think you can prevent synchronization thread from using the same CPU cores that bisq GUI uses. |
FYI: This should be further reduced in the most recent release (v1.6.4) which brings several UI performance improvements and generally reduces system resource consumption. |
Description
I have been using Bisq for a couple years, on Qubes exclusively. I have always had problems with very high CPU usage (60-99%) to run the app. Very delayed entry of password. Long delays between clicking a button and the popup window. Even longer for the text in popup windows to show. Every 10 to 60 seconds it spins itself up to nearly max CPU for 10-30 seconds.
Synced to my own node. Bisq DAO turned off. 4GB RAM allocated to a dedicated Virtual Machine
Version
All .deb
1.3.2
1.3.4
1.3.6
And all versions since Jan 2019
Steps to reproduce
Start the application, watch it consume nearly max CPU for 2-4 minutes just to start, allow it to sync, once synced, it still continuously cycles near max CPU. Even my Bitcoin Node doesn't consume these resources.
Expected behaviour
Not spin up any CPU if not doing anything. Low delay time
Device or machine
Purism 15v4, Qubes 4.0.3, Whonix-15 virtual machine
The text was updated successfully, but these errors were encountered: