Traffic shaping. Automated Start Pause, Start Pause.

Get help with all aspects of SABnzbd
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
Nipper
Newbie
Newbie
Posts: 7
Joined: April 14th, 2014, 6:51 am

Traffic shaping. Automated Start Pause, Start Pause.

Post by Nipper »

Like others i find my ISP limits my speed to specific sites/ports or packets.

What i have noticed is it takes my ISP two Minutes to decide to slow the connection down. If i pause sabnzdb for a fraction of time and then start it again my speed increases greatly for 2 minutes then gets limited after this time.

My question is, is it possible to automate pausing and starting with a script or are scripts only called when a download is completed? or can this be implemented any other way?

If your ISP is traffic shaping your connections, give this a try and see if your seeing a similar outcome. It would be interesting to see if others can confirm this.

Thanks
User avatar
sander
Release Testers
Release Testers
Posts: 8823
Joined: January 22nd, 2008, 2:22 pm

Re: Traffic shaping. Automated Start Pause, Start Pause.

Post by sander »

That has been discussed in the past.

You can set the download speed via the SABnzbd API, see http://wiki.sabnzbd.org/api#toc46 . Such an external script has been posted by me somewhere in the forum. From my memory: somewhere around 2010 or so. On Linux you can call it from cron / crontab.

So, yes it is possible to the set the speed, but you need an external script/program, and you can't do it from within SABnzbd itself.
Nipper
Newbie
Newbie
Posts: 7
Joined: April 14th, 2014, 6:51 am

Re: Traffic shaping. Automated Start Pause, Start Pause.

Post by Nipper »

User avatar
sander
Release Testers
Release Testers
Posts: 8823
Joined: January 22nd, 2008, 2:22 pm

Re: Traffic shaping. Automated Start Pause, Start Pause.

Post by sander »

Yes, that's it. Good find.

But I don't see my python script in that post. >:(
Anyway ... do you want to go that path? On what OS is your SABnzbd running?
Nipper
Newbie
Newbie
Posts: 7
Joined: April 14th, 2014, 6:51 am

Re: Traffic shaping. Automated Start Pause, Start Pause.

Post by Nipper »

Sabnzdb is running on Ubuntu, so i believe your route is a good option. Yes the script is missing :(, i assume you don't have it any where else?
User avatar
sander
Release Testers
Release Testers
Posts: 8823
Joined: January 22nd, 2008, 2:22 pm

Re: Traffic shaping. Automated Start Pause, Start Pause.

Post by sander »

OK, first learn & check the basics via lynx:

First set speed to 2222, and get feedback via JSON format:

Code: Select all

$ lynx --dump  'http://localhost:8080/api?mode=config&name=speedlimit&value=2222&output=json&apikey=6ad7183480d5cf6c9e7f71be9cfbda6f'
{"status":true}
Then set speed to 333, and get feedback via XML:

Code: Select all

$ lynx --dump  'http://localhost:8080/api?mode=config&name=speedlimit&value=333&output=xml&apikey=6ad7183480d5cf6c9e7f71be9cfbda6f'
<?xml version="1.0" encoding="UTF-8" ?>
<result><status>True</status>
</result>
Finally, set speed to 1111, with plain text output (I didn't know that was possible):

Code: Select all

$ lynx --dump  'http://localhost:8080/api?mode=config&name=speedlimit&value=1111&apikey=6ad7183480d5cf6c9e7f71be9cfbda6f'
ok

Result:

Code: Select all

$ grep -i bandwidth ~/.sabnzbd/logs/sabnzbd.log 
2014-04-14 23:23:18,579::INFO::[downloader:255] Bandwidth limit set to 2222
2014-04-14 23:23:45,665::INFO::[downloader:255] Bandwidth limit set to 333
2014-04-14 23:28:40,169::INFO::[downloader:255] Bandwidth limit set to 1111
Are you able to do this, using your own API key?

PS: I you use the wrong API key, you will get this:

Code: Select all

$ lynx --dump  'http://localhost:8080/api?mode=config&name=speedlimit&value=1111&apikey=wronggggggggg'
error: API Key Incorrect
Nipper
Newbie
Newbie
Posts: 7
Joined: April 14th, 2014, 6:51 am

Re: Traffic shaping. Automated Start Pause, Start Pause.

Post by Nipper »

Tryed all the commands you posted and all worked ok, also the log history confirmed it working.
User avatar
sander
Release Testers
Release Testers
Posts: 8823
Joined: January 22nd, 2008, 2:22 pm

Re: Traffic shaping. Automated Start Pause, Start Pause.

Post by sander »

Nipper wrote:Tryed all the commands you posted and all worked ok, also the log history confirmed it working.
OK. Are you now able to get it to work the way you want it?

Tip:
pause-sabnznd.sh: set to 0
unpause-sabnzbd: set to 99999
Then run from crontab
Nipper
Newbie
Newbie
Posts: 7
Joined: April 14th, 2014, 6:51 am

Re: Traffic shaping. Automated Start Pause, Start Pause.

Post by Nipper »

After a quick google of crontab I believe you have provided me enough info to be able to do what I set out to do thanks you have been very helpful. :D
User avatar
sander
Release Testers
Release Testers
Posts: 8823
Joined: January 22nd, 2008, 2:22 pm

Re: Traffic shaping. Automated Start Pause, Start Pause.

Post by sander »

If you start developing and run into problems, let it know; I'm happy to help.
Nipper
Newbie
Newbie
Posts: 7
Joined: April 14th, 2014, 6:51 am

Re: Traffic shaping. Automated Start Pause, Start Pause.

Post by Nipper »

i have added :

*/2 * * * * lynx --dump 'http://localhost:8080/api?mode=pause&ap ... be9cfbda6f' && lynx --dump 'http://localhost:8080/api?mode=resume&a ... be9cfbda6f'

to my crontab file and all seems to be working very well, thanks for the help.
User avatar
sander
Release Testers
Release Testers
Posts: 8823
Joined: January 22nd, 2008, 2:22 pm

Re: Traffic shaping. Automated Start Pause, Start Pause.

Post by sander »

Nipper wrote: and all seems to be working very well, thanks for the help.
So each two minutes you throttle SAB and immediately resume SAB, and that works? Interesting.
Nipper
Newbie
Newbie
Posts: 7
Joined: April 14th, 2014, 6:51 am

Re: Traffic shaping. Automated Start Pause, Start Pause.

Post by Nipper »

Yes, this has increased my download rate from 1.4MB to 4.4MB on ISP plusnet.
User avatar
sander
Release Testers
Release Testers
Posts: 8823
Joined: January 22nd, 2008, 2:22 pm

Re: Traffic shaping. Automated Start Pause, Start Pause.

Post by sander »

Nipper wrote:Yes, this has increased my download rate from 1.4MB to 4.4MB on ISP plusnet.
Hahaha, cool!
Post Reply