Nextcloud server load unusually high

From Wurst-Wasser.net
Jump to navigation Jump to search

The Problem

I noticed the power consumption (measured with Shelly Plug S and Home Assistant is higher than usual (see also CPU comparison (bogomips))).

The Analysis

  • CPU load ist constantly around 1. That's too much for a mostly idling machine.
  • top reveals
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                         
 1221 mysql     20   0 2573120 283648  10752 S 16.89 3.546   2466:15 mysqld                                                          
18184 wwwrun    20   0  304196 222904  29312 S 9.603 2.787   0:55.97 php                                                             
  • show processlist; reveals:
MariaDB [(none)]> show processlist;
+--------+------+-----------+------+---------+------+----------+------------------------------------------------------------------------------------------------------+----------+
| Id     | User | Host      | db   | Command | Time | State    | Info                                                                                                 | Progress |
+--------+------+-----------+------+---------+------+----------+------------------------------------------------------------------------------------------------------+----------+
| 556827 | nc   | localhost | nc   | Query   |    0 | Commit   | UPDATE `oc_file_locks` SET `lock` = `lock` - 1 WHERE (`key` = 'files/f59c6cd9c59c75a2b6a12e00aa33a5b |    0.000 |
| 557075 | root | localhost | NULL | Query   |    0 | starting | show processlist                                                                                     |    0.000 |
+--------+------+-----------+------+---------+------+----------+------------------------------------------------------------------------------------------------------+----------+
2 rows in set (0.000 sec)
MariaDB [(none)]> 


The Solution

https://docs.nextcloud.com/server/28/admin_manual/configuration_files/files_locking_transactional.html

This saved me 3W of energy, 3W*24*365=26kW, which is just shy of 10€ per year. And it's better for the environment, too. :-)