This is my cpu usage on a single core 512MB Pi B+. If you are running at your levels on a quad core VM I think you need to take a look at the components you are running to see if they are hogging the cpu.
I mean, that’s the entire reason I run it on a beefy VM so that I CAN enable tons of components. Is there any way to figure out what might be causing the usage without disabling things one by one? That could take weeks, I have quite an extensive config: https://github.com/danodemano/Home-AssistantConfig
EDIT: I looked through your config and nothing jumps out as a potential problem. You could do what I did and try to setup a mirrored system that runs parallel to it. Not ideal, but it allows you to pump data through it and see if disabling something causes the problem to go away. If you get lucky maybe you’ll figure it out while you are setting up the duplicate system.
Too bad there isn’t a way to profile the HA runtime, then this would be easy.
So I messed around a bit, starting with the SNMP sensor that that one was throwing a lot of warning as well. That seems to have greatly reduced the timer out of sync errors. It also dropped my CPU/memory usage significantly:
I’ve only have 5 timer out of sync’s over the past 1.5 hours. Prior it was every few minutes at least.
I agree, a was to profile the runtime would be a HUGE help. I’m going to let it run like this for a day or two before making any other changes and see what happens. Thanks all!
I just started seeing this with the latest update. I have run merrily along on a rPi 3 for quite some time without problem.
After the update I am also seeing:
Updating rest binary_sensor took longer than the scheduled update interval
Error getting new camera image: RawResponseMessage(version=HttpVersion(major=1,....
Wow, thats a massive difference. Yeah HA really shouldnt be using alot of CPU up, unless it’s triggering ffmpeg or doing some form of audio processing.
I run Node-RED and my performance with HA was bad before adding Node-RED and Node-RED didn’t make it faster either. Under normal operation, my Node-RED instance takes less CPU than HA (which isn’t shocking, since javascript is a good bit faster).
Now, this isn’t to say that Node-RED isn’t at fault, just that it isn’t inherently at fault. If you have a timer in Node-RED that causes it to pump tons of service calls into HA it’ll probably bring HA down.
Yeah looking at htop node-red is taking just a few percent of the CPU, WAY less than the HASS instance. What do you mean by timer, something that is constantly querying HASS? I have a couple of event states but most of it is triggering lights and such in HASS or checking if a switch is on or off when running a flow.
I just mean anything that can trigger messages in node-RED and cause your flow to call an excessive amount of service calls (the non-ws node uses the http REST API for service calls). A hypothetical would be you meant to trigger a service call in HA once per minute, but thanks to a typo in your flow/code instead you are making thousands per second. Not likely, but you should make sure node-RED is behaving.
Ahh ok. I just went through all my flows and everything looks correct. I also just shut down node-red for a few minutes with no appreciable difference in CPU/RAM usage:
So, interestingly enough, it appears the overnight spike is MySQL. It’s still high right now so I jumped in to take a look and MySQL is hammering the CPU:
Odd. I’ve moved over to a different platform (from pi) and stopped getting the timer out of sync errors, but through the night I keep having trouble with Bluetooth where homeassistant can’t connect to the dongle (so it then marks us away, then home, then away etc).
I’ve been trying to get my head around it because it only happens in the middle of the night.
If something else is suddenly hogging resources at that time, might explain it. Further investigation required
For those not following the github issue, this is (at least partially) related to the recorder purge. It seems that MySQL is taking 9-12 HOURS to run the purge query slamming one CPU core that entire time. There is a PR in right now that re-writes the query which should eliminate this problem: https://github.com/home-assistant/home-assistant/pull/12448
Once that rolls out we’ll see what my performance looks like and if the out of sync messages are still there.