Photos tab makes sever use 100% of available cpu

Nextcloud version (eg, 20.0.5): Nextcloud Hub 3 (25.0.4)
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04 VM
Apache or nginx version (eg, Apache 2.4.25): 2.4.52-1ubuntu4.3
PHP version (eg, 7.4): 8.1.2-1ubuntu2.11

The issue you are facing:
Scrolling photos in photos tab in browser or using photos app skyrocketing cpu load to 100%
It fully utilizes 2 xeon E5645 processors only for one user. Is it any possible way to lower cpu usage for this use cases?

p.s. result is the same with or without enable-previews

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Upload 1-3k photos (2-5MB each)
  2. Open /apps/photos/
  3. Scroll photos a bit
  4. Wach your server cpu cooking

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => '***',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' =>
  array (
    0 => '***.***.***.***',
    1 => 'site.example.com',
  ),
  'trusted_proxies' =>
  array (
    0 => '***.***.***.***',
  ),
  'datadirectory' => '/media/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '25.0.4.1',
  'overwrite.cli.url' => 'http://***.***.***.***/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'admin',
  'dbpassword' => '***',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_domain' => 'site.example.com',
  'mail_from_address' => 'no-reply',
  'mail_smtphost' => 'example.com',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'no-reply@site.example.com',
  'mail_smtppassword' => '***',
  'memcache.local' => '\\OC\\Memcache\\Memcached',
  'memcache.distributed' => '\\OC\\Memcache\\Memcached',
  'memcached_servers' =>
  array (
    0 =>
    array (
      0 => '127.0.0.1',
      1 => 11211,
    ),
  ),
  'default_phone_region' => 'RU',
  'overwriteprotocol' => 'https',
  'trashbin_retention_obligation' => 'auto, 30',
    'enable_previews' => true,
  'enabledPreviewProviders' =>
    array (
      0 => 'OC\\Preview\\Movie',
      1 => 'OC\\Preview\\PNG',
      2 => 'OC\\Preview\\JPEG',
      3 => 'OC\\Preview\\GIF',
      4 => 'OC\\Preview\\BMP',
      5 => 'OC\\Preview\\XBitmap',
      6 => 'OC\\Preview\\MP3',
      7 => 'OC\\Preview\\MP4',
      8 => 'OC\\Preview\\TXT',
      9 => 'OC\\Preview\\MarkDown',
      10 => 'OC\\Preview\\PDF',
  ),
);

No any related errors in logs. Can anything be done with this problem? I think my server is powerful enougth for such type of things.

i also realized this - but not only the photo tab - also navigation to a folder with images and scroll down.

i have realized that nextcloud fires up a worker thread/process for each image which needs a thumbnail. if the thumbnail is not exisisting the process for thumbnail generation takes some time and the full machine is blown up with threads of the webeserver which then are blocking or using CPU Power from each other and they will not finish.

i am using nextcloud docker - so there apache2 is used and i added a limit for the worker:

to solve this you can edit the apache config file and add:

MaxRequestWorkers 10

or if you use a docker container create file called nextcloudworkers.conf and include the previous line and mount it via the volume command . e.g.

{yourpah}/nextcloudworkers.conf:/etc/apache2/conf-enabled/nextcloudworkers.conf

Why is every instructions on how to fix something shows no instructions on how to fix it? Please make a video or a text guide for us so we can do this. Most of us experiencing this is new :slight_smile: Thanks.

Because this is a user forum where users help other users and most of us don’t have all day to write extensive tutorials and produce videos… So, active participation is expected, also from the people who are asking for help.

…and because the configuration files and paths may differ depending on the installation type, operating system etc… and your answer to such a guide would then most likely be something like: “The guide doesn’t work, please help!” :wink: