Some time ago (Jan. 23), I switched the the background job from AJAX to Cron. Since then, I have a very high CPU load with every crontab execution.
Data:
- Ubuntu 22 LTS (up2date)
- Intel i3-6100
- NC 25.0.4
- Docker 23
- Users: 3-5 active
docker compose:
version: '3.9'
networks:
nextcloud:
services:
nextcloud:
image: nextcloud:${VERSION}
container_name: nextcloud
networks:
- nextcloud
ports:
- "127.0.0.1:8080:80"
volumes:
- ${NEXTCLOUD_ROOT}/app_${VERSION}:/var/www/html
- /media/freigaben/nextcloud_230112:/srv/nextcloud/data
extra_hosts:
- "${NEXTCLOUD_FQDN}:${NEXTCLOUD_IPADDRESS}"
- "${COLLABORA_FQDN}:${NEXTCLOUD_IPADDRESS}"
depends_on:
- mysql
- redis
environment:
- NEXTCLOUD_TRUSTED_DOMAINS='${NEXTCLOUD_FQDN}'
- NEXTCLOUD_DATA_DIR=/srv/nextcloud/data
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_HOST=nextcloud-mysql
- REDIS_HOST=nextcloud-redis
- PHP_MEMORY_LIMIT=2G
- PHP_UPLOAD_LIMIT=2G
restart: unless-stopped
mysql:
image: mysql:8
container_name: nextcloud-mysql
restart: unless-stopped
volumes:
- /srv/db/nextcloud/lib_${VERSION}:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
networks:
- nextcloud
redis:
image: redis:7
container_name: nextcloud-redis
networks:
- nextcloud
restart: unless-stopped
coturn:
image: coturn/coturn:4
container_name: nextcloud-coturn
restart: unless-stopped
ports:
- "3478:3478/tcp"
- "3478:3478/udp"
networks:
- nextcloud
command:
- -n
- --log-file=stdout
- --min-port=49160
- --max-port=49200
- --realm=${NEXTCLOUD_FQDN}
- --use-auth-secret
- --static-auth-secret=${COTURN_SECRET}
config.php:
<?php
$CONFIG = array (
'instanceid' => '###',
'passwordsalt' => '###',
'secret' => '###',
'trusted_domains' =>
array (
0 => '###.de',
1 => '###.eu',
2 => '10.1.1.4',
3 => '[###]',
),
'version' => '25.0.4.1',
'dbtype' => 'mysql',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'installed' => true,
'allow_local_remote_servers' => true,
'datadirectory' => '/srv/nextcloud/data',
'dbname' => 'nextcloud_170226',
'dbhost' => 'nextcloud-mysql',
'dbuser' => '###',
'dbpassword' => '###',
'trusted_proxies' =>
array (
0 => '10.42.0.0/16',
1 => '103.21.244.0/22',
2 => '103.22.200.0/22',
3 => '103.31.4.0/22',
4 => '104.16.0.0/12',
5 => '108.162.192.0/18',
6 => '131.0.72.0/22',
7 => '141.101.64.0/18',
8 => '162.158.0.0/15',
9 => '172.64.0.0/13',
10 => '173.245.48.0/20',
11 => '188.114.96.0/20',
12 => '190.93.240.0/20',
13 => '197.234.240.0/22',
14 => '198.41.128.0/17',
15 => '2400:cb00::/32',
16 => '2606:4700::/32',
17 => '2803:f800::/32',
18 => '2405:b500::/32',
19 => '2405:8100::/32',
20 => '2c0f:f248::/32',
),
'htaccess.RewriteBase' => '/',
'theme' => '',
'loglevel' => 2,
'maintenance' => false,
'default_phone_region' => 'DE',
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/html/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array (
'path' => '/var/www/html/custom_apps',
'url' => '/custom_apps',
'writable' => true,
),
),
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'nextcloud-redis',
'password' => '',
'port' => 6379,
),
'overwriteprotocol' => 'https',
'overwrite.cli.url' => 'https://###.eu',
'simpleSignUpLink.shown' => false,
'enabledPreviewProviders' =>
array (
0 => 'OC\\Preview\\PNG',
1 => 'OC\\Preview\\JPEG',
2 => 'OC\\Preview\\GIF',
3 => 'OC\\Preview\\HEIC',
4 => 'OC\\Preview\\BMP',
5 => 'OC\\Preview\\XBitmap',
6 => 'OC\\Preview\\MP3',
7 => 'OC\\Preview\\TXT',
8 => 'OC\\Preview\\MarkDown',
9 => 'OC\\Preview\\OpenDocument',
10 => 'OC\\Preview\\Krita',
),
'app_install_overwrite' =>
array (
0 => 'apporder',
1 => 'files_readmemd',
2 => 'sharingpath',
),
'memories.exiftool' => '/var/www/html/custom_apps/memories/exiftool-bin/exiftool-amd64-glibc',
'memories.vod.path' => '/var/www/html/custom_apps/memories/exiftool-bin/go-vod-amd64',
);
crontab:
*/10 * * * * nc-usr docker exec --user www-data nextcloud php /var/www/html/cron.php >> /srv/log/cron_nc.log 2>&1
CPU Load:
Disc I/O Load:
- The data is stored on conventional HDDs.
- NC itself and the database on a NVMe SSD
- High load is only on one core. But this core is then constant to 100% load.
- There are no error messages. Neither in the cron_nc.log nor in the NC instance itself.
- When I manually start the NC cron, the same behavior occurs.
- If I vary the execution time (5m to 1h), the behavior is the same: the cron is executed for about 6min. If I choose short periods (5m to 20min), some cron are terminated after few seconds (you can see in the diagram).
- I have noticed this with NC v24. I have upgraded and it did not bring any improvement.
- I tried to disable (almost) all NC apps. This also brought no improvement.
What could be the reason for this?
How can I optimize this?
Thanks a lot!