Slow loading files page on federated shares

Nextcloud version (eg, 20.0.5): 22.2.3
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): nginx 1.20.1
PHP version (eg, 7.4): 8.0.13
PHP
Memory Limit: 2 GB
Max Execution Time: 3600
Upload max size: 512 MB
Database
mysql
8.0.27
44.1 MB
System
6 Cores
18GB Memory (2.7 Used)

Running Nextcloud, MySQL, Redis and nginx in kubernetes (microk8s) all on the latest stable releases as far as I can tell.

The issue you are facing:
Loading of the main files directory takes a long time while content within sub directories is shown instantly.
If I navigate to “myurl.com”/apps/files/ it takes most of the time around 30-35 seconds to show the folders & files in the main directory. If I navigate to any other directory the content is listed instantly <1 second.
Also any other app loads with acceptable speed.
Seems to be related to federated share. I have one enabled from another nextcloud. If I remove that share the files page loads way faster. With that share it loads “https://nextcloud.myurl.com/remote.php/dav/files/skonig/” which takes above 20 seconds. Does it always take that long with federated shares?

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

The output of your Nextcloud log in Admin > Logging:

Only Mail seems to have a small problem with communication to my gmail account..
Error	mail	OCA\Mail\Exception\ServiceException: Sync failed for 1:INBOX: Error when communicating with the mail server.	
2021-12-05T11:20:50+0000
Error	PHP	Error: Required parameter $pipeline follows optional parameter $msg at /var/www/html/custom_apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Exception/ServerResponse.php#0	
2021-12-05T11:20:11+0000
Error	PHP	Error: Required parameter $server follows optional parameter $msg at /var/www/html/custom_apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Exception/ServerResponse.php#52	
2021-12-05T11:20:11+0000

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

?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  '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' => 'redis',
    'password' => '',
    'port' => 6379,
  ),
 'passwordsalt' => 'mysalt',
  'secret' => 'mysecret,
  'trusted_domains' => 
  array (
    0 => 'nextcloud.myurl.com',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '22.2.3.0',
  'overwrite.cli.url' => 'http://localhost',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => 'mysqldb',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'instanceid' => 'myinstanceid',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'mypassword',
  'installed' => true,
  'maintenance' => false,
);

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

Kubernetes ingress nginx settings:

    nginx.ingress.kubernetes.io/proxy-connect-timeout: "20"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "150"
    nginx.ingress.kubernetes.io/client-body-buffer-size: 70m
    nginx.ingress.kubernetes.io/proxy-body-size: 10G

Updated issue. Issue seems in relation with federated shares.
If I delete that share the files page loads way faster.

With the share being received it loads “https://nextcloud.myurl.com/remote.php/dav/files/skonig/” which alone takes above 20 seconds alone.
Any idea how to speed this up?

The federated share from another nextcloud is about 70GB with all sub folders.

Just noticed the same issue on 23.0.2. Enabling federated shares makes the whole GUI go super slow.