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

CPU usage #2180

Closed
c--w opened this issue Oct 31, 2024 · 6 comments
Closed

CPU usage #2180

c--w opened this issue Oct 31, 2024 · 6 comments
Labels
✨ Feature A feature you'd like to be added

Comments

@c--w
Copy link

c--w commented Oct 31, 2024

Description

Homarr uses more CPU than all of my hosted applications - while other apps use max 5% CPU Homarr processes:
next-render-worker-pages
next-router-worker
cause regular spikes up to 15%
It's not much but I have many, many services and in idle state none of them use more that 1-3% CPU (and only occasionally)
In contrast, above 2 processes spike to 10-15% CPU combined every 12-15 sec. It is enough to raise CPU temp from 35-38˘C to 40-45°C on all 4 cores.
I tried searching for widgets refresh rate setting fearing that this may be the cause but I found nothing, Is there a way to lower CPU usage by adjusting some Homarr setting?
I use latest Homarr docker image (installed today) on Ubuntu 22.

Priority

Medium (Would be very useful)

@c--w c--w added the ✨ Feature A feature you'd like to be added label Oct 31, 2024
Copy link

Hi 👋. Thank you for submitting your first issue to Homarr. Please ensure that you've provided all nessesary information. You can use the three dots > Edit button to update your post with additional images and information. Depending on the current volume of requests, the team should get in conact with you shortly.

@abbott
Copy link

abbott commented Nov 1, 2024

Similar issue here. Homarr 0.15.4 is causing persistent CPU utilization (background) in Arc Browser Version 1.66.0 (55166) on Sonoma 14.7 making my M1 Max uncomfortably hot 🥵

@manuel-rw
Copy link
Collaborator

manuel-rw commented Nov 1, 2024

Hi, thanks for the feedback.
Homarr 0.15 runs on a quite old Nextjs version which is not as performant as newer versions. 1.0 will upgrade Nextjs and improve performance significantly while reducing RAM and CPU footprint. See #1993. We will not optimise for this version of Homarr as it's no longer being worked on and we are focusing on 1.0

Also, 40-45°C is absolutely normal and of no concern for modern CPUs. Laptops can easily reach 90°C under load.

I'd like to note that Homarr currently scales very bad with the amount of users - there more you have the worse it gets. 1.0 completely reworks this and has a complexity of O(1) - this means it won't change no matter how many users you'll have (only factor are count of integrations configured)

@abbott
Copy link

abbott commented Nov 2, 2024

Thank you for the reply @manuel-rw.

Homarr 0.15 runs on a quite old Nextjs version which is not as performant as newer versions. 1.0 will upgrade Nextjs and improve performance significantly while reducing RAM and CPU footprint.

Scratching my head, Next.js is a framework not a compiled product. Is there a known CPU utilization bug that is present in Next.js 13.4.2? With all do respect, it is exceptional for a utilization bug to stem from something other than the lines of code within a given project (i.e., Homarr).

I'd like to note that Homarr currently scales very bad with the amount of users - there more you have the worse it gets.

For my single-user install I am seeing the following in Homarr 0.15.4 and 0.15.6 which is causing tremendous heat. I have acquired, maintained, and repaired MBPs for 15+ years, when Homarr is open (foreground or background) my Apple Silicon MBP heats heats up like an Intel-era MBP.

Screenshot 2024-11-01 at 20 53 28

@manuel-rw
Copy link
Collaborator

manuel-rw commented Nov 2, 2024

Thanks for the questions. Seems like I caused some confusion, let me re-explain:

  • We have two parts. The frontend and the backend. Nextjs is a framework that we use for Homarr and which takes care of APIs, routing, SSR and more. We still run on an older framework version which is less performant, especially because newer versions can do more on the server and have been optimized significantly. Except waiting for 1.0 there isn't something you can do here
  • The main reasons why Homarr consumes significantly more than other tabs in your browser include.
    • Layout shifting (see https://developer.mozilla.org/en-US/docs/Web/API/LayoutShift) is the process were elements shift the size or position of other elements. Because of the complex grid we have tons of layout shifting in Homarr 0.15. Shifting is very bad because it will impact performance with a huge hit and causes lag - especially on low end devices. Sometimes this shifting can also happen without you interacting with the page and just looking at it.
    • Widgets currently request in a specific interval with requests to the API. This is highly unoptimized and Homarr 1.0 (which will come soon, see 📢 Announcing our work on version 1.0 #1993) uses websocket and subscriptions to reduce overhead & delay. Additionally we leverage some features of Nextjs that optimize how components are rendered. Currently we have dashboards in Homarr 1.0 with no lag when loading the page and approx. 30% of the CPU usage compared to my own private 0.15 dashboard (notice: this is when running the development server, your numbers may vary).
  • Currently Homarr also relies on a synchronous integration system - this means that your client will communicate in a direct manner with the server which will send the request to your integration. This causes a lot of waiting times and overhead which we completely got rid of in 1.0

With all do respect, it is exceptional for a utilization bug to stem from something other than the lines of code within a given project (i.e., Homarr).

You're absolutely right here. Obviously newer Nextjs versions have gotten better performance but the main culprit in 0.15 is our code and missing optimization. I have not stated otherwise.

when Homarr is open (foreground or background) my Apple Silicon MBP heats heats up like an Intel-era MBP.

I don't own an Apple device. Therefore I also have no context for what is normal or not. If you believe that there is an additional bug that is causing higher usage on Apple silicon devices (M1, ...) then please let us know.

To improve performance, you can try to:

  • Check logs for network errors. Those greatly impact performance and lag
  • Remove widgets that cause lag?
  • Not leave the dashboard with the edit mode open

To reiterate, this is an issue that we're fully aware of and we are not happy with the performance ourselves. We decided to rework Homarr source code exactly for reasons like this. If you want to try out 1.0, consider joining our early adopters program (not production ready).

Does this answer your questions? Please let me know if something is still unclear - I'm happy to elaborate if needed.

@manuel-rw
Copy link
Collaborator

I am closing this ticket because the questions have been answered.
Please let me know if you have any follow up questions.
Stay tuned for 1.0 :)

@manuel-rw manuel-rw closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature A feature you'd like to be added
Projects
None yet
Development

No branches or pull requests

3 participants