Description
As far as I can tell, current sync-client implementations (at least those on Windows and on Linux platform, which I could test) simply rescan the whole local sync directories in a fixed interval (10 seconds); and for remote changes, apparently even less often (it can take up to 1 minute that a client picks up a change on the server for me, even in the local network).
When synced directories become larger, it's quite a nuisance to have owncloud client basically continuously running (and using quite much CPU time every 10 seconds).
To showcase that, I created a simple test directory with approximately 3500 empty (0 byte!) files. Even with only these, one sync client run already takes aproximately 1,5 seconds - and CPU usage is at 15%, but that is with a Core i7-3770K! 3500 files is not that much yet, I don't want to imagine synchronizing 100K files!
My assumption is that the number of files is the determining factor for perfomance, not so much the size of the files (since if nothing changed the file content doesn't have to be checked), though I haven't verified that; but the sync proves to be quite demanding with a moderate number of empty files already.
Since every supported (desktop) platform provides interfaces for listening to file changes (e.g. iNotify on Linux, FindFirstChangeNotification on Windows, see e.g. here http://stackoverflow.com/questions/3517460/is-there-anything-like-inotify-on-windows - wouldn't it be the best solution if these were used?
When reacting on such events, no full sync would be necessary anymore, but just a propagation of that single event (e.g. uploading a created file, remote-deleting a locally deleted file).
Local changes and changes on the client seem to be handled differently at the moment already, so the interface to the server wouldn't have to change that much probably; remote changes could still be synchronized by a not so frequent check, as it's currently done. However, even better would be if the server could also provide an interface for the client for querying remote changes (from another sync client or via the web interface) - ideally, the server would even push such changes, in a way similar to the local notifications.
The client would then listen to both these interfaces: The local file modifications and the remote file modifications.
This would not only decrease CPU usage vastly, but synchronization would also be much quicker!
And because not so much CPU cycles are wasted, it would also be more eco-friendly ;)! And for very large synced folders, in my opinion, this is even the only viable way.
On startup of the client - and possibly in a low frequency afterwards, like at the most once every hour or so (to catch possible missed border cases) - a full rescan should probably still be done.
Activity
testbird commentedon Oct 30, 2012
The onwcloud server (as well as the clients) should just watch for changes on the local filesystems, to make them compatible with all methods to access the filesystem. Then trigger syncs upon changes.
A helper application that will set up filesystem-watches locally and remotely (and triggers efficient and rock solid unison syncs appropriately) is:
https://launchpad.net/sucsynct
To make notifications work even with plain webservers (non-ssh enabled) they may be tunneled (idealy directly as stdin and stdout shell pipes) with something like:
https://cgi-shell.binaervarianz.de (maybe a FastCGI version of it)
RandolfCarter commentedon Nov 7, 2012
Is there any documentation on how to build this client version with inotify support? The one in the repositories for ubuntu doesn't seem to be compiled with it (the log there shows a scan every 10 seconds) - and in the comment above there is just one file linked, is it in a branch of some sort? Isn't gitorious the old code repository, shouldn't it be on github?
rconstanzo commentedon Nov 8, 2012
I've tried and abandoned a few versions of owncloud for similar reasons. I've got about 14k files and it spikes the client and server CPUs pretty hard.
nukeador commentedon Dec 6, 2012
+1
Having thousands of files and syncing all the time is cpu and bandwidth consuming :)
tafinho commentedon Dec 6, 2012
+1
Currently my system takes around 8 hours to check that no files where changed :)
nukeador commentedon Dec 7, 2012
I've just updated my Linux client from 1.1.1 to 1.1.3 and it seems it behaves better in terms of not polling all the time. Any clue if it was updated to support inotify?
dragotin commentedon Dec 7, 2012
@nukeador I think you might have suffered from another bug in 1.1.1, happy that it works better with 1.1.3
We are working on better inotify support on all platforms. Please stay tuned.
jvandenbroek commentedon Jan 2, 2013
+1 as well! With 13.000 files in 606 folders it takes more than 30 secs at 100% CPU, and that every minute.. :-( Very annoying! This is holding me from implementing ownCloud on larger scale..
RandolfCarter commentedon Jan 2, 2013
Have to test yet with 1.2 (beta), but there this should be implemented already as far as I heard!
jvandenbroek commentedon Jan 2, 2013
I have tested it with 1.2 beta1 on Windows.. Inotify works for new/changed files on client-side, but unfortunately not for files changed on server-side. So it still needs to poll the server to check for changes. Which is way too inefficient.
der-gilb commentedon Jan 10, 2013
+1

We are trying to implement owncloud as an alternative to dropbox in our university research group, but at the moment this is not possible due to the spiking CPU usage of the windows client. I have ~10000 files in ~1000 folders, and running the owncloud 1.1.4 client my CPU load looks like this:
jvandenbroek commentedon Jan 11, 2013
I read my own comment and statement, however, I think I was mistaken. The problem exists, but I don't think my explanation is correct. With the new client filesystem notifier, there shouldn't be a need for periodic polling. Maybe something which will be fixed in the next beta, after confirming that the new notifier works reliable enough? Or perhaps create an option to manually initiate this polling as an integrity check? And/or able to schedule it (perhaps also trigger on user inactivity)? I think it should be at least configurable.
napoleon41 commentedon Jan 22, 2013
I agree. The current beta 1.2 windows client still causes periodic CPU spikes. I am REALLY hoping that this is fixed soon as that's a deal breaker (power consumption, irritating fan noise variance, slow systems), and I really like what I've seen from owncloud. If there was a way to make this sync every 10 minutes instead of every minute, it might be bearable based on the duration of scanning my file set.
I did notice that changing the CPU priority of the owncloud process to lowest did reduce the impact on my system. However, it also increased the time over which the spike occurs. Obviously no free lunch.
22 remaining items
fragtion commentedon Aug 13, 2013
\o/ About time.. looking forward to moving back to Owncloud :)
ccoenen commentedon Aug 13, 2013
I'd like to apologize for the "demading" tone of my previous comment. Thanks for looking into this! It's very important to me. I'm looking forward to the upcoming version!
ogoffart commentedon Aug 16, 2013
In 1.4, the poll is just an HTTP request to check that nothing changed on the server.
There is still a full sync hapenning every 5 minutes to be sure we catch all the changes that may not been seen by the file system watcher.
fragtion commentedon Sep 20, 2013
What's the status on this - still a work in progress? Still needs to do a full sync every 5 minutes?
dragotin commentedon Sep 20, 2013
@fragtion absolutely not. Every fife minutes, we do one PROPFIND on the server and a poll through the local filesystem. No full sync.
disconn3ct commentedon Oct 17, 2013
Even on the newest client (1.4 on OSX) I'm still seeing 100% cpu usage.

This is doubly irritating on OSX, since there is a hacky (but functional) filesystem notification method in fsevents. (If used properly, you never have to do a scan - you can catch up with changes that were missed when the client was not running.)
9800 files, 2100 directories.
fosple commentedon Oct 17, 2013
@disconn3ct Same here on MacOS... :(
fragtion commentedon Oct 17, 2013
It's definitely a lot better on Windows now, haven't noticed a problem! Hope the devs can help you guys with Mac too, cause this rocks :)
wilzbach commentedon Jul 14, 2014
Hi guys,
is there an update on the use of inotify to traverse only parts of the tree?
If I look at the logs of the client 1.6 I still see the polling every 30sec for general changes on the filesystem and if there is only one detected change (etag), the client traverses the whole tree which sucks and takes a long time as I have 124K files ..
In summary my real-time syncing takes about 5-10 minutes (thanks to SSD and i7).
ogoffart commentedon Jul 14, 2014
The 30 seconds polling is only for server-side change, we don't look at the file system there.
We have a fille system watcher that track the changes. But it is not reliable so we still force a full scan of the local directory every 5 minutes. You can increase this time with the
forceSyncIntervaloption in the mirall config file (and set a number of milliseconds)christophwolff commentedon Aug 5, 2014
This issue is the only thing That keeps me away Form own cloud.
RandolfCarter commentedon Aug 6, 2014
@pixelpoesie you might notice that this issue is closed (and in this case, that more or less means, implemented). What exactly about it is it that keeps you away? If you have any suggestions on what to do better you probably should report a new issue.
ccoenen commentedon Aug 6, 2014
@pixelpoesie it's fine now. There might be room for improvement, but since 1.4 or 1.5 i don't notice the syncer anymore (which is probably the highest kind of praise for this type of software).
Before that, i used to turn it off in certain situations to save disk-io, CPU cycles and battery. Haven't done this in a while.
HTTP creds: Fix GUI blocking for 5 seconds when entering wrong password