-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shares Plugin really slow when listing lots of files in folder with high php-fpm load #25266
Comments
I have been able to workaround this slowdown by editing SharesPlugin.php:148 and now listing files in folders is back to normal (about 1-2 seconds for my 2800 files folder) and sharing still seems to work without any issues?!?! |
@slade87 if I understand your change, it seems you discarded the sharing information completely, so the web UI will not show the sharing indicators at all. The share manager needs to implement a new method that leverages the database better, something like @owncloud/sharing |
hmm and even that might not work 100% in case of mount points, but could be used as a base to pre-retrieve the share statuses. And then a second query might be needed to make sure to also cover reshares and mount points. |
@PVince81 |
Yes, shares will still work. The purpose of this part is only for the user experience, so that a user can see the sharing indicators on the file list. Whenever the user opens the share panel, the share details for that file will be loaded again (indicator is only minimal info) |
without the share indicators a user might need to click on "Share" on every file to find out which one was actually shared |
I agree we need fancier methods. But keep in mind that we want to operate on an abstract level. E.g. You pass in an \OCP\Files\Folder to a function, then that should have a method to get all the id's for the children etc. Joining is basically not done if we want to provide a modular setup. |
Hmm, right. But this only applies if we consider that the So if we'd want to use the join anyhow, it would need to check that we're dealing with a default implementation. But as you say, maybe the solution that asks for a list of ids on the |
Yeah it is not ideal. But I prefer to keep the sharing stuff simple and clean. It is already a bit to cluttered in some scenarios (and needs to be cleaned up more). But I think this would already be a step in the right direction. Also here applies I'd rather have 1 path then a check if we have the default implementation etc. Duplication will lead to bugs eventually or untested stuff. Adding a getShareStatus function that takes a folder (and some other args) should be a good start I think |
@VicDeo please have a look into this. Might need adjusting the share manager / provider APIs but that's ok. Might need a new v2 interface. We'll see. This is important for the clients to not have a performance drop when doing a PROPFIND of "oc:share-types" when syncing. |
@mrow4a FYI |
@PVince81 Will try to rebuild it and levarage sth like |
Sounds good. You could go even further and take an array of fileids and plug it directly into the query with a |
Dont spoil, I am having fun here :> |
but chunk it in blocks of 1000 - dbs have limits in IN conditions |
@DeepDiver1975 you heard the man, don't spoil it. 😉 Since we're already there, here is an example how to chunk https://github.com/owncloud/core/blob/master/lib/private/Repair/CleanTags.php#L190 |
Can we decouple file_target in oc_shares into folder_target and file_target? Then we can index on folder and share owner? We dont even need IN() there and to know the files, we just need to know the parent folder, thats it. IN() on varchar might not be a too good idea because it is long (EDIT: ok, digging more into the code I see that I can do it also with ids having getDirectoryListing). We would need to limit to small batches like 10-100. Or at least provide parent_hash column (hash of parent folder path) on which we could index. Is it also viable option? |
The other thing we might look at after decoupling is how we can link it. Imagine that you have 15 shares in the folder, and you move the folder. What you need to do is update 1 record instead of 15, because you just update parent varchar :> |
I suggest that in the future we rather use
You'll see that a new special entry (share type 2) was inserted just to be able to track the specific "file_target" for "user1" due to the rename. Additionally it adds redundant info. We need to use oc_mounts instead for tracking mount point names specific to users instead. |
That could happen in oc_mounts later. But now thinking of it, if we had the mount point directly in oc_filecache as suggested in #14396, the "move and change all parents" logic already exists in the oc_filecache specific logic. |
Fixed through #27284 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Steps to reproduce
Expected behaviour
Tell us what should happen
Site should show files in the folders almost immediately (maybe 1 - 2 seconds) (sql query of entire oc_filecache takes less than 0.01 seconds when testing)
Actual behaviour
Tell us what happens instead
In my case it takes from 10 seconds upwards for less than 1000 files
for more than 1000 files it takes more than 15 seconds to just display the list of files. Only the "loading" icon is showing.
Server configuration
Operating system:
Linux ubuntu 16.04
Web server:
nginx
Database:
mariadb
PHP version:
7.0.8
ownCloud version: (see ownCloud admin page)
9.0.2
Updated from an older ownCloud or fresh install:
fresh or updated same effect
Where did you install ownCloud from:
ubuntu package repository
Login as admin user into your ownCloud and access
No errors have been found.
List of activated apps:
Music, Documents, SharesPlugin, ExternalStorage, Gallery
The content of config/config.php:
"system": {
"updatechecker": false,
"instanceid": "ocqqq4thcgry",
"passwordsalt": "_REMOVED SENSITIVE VALUE",
"secret": "_REMOVED SENSITIVE VALUE",
"trusted_domains": [
"xxxxx",
"xxxxx",
"xxxxx"
],
"datadirectory": "/var/www/owncloud/data",
"overwrite.cli.url": "xxxxxxxxxx",
"dbtype": "mysql",
"version": "9.0.2.2",
"dbname": "owncloud",
"dbhost": "localhost:/var/run/mysqld/mysqld.sock",
"dbtableprefix": "oc_",
"dbuser": "_REMOVED SENSITIVE VALUE",
"dbpassword": "_REMOVED SENSITIVE VALUE",
"installed": true,
"maintenance": false,
"theme": "",
"filelocking.enabled": "true",
"memcache.local": "\OC\Memcache\APCu",
"memcache.locking": "\OC\Memcache\Redis",
"filesystem_check_changes": 0,
"cron_log": true,
"log_rotate_size": 10485760,
"debug": false,
"redis": {
"host": "/var/run/redis/redis.sock",
"port": 0,
"timeout": 0,
"dbindex": 0
},
"trashbin_retention_obligation": "auto",
"logtimezone": "UTC"
Are you using external storage, if yes which one: local/smb/sftp/...
Yes smb
Are you using encryption: yes/no
no
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
no
Blackfire.io performance log
https://blackfire.io/profiles/5829bcdd-a0b0-443b-97bb-832bcac8c0d8/graph
The text was updated successfully, but these errors were encountered: