Performance opportunity in postinst steps #64
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
On every update, the recursive
chowntakes several hours, which keeps the server down. This is a combination of the chown affecting the data directory, my servers having a large number of files and being backed by a network filesystem (a ceph cluster). I believe it's all the calls togetdents()which trigger a ton of small IO requests, but I haven't spend the time to confirm that hypothesis.Solution
Don't chown the
datadirectory. Nothing in there should need to be chowed after an upgrade.Patch
Hold off on applying this for now, as I have to wait until my server is done with its current chown before I can fully test it.The
-mindepthomits the.directory. The maxdepth ensures we avoid recursing in find. The'!'is the negation operator to exclude thedatadirectory.This should result in all files and directories under
/var/www/nextcloudto be recursively chowned except thedatadirectory, which will never be traversed.I'll post back here after I've verified this patch works and preforms as expected.You might want to move the data outside of your nextcloud installation. On my installations the data is in
/srv/nextcloudand inconfig.phpNextcloud is configured to use it:'datadirectory' => '/srv/nextcloud',Confirmed. The old
chowntook 7 hours and 10 minutes. The newfind/chownline took 21 seconds. It's the tremendous efficiency gain that I was hoping for!And even if it's not as big of a time savings for people with a small number of files, or bigger & better hardware, it's still an improvement.