uvjim / linksys_velop

Home Assistant integration for the Linksys Velop
42 stars 6 forks source link

Frequent CPU Usage Spikes On RasPi5 #472

Open iSteve-O opened 3 weeks ago

iSteve-O commented 3 weeks ago

I don't know if this is a real issue per se but I wanted to raise it anyway. My pi typically runs around 1-3% CPU usage most of the time, but when this integration is enabled there are frequent spikes in usage about once a minute to at least 5-7% but as much as 15% CPU usage. I just would not expect this integrations to use this much CPU at these intervals.

Without Integration Screen Shot 2024-06-13 at 11 42 37 PM

With Integration Screen Shot 2024-06-13 at 11 42 03 PM

I apologize if I shouldn't be raising this. I really appreciate this integration for the ability to reboot the mesh!

uvjim commented 3 weeks ago

The integration polls for data from the mesh and then calculates a few things based on that. So, a mesh with a large number of devices could use more resources than a smaller one.

What do you have the timings set to? Do you have any device trackers enabled?

iSteve-O commented 2 weeks ago

The integration polls for data from the mesh and then calculates a few things based on that. So, a mesh with a large number of devices could use more resources than a smaller one.

What do you have the timings set to? Do you have any device trackers enabled?

I have around 50 devices connected to my 3-node mesh, but I am not using any for trackers or UI devices. In fact, the only part of the integration I am actively using is the reboot mesh feature, but I do see how the rest could be really useful.

Currently I have the main scan interval set to the default 60 seconds, which seems to be the culprit, so I suppose I can raise that to significantly decrease the frequency of spikes. The scan interval for device trackers is set to 10 but since I don't have any trackers defined this probably isn't affecting anything and the spikes are around 60 apart.

I do appreciate your response. I guess what you are saying is it just needs that much CPU to parse all of that data. I thought maybe something was amiss. If this is the case the issue can probably be closed.

uvjim commented 2 weeks ago

My set up sounds similar to yours in terms of size (I have a 4th node for an area that would typically be a dead spot).

I have it running on an RPi 4 and don't notice anything amiss, but I'm not actively watching resources either.

There is some processing that I can refactor to make "opt-out". That processing relates to firing events for new nodes and devices. It would have to be opt-out otherwise it would be a breaking change for some I guess.

I'll see what I can do and we can revisit this to see if that helps.