OSMC/Kodi is hitting my microSD HARD from time to time

Fully upgraded OSMC (2020.03).

I leave my Raspberry PI 3B+ running 24/7. No extra addons, no background daemons beside SSH.

From time to time (every couple of days of so), the GUI becomes unresponsive for minutes. If you leave it alone, it will eventually come back to life after a few minutes, frequently to be slow and finally Kodi crashes (not always). During the unresponsive phase, the green LED (microSD activity) shows a solid green status. For minutes. Apparently, Kodi is doing a lot of accesses to the microSD.

Current microSD card is A1 speed. I have tried half a dozen different microSD cards, same result.

I suspect some database queries are slow, maybe because Kodi would benefice from additional indexes. My Library is quite big: around 10.000 films and 30.000 shows. The database file is around 400 MB.

Maybe some memory leak?

Any suggestion to debug this?.

Thanks.

You could use iostat, iotop and check Kodi debug logs. The latter will probably be enough.

Considered a mariadb setup instead of indexing it to internal db ? that would minimize wear and tear