0
Declined

[Feature Request] Use inotify to allow removal of constant polling

Stephen Hill 5 years ago updated by Tom 5 years ago 4
Example of use in another Java media server here - http://wiki.serviio.org/doku.php?id=library_scanning_mechanism.
Requires Java v7 though.
Under review
At the beginning of Ubooquity, I had plans to include this feature.
Then, after writing the first version of the scanner (which periodically polls instead of monitoring the file system), I realized that the check of the files (the part that would be eliminated by the OS hook notification) was extremely fast as it is just a date comparison. Files are not actually read unless they have been modified (in which case a rescan is necessary in any case).

So the gain would very probably be quite small, both in terms of time and CPU resources.
Did you have a specific problem in mind that would be solved by such a mechanism ?
Power consumption would be reduced and cpu resources for other things running on the server would be increased.
The big problem with polling is always how often to poll, poll more often and higher CPU usage, poll less often means having to wait longer for new files to be detected which is rather annoying. Generally polling always means having to wait...using inotify means almost zero wait time which is far better.
I agree with you on principle.

However, I checked the time required to scan a collection of 6000 files (almost 200 GB) on my core i3 PC (admittedly much faster than what can be found in a NAS, but still...). The scanning time once the file are in the database (i.e. the periodical polling time) is under one second. And that's because the files themselves are not accessed during this check. So I'm not concerned about the CPU usage.

And even though I can understand the annoyance of having to wait for the polling to be triggered (or to have to manually trigger it), for now the development and testing costs of this feature exceed the benefits I see in it.
(I'll keep it in my backlog nevertheless, but it might never be done)