Nextcloud working slowly

Hello there.

My nextcloud retrieve LDAP users very slowly.

Nextcloud version 18.0.4
Operating system - RHEL 8.2
Webserver - Apache 2.4.37
PHP version 7.2.24
Postgres 11.3

I configure nextcloud for primary storage to use local S3 Object Storage(Installed on premise). Before installation I configure objectstore and everything is installed on it.
When I configure LDAP app, server starts to pull Active Directory users and its happens very slowly. Nearly 1 user per 10 secs. Also first login to already retrieved user lasts 1-2 minutes.

Then I tried without objects store (Main storage - Nextloud server file system) and server retrieve 7500 user in several minutes. 25-30 user per sec. Also first login was as fast as admin user.

Also I check postgres db load in PgAdmin here is screenshots.

When using S3 Object Storage
You can see that it has some delays.

When using Local file system

Steps to replicate it:

  1. Install Nextcloud using primary storage S3 objectstore
  2. Enable LDAP app
  3. User retrieve time is very slow.

The output of your Nextcloud log in Admin > Logging:

Nothing here

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

$CONFIG = array (
  'objectstore' =>
  array (
    'class' => 'OC\\Files\\ObjectStore\\S3',
    'arguments' =>
    array (
      'bucket' => 'nextcloud18dev',
      'autocreate' => false,
      'key' => 'key',
      'secret' => 'secker',
      'hostname' => 'drive.swarm.local',
      'port' => 8090,
      'use_ssl' => false,
      'use_path_style' => false,
  'instanceid' => 'ockfpzk8eqvg',
  'passwordsalt' => 'salt',
  'secret' => 'secret',
  'trusted_domains' =>
  array (
    0 => 'nextcloud18-dev.local',
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'pgsql',
  'version' => '',
  'overwrite.cli.url' => 'http://nextcloud18-dev.local/nextcloud',
  'dbname' => 'nextcloud18-dev',
  'dbhost' => 'pgdb-test.local:5432',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'user',
  'dbpassword' => 'password',
  'installed' => true,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'memcache.local' => '\\OC\\Memcache\\APCu'

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

Nothing here

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

Nothing here

This can be from an old version, now there is just a single backslash:

LDAP uses caching as well.

A bit old, perhaps still valid:

Thanks for your reply.
I changed from \ to \ and its not helped. Also I tried to apply what was described in article that you provide but unfortunately it didn’t help also.

I don’t use ldap myself, so I can’t really help you. I’d try to figure out what is causing the delay, the answer of the ldap server (perhaps the query takes so long, network delay, …) or the processing within Nextcloud.

I’d use the redis cache as well for speed, but I don’t know if that has an impact on the login process, but it takes some load from the normal database (in case this part is limiting).

When Im using local storage and the same configuration for LDAP, it works very fast. So I think problem is not in LDAP query and network.

S3 as primary storage is slow. It takes up to a minute to load the initial page once cache has been flushed/expired. Once it’s cached it’s normal speed again.

I’ve used it on premise as well (not just on AWS) and it’s still slow.

Based on the number of queries it’s likely searching for all of the S3 files before searching for users. I’m not exactly sure how the S3 backend works in MySQL but it’s probably searching the S3 backend for each user which can delay things.

Edit: Referring to ldap. S3 as primary is slow regardless on initial load.

Thanks for you reply!

If you’re using it on premise you might want to try something like cephfs. :slight_smile: