client icon indicating copy to clipboard operation
client copied to clipboard

Local file discovery should be done at most once per run, use file watcher events to seed Discovery

Open ckamm opened this issue 12 years ago • 65 comments

Currently the client runs a full local discovery every five minutes due to limitations in our file watching code (see #2268 for previous discussion). These limitations should be removed to allow the client to be reliable with only a single run of the local file discovery or without it entirely.

On Mac: We don't get notifications for changes our own process caused, so a single run should be enough. We may be able to hook into the filesystem change journal to even skip that.

On Linux: We get full path information about changes and that could be used to filter out the changes on files we cause ourselves.

On Windows: Similar to Linux (have to use ReadDirectoryChanges instead of FindFirstChangeNotification) and could even possibly skip the single discovery by using "Change Journals".

ckamm avatar Oct 10 '14 12:10 ckamm

These kind of stuff becomes important as we see people having 50K+ files in their sync folder. If you manage to sort this out to work at scale of a few 100K files in a sync directory then you will have extreme competitive advantage. But that's some way to go, still....

moscicki avatar Oct 10 '14 13:10 moscicki

Linking https://github.com/owncloud/mirall/issues/880 since it's related. I still have some ideas for Windows directory traversal..

guruz avatar Oct 22 '14 09:10 guruz

@moscicki points out in #2451:

Please also consider that in some cases an (advanced) user may require to keep the ability of periodic full scans of the local sync folder (on per folder-pair basis). This is if someone have their local folders on mounted filesystems which do not always reliably provide the notifications (e.g. in some cases the AFS). In that case a setting in the folders config file could be sufficient.

ckamm avatar Nov 06 '14 08:11 ckamm

The current state in master is:

  • Force sync interval changed from 5 minutes to 2 hours
  • The file watchers report changes with full paths
  • The propagator keeps track of files the sync touches and then folders ignore change notifications on files that were touched by the sync for 15s

This should make full discovery runs much more rare!

ckamm avatar Nov 20 '14 12:11 ckamm

Seems you have almost perfect solved the problem. Exist a simple solution for a beginner that installed all standard? Owcloud server 7.0.3 + debian7 + nginx + php5 + mysql Thanks

reylon avatar Dec 05 '14 19:12 reylon

@reylon You can compile the mirall master branch yourself if you want :) that would be the 1.8

guruz avatar Dec 08 '14 11:12 guruz

Documentation for the change journal stuff: OS X: https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/FSEvents_ProgGuide/UsingtheFSEventsFramework/UsingtheFSEventsFramework.html#//apple_ref/doc/uid/TP40005289-CH4-SW10 Windows: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363798(v=vs.85).aspx

FYI @dragotin @danimo

Note that this bug is about running local discovery only once, change journals are to avoid discovery at all

guruz avatar Jul 14 '15 09:07 guruz

This is done.

dragotin avatar Aug 26 '15 12:08 dragotin

Internal misunderstanding, this is not done..

guruz avatar Aug 26 '15 13:08 guruz

I'm experiencing pretty much constant discovery which is only interrupted with the error headlined in owncloud/core#18206. I'm guessing that's related to this issue?

Foggalong avatar Sep 01 '15 11:09 Foggalong

The idea is to only build up a very limited set of files that was changed, not the whole set that we get from the discovery phase by now. We want to rely on the filesystem notification for that. Still the client has to do the full sync as well of course. @ogoffart please add your thoughts.

dragotin avatar Sep 02 '15 12:09 dragotin

The idea would be to run the reconcile phase only on files comming from the file system watcher, and having a way then to do lazy discovery of the files we need.

ogoffart avatar Sep 02 '15 12:09 ogoffart

@dragotin: I remember what you said that you'd need to keep the whole tree in memory. I am not really sure if you need that. For simplicity imagine you only have local changes to propagate (and no remote changes to reconcile). You do not need the whole tree. Just the part of the tree where you have seen the modifications. It would get a bit trickier if you also have the remote changes but maybe one can come up with some smart algorithm which requires you to traverse only a union set of local and remote subtrees. Of course, the prerequisite is that you have reliable notifications or you are efficiently able to detect when notifications are lost or become less reliable (due to load, internal buffer size, rate of events or whatever other factors).

moscicki avatar Sep 02 '15 12:09 moscicki

                                                                                  We talked about exactly this at lunch :-) you should have stayed longer at the conf :-)                                                                                                                                                       

guruz avatar Sep 02 '15 13:09 guruz

Given @ogoffart 's recent discovery improvements, I'm moving this to 2.2.

guruz avatar Oct 22 '15 08:10 guruz

Is there any update on this?

Can we somehow make this happen?

We have some people in our institution who are avid users, and are considering to drop ownCloud because of this.

Thanks,

Trefex avatar Sep 15 '16 14:09 Trefex

@Trefex Do you have any metrics on this? How long does the discovery take? Which OSes? How many files/folders?

guruz avatar Sep 20 '16 09:09 guruz

Doesn't sync client produce something like that in the logs? However, collecting it from a larger user base could be a maybe painfull process. Is there a way to automate client-side-monitoring metrics like this one to make it at the disposal of the admin of an instance? I would like to know that too for my users.

moscicki avatar Sep 20 '16 11:09 moscicki

@moscicki We don't send such information back to the server.

But you can estimate it by looking at your logs:
We first do a first PROPFIND on the root folder to know if the etag has changed. If something has changed, then we do the local discovery, then we do the server discovery starting with the PROPFIND on the root folder. You should be able to distinguish these two propfind because of the difference in the Depth and in the property list. And so you can estimate the time taken by a local discovery.

ogoffart avatar Sep 21 '16 07:09 ogoffart

Having big issues with sync aswell, For the last day, my Owncloud have been "Checking for xxx". And it never seems to do anything.

It does contains some git repositories where .git is included to sync, but all scrap files like node_modules are ignored.

Still, if dropbox and google drive manage to sync this files, owncloud should be able to do it aswell?

perara avatar Sep 24 '16 12:09 perara