Set nice scheduling/priority at start ?

Support for the Debian/Ubuntu package, created by JCFP.
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
User avatar
rascalli
Moderator
Moderator
Posts: 656
Joined: January 18th, 2008, 12:30 am
Location: Bossche bollen land

Set nice scheduling/priority at start ?

Post 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
Last edited by rascalli on September 13th, 2010, 1:18 pm, edited 1 time in total.
User avatar
sander
Release Testers
Release Testers
Posts: 9062
Joined: January 22nd, 2008, 2:22 pm

Re: Set nice scheduling/priority at start ?

Post 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$ 
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
rascalli
Moderator
Moderator
Posts: 656
Joined: January 18th, 2008, 12:30 am
Location: Bossche bollen land

Re: Set nice scheduling/priority at start ?

Post 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
User avatar
sander
Release Testers
Release Testers
Posts: 9062
Joined: January 22nd, 2008, 2:22 pm

Re: Set nice scheduling/priority at start ?

Post 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:~$ 
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
rascalli
Moderator
Moderator
Posts: 656
Joined: January 18th, 2008, 12:30 am
Location: Bossche bollen land

Re: Set nice scheduling/priority at start ?

Post 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+
Last edited by rascalli on September 14th, 2010, 12:34 am, edited 1 time in total.
User avatar
jcfp
Release Testers
Release Testers
Posts: 1004
Joined: February 7th, 2008, 12:45 pm

Re: Set nice scheduling/priority at start ?

Post 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.
User avatar
rascalli
Moderator
Moderator
Posts: 656
Joined: January 18th, 2008, 12:30 am
Location: Bossche bollen land

Re: Set nice scheduling/priority at start ?

Post 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 ?
User avatar
jcfp
Release Testers
Release Testers
Posts: 1004
Joined: February 7th, 2008, 12:45 pm

Re: Set nice scheduling/priority at start ?

Post by jcfp »

If ionice is inherited by subprocesses (not sure) you could just put the ionice stuff before the start-stop-daemon command?
User avatar
rascalli
Moderator
Moderator
Posts: 656
Joined: January 18th, 2008, 12:30 am
Location: Bossche bollen land

Re: Set nice scheduling/priority at start ?

Post 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
Last edited by rascalli on October 4th, 2010, 10:10 pm, edited 1 time in total.
guckpup
Newbie
Newbie
Posts: 4
Joined: January 8th, 2010, 11:26 am

Re: Set nice scheduling/priority at start ?

Post 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.
Last edited by guckpup on June 19th, 2011, 1:04 pm, edited 1 time in total.
Post Reply