Page 1 of 1

Set nice scheduling/priority at start ?

Posted: September 13th, 2010, 1:11 pm
by rascalli
I would like to set IO scheduling class & IO priority at boot.

What I would like is : best effort & low priority
It now starts at :

IO scheduling class : default
IO priority : 0

I looked i the WIKI .. but in there only nice is not explained.

Only ionice for external programs

Re: Set nice scheduling/priority at start ?

Posted: September 13th, 2010, 3:41 pm
by sander
Does this help (or do you mean something else?):

Code: Select all

sander@athlon64:~/SABnzbd-0.5.4$ ps -ef | grep -i sabnzbd
sander   22915  3972  7 22:29 pts/1    00:00:01 /usr/bin/python -OO ./SABnzbd.py
sander   22960     1  6 22:29 ?        00:00:01 /usr/lib/chromium-browser/chromium-browser http://localhost:8080/sabnzbd
sander   22961 22960  0 22:29 ?        00:00:00 /usr/lib/chromium-browser/chromium-browser http://localhost:8080/sabnzbd
sander   23009 22920  0 22:29 pts/4    00:00:00 grep -i sabnzbd
sander@athlon64:~/SABnzbd-0.5.4$ ionice -p 22915
none: prio 0
sander@athlon64:~/SABnzbd-0.5.4$ ionice -c 3 -p 22915
sander@athlon64:~/SABnzbd-0.5.4$ ionice -p 22915
idle
sander@athlon64:~/SABnzbd-0.5.4$ 

Re: Set nice scheduling/priority at start ?

Posted: September 13th, 2010, 4:05 pm
by rascalli
I know you can do this for running processes. ( did that as work around)
But was hoping you could also set it @boot

So when sabnzbd+ is started , it would start with low priorities

Re: Set nice scheduling/priority at start ?

Posted: September 13th, 2010, 4:55 pm
by sander
How about:

Code: Select all

ionice -c 3 ./SABnzbd.py
and then check:

Code: Select all

sander@quirinius:~$ ps -ef | grep -i sabn
sander   13956  2976 18 23:46 pts/1    00:00:03 /usr/bin/python -OO ./SABnzbd.py
sander   14005  3568  0 23:46 pts/2    00:00:00 grep --color=auto -i sabn
sander@quirinius:~$ ionice -p 13956
idle
sander@quirinius:~$ 

Re: Set nice scheduling/priority at start ?

Posted: September 14th, 2010, 12:21 am
by rascalli
That also does not make the level sticky after a restart of the server or service

I use the init.d script to start it

I already found out that when I type in the terminal :  ionice -c2 -n6 /etc/init.d/sabnzbdplus start

Then it works ....

---
Also the nice lever is set at : 0 (default)
but I would like that to be between 10-15  (lower priority)  << I now set taht with webmin



But ideal would be to have all set at boot of the server    or start/restart of sabnzbd+

Re: Set nice scheduling/priority at start ?

Posted: September 14th, 2010, 10:33 am
by jcfp
Tweak /etc/init.d/sabnzbdplus, in start_sab(), add --nicelevel to the start-stop-daemon command. Ionice is probably not needed, since sab can already do that for io-intensive subprocesses like unrar.

Re: Set nice scheduling/priority at start ?

Posted: September 14th, 2010, 12:11 pm
by rascalli
yes I have ionice set for PAr2 & rar

But woudl like to set ionice aso for sabnzbd+ , what command whould I need then ?

Re: Set nice scheduling/priority at start ?

Posted: September 15th, 2010, 1:38 pm
by jcfp
If ionice is inherited by subprocesses (not sure) you could just put the ionice stuff before the start-stop-daemon command?

Re: Set nice scheduling/priority at start ?

Posted: September 16th, 2010, 1:35 am
by rascalli
jcfp wrote: If ionice is inherited by subprocesses (not sure) you could just put the ionice stuff before the start-stop-daemon command?
That did the trick , thank you for this

Re: Set nice scheduling/priority at start ?

Posted: June 19th, 2011, 12:52 pm
by guckpup
If sabnzbd is installed using the ubuntu (debian too?) packages, you can make use of the built in option for start-stop-daemon to set io class and/or prio.
      -I, --iosched class:priority                                                                                              
             This alters the IO scheduler class and priority of the process before starting it. The priority can  be  option-    
             ally  specified  by  appending  a : followed by the value. The default priority is 4, unless class is idle, then    
             priority will always be 7. The currently supported values for class are idle, best-effort and real-time.            
So in /etc/init.d/sabnzbdplus, in the line

Code: Select all

start-stop-daemon --quiet --chuid $USER --start --exec $DAEMON -- $OPTIONS 
edit it as follows:

Code: Select all

start-stop-daemon --quiet --chuid $USER --iosched idle --nicelevel 19 --start --exec $DAEMON -- $OPTIONS 
* Starting SABnzbd+ binary newsgrabber
  ...done.
# ps axl|grep sabnzbd
1     0  4381     1  39  19 308128 40392 stext  SNl  ?          0:00 /usr/bin/python -OO /usr/bin/sabnzbdplus --daemon --config-file ~/.sabnzbd/sabnzbd.ini --server 192.168.1.11:8082
# ionice -p 4381
idle

Lovely.