Nextcloud version: (30.0.2)
Operating system and version: Unraid 6.12.13
Database: Maria DB 11.5.2
I’m running Nextcloud on a homeserver with 16 GB RAM and a 4 TB NVMe disk on Unraid. My family (four people) are the only users and besides some synchronisation of photos taken on the mobile devices, Nextcloud most of the time just sits there without much to do.
Nevertheless I noted, that the home server is pretty hot and one of the CPUs is always at 30%. Looking more closely I found, the there are per month about 3 billion read operations and 8 million write operations on the NVMe per month.
Playing around I noticed, that the usage of CPU and read/write operations stops, when I stop the Nextcloud container.
So I started a bin log of the MariaDB database.
Result: Nextloud is sending A LOT of statements to the database, even if nobody is logged into Nextcloud.
Any ideas how I can calm down Nextcloud?
Here’s a snippet of the stuff that is repeating again and again (all the time):
START TRANSACTION
/*!*/;
# Annotate_rows:
#Q> UPDATE `oc_appconfig` SET `configvalue` = '160', `lazy` = 0, `type` = 2 WHERE (`appid` = 'backgroundjob') AND (`configkey` = 'lastjob')
COMMIT/*!*/;
START TRANSACTION
/*!*/;
# Annotate_rows:
#Q> UPDATE `oc_jobs` SET `reserved_at` = '1731344701', `last_checked` = '1731344701' WHERE (`id` = '161') AND (`reserved_at` = '0') AND (`last_checked` = '1731344401')
COMMIT/*!*/;
START TRANSACTION
/*!*/;
# Annotate_rows:
#Q> UPDATE `oc_jobs` SET `last_run` = 1731344701 WHERE `id` = 161
COMMIT/*!*/;
START TRANSACTION
/*!*/;
# Annotate_rows:
#Q> UPDATE `oc_jobs` SET `execution_duration` = 0, `reserved_at` = 0 WHERE `id` = 161
COMMIT/*!*/;
START TRANSACTION
/*!*/;
# Annotate_rows:
#Q> UPDATE `oc_appconfig` SET `configvalue` = '161', `lazy` = 0, `type` = 2 WHERE (`appid` = 'backgroundjob') AND (`configkey` = 'lastjob')
COMMIT/*!*/;
START TRANSACTION
/*!*/;
# Annotate_rows:
#Q> UPDATE `oc_jobs` SET `reserved_at` = '1731344701', `last_checked` = '1731344701' WHERE (`id` = '162') AND (`reserved_at` = '0') AND (`last_checked` = '1731344401')
COMMIT/*!*/;
START TRANSACTION
/*!*/;
# Annotate_rows:
#Q> UPDATE `oc_jobs` SET `last_run` = 1731344701 WHERE `id` = 162
COMMIT/*!*/;
START TRANSACTION
/*!*/;
# Annotate_rows:
#Q> UPDATE `oc_jobs` SET `execution_duration` = 0, `reserved_at` = 0 WHERE `id` = 162
COMMIT/*!*/;
START TRANSACTION
/*!*/;
# Annotate_rows:
#Q> UPDATE `oc_appconfig` SET `configvalue` = '162', `lazy` = 0, `type` = 2 WHERE (`appid` = 'backgroundjob') AND (`configkey` = 'lastjob')
COMMIT/*!*/;
Tell us which image specifically you’re using (there are many including third-party ones)
Post your config (occ config:list system)
Tell us which apps you have installed (occ app:list)
You might also consider adjusting your logging within Nextcloud itself (loglevel) temporarily to get a bit better idea of what jobs are running and what they’re doing.
Database: Maria DB 11.5.2
Lastly, note that Nextcloud Server isn’t spec’d for MariaDB 11.5.x, which is a short-term release. Only LTS releases are officially supported[1][2]. I’m not saying this is the the cause of your issues, but it is relevant to mention given the context.
If the CPU load really comes from mariadb and is outside the 5 minute cron jobs, try to find out more about the MariaDB. Logs of the MariaDB, connections, CPU consumption, memory consumption, …
If Nextcloud is not used and the 5 minutes are not reached, Nextcloud should not perform any database queries at all, as no PHP programme accesses the database.
Logs seems for me ok. Logs from every 5 minutes cron job.
Well, these log entries re-occur every few seconds, not minutes. I checked the longer version of binlog: the statements get repeated seeral times a second - then there is a pause of 20 to 25 seconds an it starts off again…