Page 1 of 2

Scanning for updated files setting appears ignored

PostPosted: Sun Apr 10, 2011 5:51 pm
by stephendhill
I am using Serviio 0.5.2. I have been noticing very high CPU usage most of the time. I have "Search for updates of currently shared files" deselected, but when I look in the log I still see this:

  Code:
  [LibraryUpdatesCheckerThread] Started looking for updates to currently shared files


which seems very odd and would account for why I see "java" at the top of my process cpu usage list. I have an enormous amount of photos, which I assume it is scanning constantly?

P.S. Is the any chance of serviio being updated to support file system notification of changes (inotify)? This is supported by mediatomb, and would avoid the need for polling for changes to the filesystem.

Re: Scanning for updated files setting appears ignored

PostPosted: Sun Apr 10, 2011 7:24 pm
by Cerberus
stephendhill wrote:I am using Serviio 0.5.2. I have been noticing very high CPU usage most of the time. I have "Search for updates of currently shared files" deselected, but when I look in the log I still see this:

  Code:
  [LibraryUpdatesCheckerThread] Started looking for updates to currently shared files


which seems very odd and would account for why I see "java" at the top of my process cpu usage list. I have an enormous amount of photos, which I assume it is scanning constantly?

P.S. Is the any chance of serviio being updated to support file system notification of changes (inotify)? This is supported by mediatomb, and would avoid the need for polling for changes to the filesystem.


viewtopic.php?f=5&t=1791

and no we dont have access to low level process's currently

Re: Scanning for updated files setting appears ignored

PostPosted: Sun Apr 10, 2011 7:44 pm
by stephendhill
At high cpu usage the fan on my server machine gets very noisy (and it also chews a lot of power).

Re: Scanning for updated files setting appears ignored

PostPosted: Sun Apr 10, 2011 8:23 pm
by zip
The high CPU can also be caused by searching for new or removed files. If you have a fairly stable folder (ie no additions/removals of files), you can uncheck the circular arrow checkbox for those folders to disable searching for new files.

iNotify would be nice, but I fear that it wont work on all possible OSes where Serviio otherwise could run. I am hoping for a soonish releqse of Java 7 which brings this functionality.

Re: Scanning for updated files setting appears ignored

PostPosted: Fri Jul 29, 2011 6:49 am
by stephendhill
Java 7 has been released with support for IO notification wrapped us as the WatchService API!

http://java.sun.com/developer/technical ... ase/nio/#6

Re: Scanning for updated files setting appears ignored

PostPosted: Fri Jul 29, 2011 10:22 am
by Cerberus
stephendhill wrote:Java 7 has been released with support for IO notification wrapped us as the WatchService API!

http://java.sun.com/developer/technical ... ase/nio/#6


yep but current version of serviio WILL NOT run of java 1.7, and with ZIP on his holiday im unsure if 0.6 will work either.

Re: Scanning for updated files setting appears ignored

PostPosted: Sat Jul 30, 2011 2:46 am
by zip
I'll want to have 0.6 working with Java 1.7 but this IO feature won't be implemented for some time. One of the reasons being a lot of NAS installations don't have Java 7 yet and probably won't have for some time. Once it's more widespread then I can look at making Serviio Java 7 only.

Re: Scanning for updated files setting appears ignored

PostPosted: Tue Nov 22, 2011 12:48 pm
by ddfs
Any updates here?
I have Serviio working on Synology NAS with Java 7 installed. Maybe it's time? :)

Re: Scanning for updated files setting appears ignored

PostPosted: Tue Nov 22, 2011 1:56 pm
by zip
Java 7 is not ready for Mac yet, let alone some of the smaller linux (nas) distros

Re: Scanning for updated files setting appears ignored

PostPosted: Tue Nov 22, 2011 7:54 pm
by Cerberus

Re: Scanning for updated files setting appears ignored

PostPosted: Fri Jan 13, 2012 8:50 pm
by manonmoon
I think I found a way that enables Serviio to work with inotify with utilizing the incron deamon:

I created a script
  Code:
#!/bin/bash
        #Initiate Library Refresh vi Rest API
        curl -X POST "http://192.168.178.21/rest/action" -H "Content-Type: text/xml" -d "<action><name>forceLibraryRefresh</name></action>" &> /dev/null
       
        #Incron does not support recursive inotify so we have to create a config file including all directories on our own
        find /pathtofolder/Video -type d -print0 | xargs -0 -I{} echo "{} IN_CREATE,IN_MOVED_TO,IN_MOVED_FROM,IN_MOVE_SELF,IN_MODIFY,IN_DELETE_SELF,IN_DELETE /pathtothisscript/thisscript" > /etc/incron.d/serviio.conf
        find /pathtofolder/Audio -type d -print0 | xargs -0 -I{} echo "{} IN_CREATE,IN_MOVED_TO,IN_MOVED_FROM,IN_MOVE_SELF,IN_MODIFY,IN_DELETE_SELF,IN_DELETE /pathtothisscript/thisscript" >> /etc/incron.d/serviio.conf
        ;;



This works absolutley great on my Ubuntu 10.04 Server. Nevertheless updating big libraries takes extremly long thus I would recommend to add support for parameters to the forceLibraryRferesh Action that allows us to specify which folder to update.

Re: Scanning for updated files setting appears ignored

PostPosted: Fri Jan 13, 2012 11:11 pm
by zip
All this will come at some point with Java 7.

Library Refresh triggered by inotify

PostPosted: Sat Jan 14, 2012 9:15 am
by manonmoon
Hi Zip,

I completley understand this. I just wanted to provide a workaround till Java 7 and the support is integrated in Serviio.
Also for those who are interested, I slightly modified the script since it did not scan directory names with blanks.

  Code:
#!/bin/bash
        #Directories to watch separated by blanks
        WATCH="dir1 dir2 dir3"
   
      #Initiate Library Refresh via Rest API
        curl -X POST "http://<ServiioIP>/rest/action" -H "Content-Type: text/xml" -d "<action><name>forceLibraryRefresh</name></action>" &> /dev/null
 
       #Incron does not support recursive inotify so we have to create a config file including all directories on our own
        cat /dev/null > /etc/incron.d/serviio.conf
        while read N; do
          DIR=$(echo $N | sed 's/\ /\\\ /g')
          echo $DIR "IN_CREATE,IN_MOVED_TO,IN_MOVED_FROM,IN_MOVE_SELF,IN_MODIFY,IN_DELETE_SELF,IN_DELETE <pathtothisscript/thisscript>" >> /etc/incron.d/serviio.conf
        done < <(find $WATCH -type d)


Also make sure that you have installed the correct packages. For Ubuntu 10.04:
  Code:
  sudo apt-get install curl incron


I hope some may find this useful.

Re: Scanning for updated files setting appears ignored

PostPosted: Sat Jan 14, 2012 11:58 am
by zip
good job. My previous comment was just to clarify it's coming and I won't be making a change in the API for now.

Re: Scanning for updated files setting appears ignored

PostPosted: Sat Jan 14, 2012 1:45 pm
by manonmoon
Just two more questions: will Serviio get any trouble if the forceLibraryRefresh command is sent very often in a short timeframe?
Will the library refresh be restarted every time the command is received or will it just ignore new requests when a refresh is already running?

Re: Scanning for updated files setting appears ignored

PostPosted: Sat Jan 14, 2012 1:54 pm
by zip
it'll restart the checking threads, thus starting from the beginning every time

Re: Scanning for updated files setting appears ignored

PostPosted: Tue Feb 07, 2012 7:19 am
by afn
zip wrote:The high CPU can also be caused by searching for new or removed files. If you have a fairly stable folder (ie no additions/removals of files), you can uncheck the circular arrow checkbox for those folders to disable searching for new files.

iNotify would be nice, but I fear that it wont work on all possible OSes where Serviio otherwise could run. I am hoping for a soonish releqse of Java 7 which brings this functionality.


There's actually a library called jnotify which wraps various OS-specific notification services in a nice Java API. You should consider this as a stop-gap until Java 7 is widely adopted...

Best,
Tony

Re: Scanning for updated files setting appears ignored

PostPosted: Tue Feb 07, 2012 7:26 am
by afn
afn wrote:There's actually a library called jnotify which wraps various OS-specific notification services in a nice Java API. You should consider this as a stop-gap until Java 7 is widely adopted...

Best,
Tony


Oops, sorry -- I just saw #141 and #385.

Re: Scanning for updated files setting appears ignored

PostPosted: Sat Aug 04, 2012 9:30 pm
by Gonzakpo
Hi. Sorry to bump this again. I just wanted to know if there are any news about Java 7 and using inotify.

Thanks for all your GREAT work! I love it!

Re: Scanning for updated files setting appears ignored

PostPosted: Sun Aug 05, 2012 5:26 pm
by zip
No, will be fixed as a part of this ticket: https://bitbucket.org/xnejp03/serviio/i ... ations-was