Page 1 of 1

Traffic shaping. Automated Start Pause, Start Pause.

Posted: April 14th, 2014, 7:09 am
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

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

Posted: April 14th, 2014, 10:20 am
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.

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

Posted: April 14th, 2014, 11:43 am
by Nipper

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

Posted: April 14th, 2014, 12:05 pm
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?

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

Posted: April 14th, 2014, 2:24 pm
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?

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

Posted: April 14th, 2014, 4:30 pm
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

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

Posted: April 15th, 2014, 4:28 pm
by Nipper
Tryed all the commands you posted and all worked ok, also the log history confirmed it working.

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

Posted: April 15th, 2014, 4:32 pm
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

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

Posted: April 16th, 2014, 1:29 am
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

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

Posted: April 16th, 2014, 8:36 am
by sander
If you start developing and run into problems, let it know; I'm happy to help.

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

Posted: April 16th, 2014, 4:17 pm
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.

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

Posted: April 16th, 2014, 11:48 pm
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.

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

Posted: April 17th, 2014, 4:00 am
by Nipper
Yes, this has increased my download rate from 1.4MB to 4.4MB on ISP plusnet.

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

Posted: April 17th, 2014, 4:12 am
by sander
Nipper wrote:Yes, this has increased my download rate from 1.4MB to 4.4MB on ISP plusnet.
Hahaha, cool!