joshuar / go-hass-agent

A Home Assistant, native app for desktop/laptop devices.
MIT License
167 stars 11 forks source link

[BUG] Increased load with v10 #250

Closed fdw closed 2 months ago

fdw commented 3 months ago

Go Hass Agent Version v10.0.0

Describe the bug I've noticed that the load on my system has gone significantly up since I started v10 of go-hass-agent. I'd like it to go down again, maybe by updating less often.

To Reproduce Steps to reproduce the behaviour:

  1. Install the latest version
  2. Check the system's load
  3. See the increase vs v9

Expected behaviour I expected the load to be about the same.

Logs Nothing interesting there, I think.

Desktop (please complete the following information):

joshuar commented 3 months ago

Hey there @fdw!

That's a bit concerning, but before we dig in, how much is signifcant in this regard? In terms of, for example, total CPU % on the system, what are the values between v9 and v10 for Go Hass Agent? What kind of hardware/system is the agent running on?

To note, v10 has additional sensors and functionality and I am doubtful I can ensure that usage will remain constant with new functionality. 😬 Particularly when the data sources require polling (i.e. the agent needs to go fetch the data), like the new sensors added, which is probably the most costly way of getting the data.

Having said that, I have been looking at CPU profiling a lot since you filed this issue to see if I can't try to improve things 😜 I can see that the new CPU frequency sensors were causing an increase in CPU utilisation and I've adjusted the polling interval. These are also fetch in a more efficient way now. This will be part of the v10.1 release that will be next off the block.

What I am also slowly working towards is a way to make the polling interval of polled sensors and even selecting which sensors groups to get all user-configurable. That's been suggested in #171 and its a great idea. I'm hoping I can get that implemented soonish, at least in way where it can be configured via files as an MVP and then down the road in a UI.

Cheers!

fdw commented 3 months ago

I'm sorry, I tried to compare the load with go-hass-agent enabled and without, but I cannot reproduce my original problem. It now seems to depend more on other circumstances and even with it enabled, I can reach the usual low load (though not as often, but that is to be expected). Sorry for opening a ticket.

joshuar commented 2 months ago

Hey @fdw no problem! And no need to apologise! Good to hear the load is acceptable! I've released a new version which has the changes I mentioned earlier in it and I'm hoping those keep the load relatively consistent. Let me know if you do notice any odd increase though!

joshuar commented 2 months ago

I'm going to close this issue as I believe the load problem is resolved. If there is still an issue, please re-open!