How to speed up the load of photos?

Nextcloud version: 21.0.3
Operating system and version: FreeBSD 12.2-RELEASE-p6 FreeBSD TRUENAS amd64
Apache or nginx version: nginx(1.20.0)
PHP version: 7.4.20

VirtualBox and the Truenas guest system are installed on the physical Windows 10. In Truenas, Nextcloud is installed in iocage. Everything works well, but very slowly. The “Photos” tab in browser opens for 4 seconds. If you need to quickly scroll down the photos, you need to wait 10 seconds each time for the photo to load. Also, the android app loads photos in the photo gallery for viewing for 10 seconds. Memcache and basic settings are completed. Automatic verification of the system settings shows “All test have been passed”

How can I speed up loading and displaying photos?

Log files

The output of your Nextcloud log:

{"reqId":"ky5eaUStnvuhMfH7q2QK","level":2,"time":"2021-07-09T05:01:30+00:00","remoteAddr":"","user":"--","app":"recognize","method":"","url":"--","message":"Classifying photos of user ncadmin","userAgent":"--","version":"21.0.3.1"}
{"reqId":"ky5eaUStnvuhMfH7q2QK","level":2,"time":"2021-07-09T05:01:31+00:00","remoteAddr":"","user":"--","app":"recognize","method":"","url":"--","message":"Classifier process output: exec: /usr/local/www/nextcloud/apps/recognize/bin/node-v14.9.0-linux-x64: Exec format error\n","userAgent":"--","version":"21.0.3.1"}
{"reqId":"Dbr71OoFRGi1vZRMzdqU","level":2,"time":"2021-07-09T05:15:15+00:00","remoteAddr":"","user":"--","app":"recognize","method":"","url":"--","message":"Classifying photos of user ncadmin","userAgent":"--","version":"21.0.3.1"}
{"reqId":"Dbr71OoFRGi1vZRMzdqU","level":2,"time":"2021-07-09T05:15:15+00:00","remoteAddr":"","user":"--","app":"recognize","method":"","url":"--","message":"Classifier process output: exec: /usr/local/www/nextcloud/apps/recognize/bin/node-v14.9.0-linux-x64: Exec format error\n","userAgent":"--","version":"21.0.3.1"}
{"reqId":"2OmDNeO8IQky3tmasER0","level":3,"time":"2021-07-09T05:15:24+00:00","remoteAddr":"2.63.86.174","user":"ncadmin","app":"PHP","method":"GET","url":"/settings/admin/serverinfo","message":{"Exception":"Error","Message":"Undefined offset: 0 at /usr/local/www/nextcloud/apps/serverinfo/lib/OperatingSystems/FreeBSD.php#171","Code":0,"Trace":[{"file":"/usr/local/www/nextcloud/apps/serverinfo/lib/OperatingSystems/FreeBSD.php","line":171,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/usr/local/www/nextcloud/apps/serverinfo/lib/Os.php","line":124,"function":"getNetworkInterfaces","class":"OCA\\ServerInfo\\OperatingSystems\\FreeBSD","type":"->"},{"file":"/usr/local/www/nextcloud/apps/serverinfo/lib/Settings/AdminSettings.php","line":111,"function":"getNetworkInterfaces","class":"OCA\\ServerInfo\\Os","type":"->"},{"file":"/usr/local/www/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php","line":138,"function":"getForm","class":"OCA\\ServerInfo\\Settings\\AdminSettings","type":"->"},{"file":"/usr/local/www/nextcloud/apps/settings/lib/Controller/AdminSettingsController.php","line":83,"function":"formatSettings","class":"OCA\\Settings\\Controller\\AdminSettingsController","type":"->"},{"file":"/usr/local/www/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php","line":149,"function":"getSettings","class":"OCA\\Settings\\Controller\\AdminSettingsController","type":"->"},{"file":"/usr/local/www/nextcloud/apps/settings/lib/Controller/AdminSettingsController.php","line":68,"function":"getIndexResponse","class":"OCA\\Settings\\Controller\\AdminSettingsController","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"index","class":"OCA\\Settings\\Controller\\AdminSettingsController","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/local/www/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/usr/local/www/nextcloud/lib/base.php","line":993,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/usr/local/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/usr/local/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 YaBrowser/21.6.0.616 Yowser/2.5 Safari/537.36","version":"21.0.3.1"}
{"reqId":"7R0aVZF2lDyGkB8JDtyZ","level":2,"time":"2021-07-09T05:25:16+00:00","remoteAddr":"","user":"--","app":"recognize","method":"","url":"--","message":"Classifying photos of user ncadmin","userAgent":"--","version":"21.0.3.1"}
{"reqId":"7R0aVZF2lDyGkB8JDtyZ","level":2,"time":"2021-07-09T05:25:16+00:00","remoteAddr":"","user":"--","app":"recognize","method":"","url":"--","message":"Classifier process output: exec: /usr/local/www/nextcloud/apps/recognize/bin/node-v14.9.0-linux-x64: Exec format error\n","userAgent":"--","version":"21.0.3.1"}
{"reqId":"9A7iCX6mptTeQPyUk5o9","level":2,"time":"2021-07-09T05:40:15+00:00","remoteAddr":"","user":"--","app":"recognize","method":"","url":"--","message":"Classifying photos of user ncadmin","userAgent":"--","version":"21.0.3.1"}
{"reqId":"9A7iCX6mptTeQPyUk5o9","level":2,"time":"2021-07-09T05:40:15+00:00","remoteAddr":"","user":"--","app":"recognize","method":"","url":"--","message":"Classifier process output: exec: /usr/local/www/nextcloud/apps/recognize/bin/node-v14.9.0-linux-x64: Exec format error\n","userAgent":"--","version":"21.0.3.1"}
{"reqId":"IH5fZXv5Z6teCvqX8TfN","level":2,"time":"2021-07-09T05:55:15+00:00","remoteAddr":"","user":"--","app":"recognize","method":"","url":"--","message":"Classifying photos of user ncadmin","userAgent":"--","version":"21.0.3.1"}
{"reqId":"IH5fZXv5Z6teCvqX8TfN","level":2,"time":"2021-07-09T05:55:15+00:00","remoteAddr":"","user":"--","app":"recognize","method":"","url":"--","message":"Classifier process output: exec: /usr/local/www/nextcloud/apps/recognize/bin/node-v14.9.0-linux-x64: Exec format error\n","userAgent":"--","version":"21.0.3.1"}

The output of your config.php file in /path/to/nextcloud:

<?php
$CONFIG = array (
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/usr/local/www/nextcloud/apps',
      'url' => '/apps',
      'writable' => true,
    ),
    1 => 
    array (
      'path' => '/usr/local/www/nextcloud/apps-pkg',
      'url' => '/apps-pkg',
      'writable' => true,
    ),
  ),
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '192.168.0.5',
    2 => '***',
  ),
  'datadirectory' => '/usr/local/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '21.0.3.1',
  'overwrite.cli.url' => 'https://nc.local',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '***',
  'dbpassword' => '***',
  'installed' => true,
  'instanceid' => '***',
  'maintenance' => false,
  'default_phone_region' => 'RU',
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' => 
  array (
    0 => 'admin',
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'updater.secret' => '***',
  'memcache.distributed' => '\\OC\\Memcache\\Memcached',
  'memcached_servers' => 
  array (
    0 => 
    array (
      0 => '127.0.0.1',
      1 => 11211,
    ),
  ),
  'theme' => '',
  'loglevel' => 2,
  'memcache.local' => '\\OC\\Memcache\\APCu',
);

Video from android

Hi @qreodium

This could be related to the fact that you are running a NAS appliance that is primarily designed for bare metal use in a desktop virtualization. :wink: Apart from the fact that it’s not such a good idea to run a server appliance on your desktop PC, with TrueNAS you have a huge overhead of functions that you can’t really use in a meaningful way, in this scenario. On top of that, ZFS and FreeBSD are not really known for performing well in VMs and ZFS requires quite a bit of RAM to perform well. Why not go with something Linux based and less overhead like NCP or the Nextcloud Snap Package if you really want to run it in a VM on your desktop PC?

The problem with the slow Gallery app is a long known and often discussed issue for which there is unfortunately no solution “out of the box” yet.

But you can use this app to generate the previews automatically in the background. This should speed up the display of the previews in the Gallery app massively. I also recommend to read this very good article on the topic.

Hope that helps

1 Like

Thank you very much for the detailed answer. Now it is clear that this is a normal work of the gallery.

1 Like