Hi, after upgrading to 2023.4.2, I noticed that my database backend, which is running MariaDB on another host, is doing alot of disk writes, about 5 - 20 MB/s (as reported by htop and iotop).
I have stopped other services using the database, and it is HA alone that is the reason for all the writes.
If I stop HA, the writes also stops.
# mariadb --version
mariadb Ver 15.1 Distrib 10.5.18-MariaDB, for Linux (x86_64) using EditLine wrapper
# mariadb -u root --password
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 150658
Server version: 10.5.18-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> SHOW PROCESSLIST;
+--------+------+------------+---------------+---------+------+----------+------------------------------------------------------------------------------------------------------+----------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+--------+------+------------+---------------+---------+------+----------+------------------------------------------------------------------------------------------------------+----------+
| 219 | rosa | rosa:56626 | homeassistant | Sleep | 3 | | NULL | 0.000 |
| 221 | rosa | rosa:50452 | homeassistant | Query | 0 | Updating | UPDATE events SET context_id=NULL, context_user_id=NULL, context_parent_id=NULL, context_id_bin='؈? | 0.000 |
| 222 | rosa | rosa:50454 | homeassistant | Sleep | 4 | | NULL | 0.000 |
| 223 | rosa | rosa:50468 | homeassistant | Sleep | 6 | | NULL | 0.000 |
| 336 | rosa | rosa:55848 | homeassistant | Sleep | 5 | | NULL | 0.000 |
| 150658 | root | localhost | NULL | Query | 0 | starting | SHOW PROCESSLIST | 0.000 |
+--------+------+------------+---------------+---------+------+----------+------------------------------------------------------------------------------------------------------+----------+
6 rows in set (0.000 sec)
What configuration have I done wrong? My HA installation resides on a Raspberry Pi 4 Model B Rev 1.1, and has been happily running for 3+ years now.
I would like to find the reason heavy disk usage and fix it, but am willing to nuke the whole database and start out fresh if that is what is needed…
Any suggestions on how to debug this?
My recorder config is as follows:
recorder:
db_url: !secret mariadb_connection_url
auto_purge: false
purge_keep_days: 9999
The mariadb_connection_url
is in the following form:
mariadb_connection_url: mysql://HOST:PW@IPADDRESS/homeassistant?charset=utf8
My backend has plenty of space, but the database is now ca 107 GB (was 106 GB yesterday).
I thought I could just keep all the data there, and not purge, since I do have the space - but why is so much data written to it every single second?
Keywords: database, mysql, mariadb, backend, recorder.