# Redis / PHP-FPM issues with Nextcloud

**URL:** <https://help.nextcloud.com/t/redis-php-fpm-issues-with-nextcloud/25910>\
**Category:** ℹ️ Support\
**Tags:** redis\
**Created:** [January 16, 2018, 1:28pm UTC](https://help.nextcloud.com/t/redis-php-fpm-issues-with-nextcloud/25910 "2018-01-16T13:28:35Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![Influenist](https://help.nextcloud.com/user_avatar/help.nextcloud.com/influenist/32/6134_2.png) [@Influenist](https://help.nextcloud.com/u/Influenist)\
**Post date:** [November 26, 2018, 10:22pm UTC](https://help.nextcloud.com/t/redis-php-fpm-issues-with-nextcloud/25910/14 "2018-11-26T22:22:19Z")

</div>

@jospoortvliet problem is still valid and seems to be related to the open files limit.

```
redis-benchmark -c 6000 -q -n 10 -t get,set
Could not connect to Redis at 127.0.0.1:6379: Can't create socket: Too many open files

```

Increasing the open files limit temporary resolves this issue:

```
ulimit -n 999999

```

Yet I guess there is smth wrong in the code as this issue is not only reported by me. Seen:

> <https://github.com/nextcloud/gallery/issues/323>
>
> \<!--
> This is the issue tracker of Gallery.
> 
> Thank you for taking the time to:…
> \* report an issue you've experienced or
> \* to submit a feature request.
> 
> To make it easier for us to help you, please fill in as much information as possible in
> one of the forms below.
> 
> Please choose between the "Bug report" and the "Feature request" form and delete the content of the other one
> \--\>
> 
> \## Bug report
> 
> \### Steps to reproduce
> 
> 1. Have lots of files and folders in your Nextcloud account. My test account had 58832 files in 8549 folders. Only two of the folders had any image files and there were less than 200 of them in total.
> 1. Try to open the Gallery app from the root of your Nextcloud account.
> 
> \### Expected behavior
> Gallery should open and show the folders with images in them
> \<!--
> Tell us what should happen
> Tip: You can leave alone text surrounded by special markers such as this one, they're invisible
> \--\>
> 
> \### Actual behavior
> Gallery shows only the loading spinner indefinitely. After one minute, the request for endpoint \`/gallery/files/list?location=&mediatypes=image%2Fpng%3Bimage%2Fjpeg%3Bimage%2Fgif%3Bimage%2Ftiff&features=&etag\` times out (http error 504).
> 
> The gallery.js script tries to show an error message but even that fails because of another bug. The code is like this:
> \`\`\`
> var result = xhr.responseJSON;
> var albumPath = decodeURIComponent(currentLocation);
> var message;
> if (result === null) {
> message = t('gallery', 'There was a problem reading files from this album');
> } else {
> message = result.message;
> }
> \`\`\`
> ... but the \`result\` is not \`null\` but \`undefined\`. Hence, the script execution is terminated.
> 
> If I navigate to some sub-folder in the Files app and then open the Gallery app with the "grid view" button, then the application opens correctly. With a folder containing 3640 files and 533 folders, the \`gallery/files/list\` service took 12 seconds to process on the server. Assuming linear timing properties, around 18000 files and/or 2600 folders might be the maximum numbers which can be handled by the Gallery app. On more high-power server, the limits could be somewhat higher but probably not by an order of magnitude.
> 
> Obviously, the Gallery app is doing lots of unnecessary processing with the non-image files. It should be able to discard folders not containing any image files in matter of seconds. I have used the same folder structure as test content when developing the Music app. The 58k+ files are actually audio files and I can retrieve them all in around 16 seconds with \`Folder.searchByMime\` from the root folder. I also tested that retrieving the \<200 image files the same way would take only some hundreds of milliseconds.
> 
> \### Server configuration
> \<!--
> You can use the Issue Template application to prefill most of the required information: https://apps.nextcloud.com/apps/issuetemplate
> \--\>
> 
> \*\*Operating system:\*\* Linux raspberrypi 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l
> 
> \*\*Web server:\*\* nginx/1.6.2 (fpm-fcgi)
> 
> \*\*Database:\*\* mysql 5.5.55
> 
> \*\*PHP version:\*\* 5.6.30-0+deb8u1
> 
> \*\*cloud server:\*\* Nextcloud
> 
> \*\*cloud version:\*\* 12.0.3
> 
> \*\*Updated from an older installation or fresh install:\*\* Updated
> 
> \*\*List of activated apps:\*\*
> \<!--
> If you have access to your command line run e.g.:
> \# sudo -u www-data php occ app:list\`
> from within your installation folder\*
> \--\>
> 
> \<details\>
> \<summary\>Enabled apps\</summary\>
> 
> \`\`\`
> - activity: 2.5.2
> - comments: 1.2.0
> - dav: 1.3.0
> - federatedfilesharing: 1.2.0
> - federation: 1.2.0
> - files: 1.7.2
> - files\_external: 1.3.0
> - files\_pdfviewer: 1.1.1
> - files\_sharing: 1.4.0
> - files\_texteditor: 2.4.1
> - files\_trashbin: 1.2.0
> - files\_versions: 1.5.0
> - files\_videoplayer: 1.1.0
> - firstrunwizard: 2.1
> - gallery: 17.0.0
> - issuetemplate: 0.2.2
> - logreader: 2.0.0
> - lookup\_server\_connector: 1.0.0
> - metadata: 0.5.0
> - music: 0.5.3
> - nextcloud\_announcements: 1.1
> - notifications: 2.0.0
> - oauth2: 1.0.5
> - password\_policy: 1.2.2
> - provisioning\_api: 1.2.0
> - serverinfo: 1.2.0
> - sharebymail: 1.2.0
> - survey\_client: 1.0.0
> - systemtags: 1.2.0
> - theming: 1.3.0
> - twofactor\_backupcodes: 1.1.1
> - updatenotification: 1.2.0
> - workflowengine: 1.2.0
> \`\`\`
> \</details\>
> 
> \<details\>
> \<summary\>Disabled apps\</summary\>
> 
> \`\`\`
> - admin\_audit
> - audioplayer
> - encryption
> - user\_external
> - user\_ldap
> \`\`\`
> \</details\>
> 
> \*\*Nextcloud configuration:\*\*
> 
> \<details\>
> \<summary\>Content of config/config.php\</summary\>
> 
> \`\`\`
> {
> "debug": true,
> "instanceid": "ocvemsryqekj",
> "passwordsalt": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "secret": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "trusted\_domains": \[
> "\*\*\*REMOVED SENSITIVE VALUE\*\*\*"
> \],
> "datadirectory": "\\/mnt\\/ext\_hdd\\/owncloud\_data",
> "overwrite.cli.url": "https:\\/\\/\*\*\*REMOVED\*\*\*\\/nextcloud",
> "dbtype": "mysql",
> "version": "12.0.3.3",
> "logtimezone": "Europe\\/Helsinki",
> "installed": true,
> "memcache.local": "\\\\OC\\\\Memcache\\\\APCu",
> "filelocking.enabled": true,
> "memcache.locking": "\\\\OC\\\\Memcache\\\\Redis",
> "redis": {
> "host": "localhost",
> "port": 6379
> },
> "asset-pipeline.enabled": false,
> "maintenance": false,
> "dbname": "nextcloud\_db",
> "dbhost": "127.0.0.1",
> "dbuser": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbpassword": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "preview\_libreoffice\_path": "\\/usr\\/lib\\/libreoffice\\/program\\/soffice.bin",
> "preview\_max\_scale\_factor": 1,
> "enabledPreviewProviders": \[
> "OC\\\\Preview\\\\PNG",
> "OC\\\\Preview\\\\JPEG",
> "OC\\\\Preview\\\\GIF",
> "OC\\\\Preview\\\\TIFF",
> "OC\\\\Preview\\\\MP3"
> \],
> "theme": "",
> "loglevel": 1,
> "htaccess.RewriteBase": "\\/nextcloud"
> }
> \`\`\`
> \</details\>
> 
> \*\*Are you using external storage, if yes which one:\*\* no
> 
> \*\*Are you using encryption:\*\* no
> 
> \*\*Are you using custom gallery.cnf config files:\*\* no
> 
> \#### Web server error log
> 
> \<details\>
> \<summary\>Web server error log\</summary\>
> 
> \`\`\`
> 2017/10/21 22:06:00 \[error\] 19518#0: \*58392 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 91.158.223.156, server: \*\*\*REMOVED\*\*\*, request: "GET /nextcloud/core/vendor/DOMPurify/dist/purify.min.js.map HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "\*\*\*REMOVED\*\*\*"
> 2017/10/21 22:06:00 \[error\] 19518#0: \*58393 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 91.158.223.156, server: \*\*\*REMOVED\*\*\*, request: "GET /nextcloud/core/vendor/blueimp-md5/js/md5.min.js.map HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "\*\*\*REMOVED\*\*\*"
> 2017/10/21 22:07:01 \[error\] 19518#0: \*58391 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 91.158.223.156, server: \*\*\*REMOVED\*\*\*, request: "GET /nextcloud/index.php/apps/gallery/files/list?location=&mediatypes=image%2Fpng%3Bimage%2Fjpeg%3Bimage%2Fgif%3Bimage%2Ftiff&features=&etag HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock", host: "\*\*\*REMOVED\*\*\*"
> \`\`\`
> \</details\>
> 
> \#### Cloud log
> Nothing printed to the log, even if log level is \`debug\`.
> 
> \### Client configuration
> 
> \*\*Browser:\*\* Chrome/61.0.3163.100
> 
> \*\*Operating system:\*\* Windows 10
> 
> \#### Browser log
> \<!--
> Press F12 in your browser and copy the relevant information from:
> 
> a) The javascript console log
> b) The network log
> c) etc.
> \--\>
> 
> 
> \<details\>
> \<summary\>Browser log\</summary\>
> 
> \`\`\`
> GET https://\*\*\*REMOVED\*\*\*/nextcloud/index.php/apps/gallery/files/list?location=&mediatypes=image%2Fpng%3Bimage%2Fjpeg%3Bimage%2Fgif%3Bimage%2Ftiff&features=&etag 504 (Gateway Time-out)
> Uncaught TypeError: Cannot read property 'message' of undefined
> \`\`\`
> 
> \</details\>

> <https://github.com/nextcloud/gallery/issues/449>
>
> \### Steps to reproduce
> When the web app gallery is paged, hangs for 5-10 second…s. The preview pictures are not uploaded.
> 
> At this point, the server loads the CPU php7-FPM 60%, and radis-server 27%.
> 
> Then it hangs, and it loads further.
> 
> I noticed that hangs occur immediately after keyspace\_messes in the radis monitor.
> keyspace\_hits:3343725
> keyspace\_misses:15172
> 
> Such a problem is probably more than a year old. On previous versions, it was the same.
> 
> This problem is observed in both mysql and postgresql. On php7.0 and on php7.1.
> 
> If you start the server without a radis-server, then the cloud starts to work more slowly.
> 
> 
> 
> \### Server configuration
> Core i5, 16gb, ssd 120gb + 2tb.
> 
> \*\*Operating system\*\*:
> Ubuntu Server 16.04
> Linux 4.4.0-128-generic #154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018 x86\_64 x86\_64 x86\_64 GNU/Linux
> 
> \*\*Web server:\*\*
> nginx/1.14.0
> 
> \*\*Database:\*\*
> mysql Ver 15.1 Distrib 10.2.16-MariaDB, for debian-linux-gnu (x86\_64) using readline 5.2
> psql (PostgreSQL) 10.4 (Ubuntu 10.4-2.pgdg16.04+1)
> 
> \*\*PHP version:\*\*
> PHP 7.0.30-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: May 2 2018 12:43:14) ( NTS )
> Copyright (c) 1997-2017 The PHP Group
> Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
> with Zend OPcache v7.0.30-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
> 
> PHP 7.1.18-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Jun 11 2018 14:22:30) ( NTS )
> Copyright (c) 1997-2018 The PHP Group
> Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
> with Zend OPcache v7.1.18-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
> 
> 
> \*\*Nextcloud version:\*\* (see Nextcloud admin page)
> Cloud#1 Nextcloud 13.0.4
> Cloud#2 Nextcloud-Test 13.0.4
> 
> \*\*Updated from an older Nextcloud/ownCloud or fresh install:\*\*
> Cloud#1 and Cloud#2
> Fresh install.
> 
> \*\*Where did you install Nextcloud from:\*\*
> 
> \*\*Signing status:\*\*
> Cloud#1 and Cloud#2
> No errors have been found.
> 
> 
> 
> \*\*List of activated apps:\*\*
> \<details\>
> \<summary\>App list Cloud1\</summary\>
> \`\`\`
> Enabled:
> - activity: 2.6.1
> - apporder: 0.4.1
> - audioplayer: 2.3.0
> - bookmarks: 0.11.0
> - bruteforcesettings: 1.1.0
> - calendar: 1.6.1
> - comments: 1.3.0
> - contacts: 2.1.5
> - dav: 1.4.7
> - deck: 0.3.1
> - drawio: 0.8.9
> - dropit: 0.1.1
> - federatedfilesharing: 1.3.1
> - files: 1.8.0
> - files\_external: 1.4.1
> - files\_pdfviewer: 1.2.1
> - files\_sharing: 1.5.0
> - files\_texteditor: 2.5.1
> - files\_trashbin: 1.3.0
> - files\_versions: 1.6.0
> - files\_videoplayer: 1.2.0
> - firstrunwizard: 2.2.1
> - flowupload: 0.0.7
> - gallery: 18.0.0
> - logreader: 2.0.0
> - lookup\_server\_connector: 1.1.0
> - mail: 0.8.2
> - nextcloud\_announcements: 1.2.0
> - notes: 2.3.2
> - notifications: 2.1.2
> - oauth2: 1.1.1
> - ocsms: 1.13.1
> - onlyoffice: 1.3.0
> - password\_policy: 1.3.0
> - previewgenerator: 1.0.9
> - provisioning\_api: 1.3.0
> - radio: 0.6.1
> - rainloop: 5.1.0
> - serverinfo: 1.3.0
> - sharebymail: 1.3.0
> - spreed: 3.2.2
> - tasks: 0.9.6
> - theming: 1.4.5
> - twofactor\_backupcodes: 1.2.3
> - unsplash: 1.1.1
> - updatenotification: 1.3.0
> - workflowengine: 1.3.0
> Disabled:
> - admin\_audit
> - admin\_notifications
> - encryption
> - federation
> - files\_downloadactivity
> - ojsxc
> - survey\_client
> - systemtags
> - user\_external
> - user\_ldap
> \`\`\`
> \</details\>
> 
> \<details\>
> \<summary\>App list Cloud2\</summary\>
> \`\`\`
> Enabled:
> - activity: 2.6.1
> - admin\_audit: 1.3.0
> - admin\_notifications: 1.0.1
> - apporder: 0.4.1
> - audioplayer: 2.3.0
> - bookmarks: 0.11.0
> - calendar: 1.6.1
> - comments: 1.3.0
> - contacts: 2.1.5
> - dav: 1.4.7
> - deck: 0.3.1
> - external: 3.0.3
> - federatedfilesharing: 1.3.1
> - federation: 1.3.0
> - files: 1.8.0
> - files\_downloadactivity: 1.2.0
> - files\_external: 1.4.1
> - files\_pdfviewer: 1.2.1
> - files\_sharing: 1.5.0
> - files\_snapshots: 0.1.1
> - files\_texteditor: 2.5.1
> - files\_trashbin: 1.3.0
> - files\_versions: 1.6.0
> - files\_videoplayer: 1.2.0
> - firstrunwizard: 2.2.1
> - gallery: 18.0.0
> - groupfolders: 1.2.0
> - logreader: 2.0.0
> - lookup\_server\_connector: 1.1.0
> - mail: 0.8.2
> - news: 12.0.4
> - nextcloud\_announcements: 1.2.0
> - notes: 2.3.2
> - notifications: 2.1.2
> - oauth2: 1.1.1
> - ocsms: 1.13.1
> - onlyoffice: 1.3.0
> - password\_policy: 1.3.0
> - previewgenerator: 1.0.9
> - provisioning\_api: 1.3.0
> - ransomware\_protection: 1.1.0
> - serverinfo: 1.3.0
> - sharebymail: 1.3.0
> - survey\_client: 1.1.0
> - systemtags: 1.3.0
> - telephoneprovider: 1.0.1
> - theming: 1.4.5
> - twofactor\_backupcodes: 1.2.3
> - unsplash: 1.1.1
> - updatenotification: 1.3.0
> - weather: 1.5.1
> - workflowengine: 1.3.0
> Disabled:
> - encryption
> - gpxpod
> - user\_external
> - user\_ldap
> \`\`\`
> \</details\>
> 
> 
> 
> \*\*Nextcloud configuration:\*\*
> \<details\>
> \<summary\>Config report Cloud1\</summary\>
> \`\`\`
> {
> "system": {
> "instanceid": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "passwordsalt": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "secret": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "trusted\_domains": \[
> "cloud.mydomain.ru",
> \],
> "datadirectory": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "overwrite.cli.url": "https:\\/\\/cloud.mydomain.ru",
> "overwriteprotocol": "https",
> "dbtype": "mysql",
> "version": "13.0.4.0",
> "dbname": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbhost": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbport": "",
> "dbtableprefix": "oc\_",
> "mysql.utf8mb4": true,
> "htaccess.RewriteBase": "\\/",
> "dbuser": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbpassword": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "installed": true,
> "loglevel": 2,
> "logtimezone": "Asia\\/Omsk",
> "logfile": "\\/var\\/www\\/cloud12\\/data\\/nextcloud12.log",
> "log\_rotate\_size": 104857600,
> "cron\_log": true,
> "filesystem\_check\_changes": true,
> "quota\_include\_external\_storage": false,
> "knowledgebaseenabled": false,
> "cache\_path": "\\/var\\/cache\\/cloud",
> "memcache.local": "\\\\OC\\\\Memcache\\\\Redis",
> "filelocking.enabled": "true",
> "memcache.locking": "\\\\OC\\\\Memcache\\\\Redis",
> "redis": {
> "host": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "port": 6379,
> "timeout": 0,
> "dbindex": 0
> },
> "maintenance": false,
> "theme": "",
> "enable\_previews": true,
> "enabledPreviewProviders": \[
> "OC\\\\Preview\\\\Movie",
> "OC\\\\Preview\\\\Image",
> "OC\\\\Preview\\\\PNG",
> "OC\\\\Preview\\\\JPEG",
> "OC\\\\Preview\\\\GIF",
> "OC\\\\Preview\\\\BMP",
> "OC\\\\Preview\\\\XBitmap"
> \],
> "enable\_movie\_transcode": true,
> "mail\_smtpmode": "smtp",
> "mail\_smtpsecure": "ssl",
> "mail\_from\_address": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_domain": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtpauth": 1,
> "mail\_smtpauthtype": "LOGIN",
> "mail\_smtphost": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtpport": "465",
> "mail\_smtpname": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtppassword": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*"
> }
> }
> \`\`\`
> \</details\>
> 
> \<details\>
> \<summary\>Config report Cloud2\</summary\>
> \`\`\`
> {
> "system": {
> "instanceid": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "passwordsalt": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "secret": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "trusted\_domains": \[
> "cloud2.mydomain.ru",
> \],
> "datadirectory": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "overwrite.cli.url": "http:\\/\\/cloud2.mydomain.ru",
> "dbtype": "pgsql",
> "version": "13.0.4.0",
> "dbname": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbhost": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbport": "",
> "dbtableprefix": "oc\_",
> "dbuser": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbpassword": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "installed": true,
> "filesystem\_check\_changes": true,
> "loglevel": 2,
> "logtimezone": "Asia\\/Omsk",
> "log\_rotate\_size": 104857600,
> "cron\_log": true,
> "quota\_include\_external\_storage": false,
> "knowledgebaseenabled": false,
> "cache\_path": "\\/var\\/cache\\/cloud",
> "memcache.local": "\\\\OC\\\\Memcache\\\\Redis",
> "filelocking.enabled": "true",
> "memcache.locking": "\\\\OC\\\\Memcache\\\\Redis",
> "redis": {
> "host": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "port": 6379,
> "timeout": 0,
> "dbindex": 0
> },
> "enable\_previews": true,
> "preview\_max\_x": 2048,
> "preview\_max\_y": 2048,
> "preview\_max\_scale\_factor": 2,
> "enabledPreviewProviders": \[
> "OC\\\\Preview\\\\Movie",
> "OC\\\\Preview\\\\Image",
> "OC\\\\Preview\\\\PNG",
> "OC\\\\Preview\\\\JPEG",
> "OC\\\\Preview\\\\GIF",
> "OC\\\\Preview\\\\BMP",
> "OC\\\\Preview\\\\XBitmap"
> \],
> "enable\_movie\_transcode": true,
> "mail\_smtpmode": "smtp",
> "mail\_smtpauthtype": "LOGIN",
> "mail\_smtpsecure": "ssl",
> "mail\_from\_address": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_domain": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtpauth": 1,
> "mail\_smtphost": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtpport": "465",
> "mail\_smtpname": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtppassword": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "updater.release.channel": "beta",
> "maintenance": false,
> "theme": ""
> }
> }
> \`\`\`
> \</details\>
> 
> 
> \*\*Are you using external storage, if yes which one:\*\* local/smb/sftp/...
> /mnt/disk2/Doc
> 
> \*\*Are you using encryption:\*\* yes/no
> No
> 
> \*\*Are you using an external user-backend, if yes which one:\*\* LDAP/ActiveDirectory/Webdav/...
> No
> 
> 
> \### Client configuration
> \*\*Browser:\*\*
> Chrome
> Firefox
> 
> \*\*Operating system:\*\*
> Windows 7, Windows 10, Android
> 
> \### Logs
> \#### Web server error log
> \<details\>
> \<summary\>Web server error log\</summary\>
> 
> \`\`\`
> Insert your webserver log here
> \`\`\`
> \</details\>
> 
> \#### Nextcloud log (data/nextcloud.log)
> \<details\>
> \<summary\>Nextcloud log\</summary\>
> 
> \`\`\`
> Insert your Nextcloud log here
> \`\`\`
> \</details\>
> 
> \#### Browser log
> \<details\>
> \<summary\>Browser log\</summary\>
> 
> \`\`\`
> Insert your browser log here, this could for example include:
> 
> a) The javascript console log
> b) The network log
> c) ...
> \`\`\`
> \</details\>

> [@Gallery too slow or hanging for large image collections](https://help.nextcloud.com/t/gallery-too-slow-or-hanging-for-large-image-collections/4420/21):
>
> Agreed. The mobile gallery apps are very fast. I would love to be able to ditch Apple for storing my photos.

> <https://github.com/nextcloud/server/issues/7269>
>
> \### Steps to reproduce
> 1. Enable previews and caching/locking (Redis). Put some… 50k image files in different folders & different users. 
> 2. Create previews. (For each image file NC creates a folder in \_appdata\_xyzw/preview)
> 3. Upload new files through NC web or any third-party WebDAV client.
> 4. Upload process freezes shortly after beginning of upload. The more images (=preview folders) are total (across all users), the longer are freezes. Even errors due timeouts when preview folders counts reached 150k and/or several users are active. 
> 
> \### Expected behaviour
> There should be no such delays/all preview folder scanning/locking.
> 
> \### Actual behaviour
> Every time when files are accessed (even at thumbnail size), Redis server starts a process and make a 7 commands for every folder under preview folder regardless of user or files in particular folder. When files are accessed through web only for viewing it is almost unnoticeable except if some preview/thumbnail isn't loaded until Redis is finished. But when new files are uploaded, Redis process freezes upload.
> I run Redis monitoring and save results to a file (redis-cli monitor \> filename.log). 
> At every access/upload Redis made 7 commands for each folder under preview like that:
> 
> \`\`\`
> 1511216011.732781 \[0 127.0.0.1:42534\] "INCRBY" "97e0744ba0fb92ff41f34a80803a7a9a/lockfiles/592f193f4d372a748dc3d125a676d4f2" "1"
> 1511216011.732828 \[0 127.0.0.1:42534\] "EXPIRE" "97e0744ba0fb92ff41f34a80803a7a9a/lockfiles/592f193f4d372a748dc3d125a676d4f2" "3600"
> 1511216011.733305 \[0 127.0.0.1:42534\] "WATCH" "97e0744ba0fb92ff41f34a80803a7a9a/lockfiles/592f193f4d372a748dc3d125a676d4f2"
> 1511216011.733348 \[0 127.0.0.1:42534\] "GET" "97e0744ba0fb92ff41f34a80803a7a9a/lockfiles/592f193f4d372a748dc3d125a676d4f2"
> 1511216011.733393 \[0 127.0.0.1:42534\] "MULTI"
> 1511216011.733463 \[0 127.0.0.1:42534\] "DEL" "97e0744ba0fb92ff41f34a80803a7a9a/lockfiles/592f193f4d372a748dc3d125a676d4f2"
> 1511216011.733471 \[0 127.0.0.1:42534\] "EXEC"
> \`\`\`
> 
> If there is a 150k preview folders it takes up to 2 minutes on i3 CPU (more than a 1 M commands, 100 MB). These keys don't resides in Redis memory and every time files are accessed/uploaded, Redis starts the process again. Regardless of how many files/folders actual user have, Redis do it for all preview folders.
> 
> 
> \## Server configuration detail
> 
> \*\*Operating system:\*\* Linux 4.4.0-101-generic #124-Ubuntu SMP Fri Nov 10 18:29:59 UTC 2017 x86\_64
> 
> \*\*Webserver:\*\* Apache/2.4.18 (Ubuntu) (fpm-fcgi)
> 
> \*\*Database:\*\* mysql 10.0.31
> 
> \*\*PHP version:\*\* 7.0.22-0ubuntu0.16.04.1
> Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, cgi-fcgi, mysqlnd, PDO, xml, apcu, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, igbinary, imagick, imap, intl, json, ldap, exif, mcrypt, memcache, mysqli, pdo\_mysql, pdo\_sqlite, Phar, posix, pspell, readline, recode, redis, shmop, SimpleXML, soap, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xmlreader, xmlrpc, xmlwriter, xsl, zip, Zend OPcache
> 
> \*\*Nextcloud version:\*\* 12.0.3 - 12.0.3.3
> 
> \*\*Updated from an older Nextcloud/ownCloud or fresh install:\*\* fresh
> 
> \*\*Where did you install Nextcloud from:\*\* 
> 
> \<details\>\<summary\>Signing status\</summary\>
> 
> Array
> \</details\>
> 
> \<details\>\<summary\>List of activated apps\</summary\>
> 
> \`\`\`
> Enabled:
> - activity: 2.5.2
> - bruteforcesettings: 1.0.2
> - comments: 1.2.0
> - dav: 1.3.0
> - federatedfilesharing: 1.2.0
> - files: 1.7.2
> - files\_pdfviewer: 1.1.1
> - files\_sharing: 1.4.0
> - files\_texteditor: 2.4.1
> - files\_trashbin: 1.2.0
> - files\_versions: 1.5.0
> - files\_videoplayer: 1.1.0
> - firstrunwizard: 2.1
> - gallery: 17.0.0
> - groupfolders: 1.1.0
> - issuetemplate: 0.3.0
> - logreader: 2.0.0
> - lookup\_server\_connector: 1.0.0
> - nextcloud\_announcements: 1.1
> - notifications: 2.0.0
> - oauth2: 1.0.5
> - password\_policy: 1.2.2
> - previewgenerator: 1.0.7
> - provisioning\_api: 1.2.0
> - serverinfo: 1.2.0
> - sharebymail: 1.2.0
> - systemtags: 1.2.0
> - theming: 1.3.0
> - twofactor\_backupcodes: 1.1.1
> - updatenotification: 1.2.0
> - workflowengine: 1.2.0
> Disabled:
> - admin\_audit
> - encryption
> - federation
> - files\_external
> - registration
> - survey\_client
> - user\_external
> - user\_ldap
> 
> \`\`\`
> \</details\>
> 
> \<details\>\<summary\>Configuration (config/config.php)\</summary\>
> 
> \`\`\`
> {
> "instanceid": "ocvyoyj09sk8",
> "passwordsalt": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "secret": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "trusted\_domains": \[
> "REMOVED"
> \],
> "datadirectory": "\\/var\\/www\\/clients\\/client0\\/web2\\/web\\/data",
> "overwrite.cli.url": "https:\\/\\/REMOVED",
> "dbtype": "mysql",
> "version": "12.0.3.3",
> "installed": true,
> "memcache.local": "\\\\OC\\\\Memcache\\\\Redis",
> "filelocking.enabled": true,
> "memcache.locking": "\\\\OC\\\\Memcache\\\\Redis",
> "redis": {
> "host": "localhost",
> "port": 6379,
> "timeout": 0
> },
> "mail\_from\_address": "cloud",
> "mail\_smtpmode": "php",
> "mail\_smtpauthtype": "LOGIN",
> "mail\_domain": "REMOVED",
> "skeletondirectory": "",
> "filesystem\_check\_changes": 1,
> "default\_language": "lv",
> "loglevel": 1,
> "preview\_max\_x": 1500,
> "preview\_max\_y": 1000,
> "preview\_max\_scale\_factor": 2,
> "maintenance": false,
> "dbname": "------",
> "dbhost": "127.0.0.1",
> "dbuser": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbpassword": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "trashbin\_retention\_obligation": "30, 30",
>   
> }
> \`\`\`
> \</details\>

[https://github.com/nextcloud/server/issues/6459](https://github.com/nextcloud/server/issues/6459)

---

_[View the full topic](https://help.nextcloud.com/t/redis-php-fpm-issues-with-nextcloud/25910)._
