Recorder creates high CPU usage


Since the 19th of october I have had issues with high cpu usage. Normally it’s between 6-8% (running on a NUC).

But since the 19th of October around noon, the usage started to increase and have now been static on 28-30% and the cpu temp also increased with a little more than 10 degrees.

I’ve been trying to find the root cause for this and after a while I was able to isolate it to the database, so I switched from MariaDB to the built in and that solved the problem for roughly 2 hours, then the behaviour was back. Switched back to MariaDB and it was fine for an hour and then the usage started to increase again.

Next was to start to fiddle around with the recorder and right now I’m running with a disabled recorder and the cpu usage is to normal levels again.

Anyone else had this issue and have any ideas how to solve it long term? I don’t see disabling the recorder to be a long term solution.

Use exclude: to remove everything from the recorder you don’t need. Or Use include: to only record things you do need, whichever is easiest.

Yeah, that’s in the documentation, but that doesn’t really help.

I’ve tried with:

      - lock

And I’ve only got 2 locks, so that shouldn’t create a lot of pressure on the DB.
That still gives the same effect, the only way to completly kill recorder is to point it to a non-working db_url.

Anything obviously wrong showing up in your logs?

Nothing that wasn’t there before the 19th.

I’ve apparently done something wrong when including/excluding domains and entities from recorder.

What I did was that I started with a clean database and checked it after 30 min (roughly at the time when the CPU usage starts to increase) using the SQLLite Web add-on. There I found that I have a z-wave plug that creates 7 different entities and each of these enitities had around 1000 entries in the database.

Excluding those together with some other entities that had a high number of entries without me having any need of them in the database seems to have solved it.

Now on the second hour without any cpu increase, hopefully this was the issue.

Query to identify the entities if someone else has the same issue:

SELECT entity_id, COUNT(entity_id) AS Count

FROM states

GROUP BY entity_id


1 Like