trickle enhancement: scheduled bandwidth shaping

Bug #364986 reported by mblythester on 2009-04-22
8
Affects Status Importance Assigned to Milestone
trickle (Ubuntu)
Wishlist
Unassigned

Bug Description

Binary package hint: trickle

I have attached a patch that adds bandwidth scheduling to trickle. Schedules must be specified on the command line for now, but it would be a fairly easy change for them to be read from a file instead. Both -u and -d flags can be specified in the following form:

[default limit](:[days of week][start time],[end time],[bandwidth limit])+

default limit = the bandwidth limit (in kB) that is used when another limit is not specified
days of week = any of "Su" "M" "T" "W" "Th" "F" "Sa" in any order. If no day is specified, the schedule will apply for all days
start time = 3-or-4-digit 24-hour local time to begin the new bandwidth schedule. "1234" would mean 12:34 PM. "123" would mean 1:23 AM. "2345" would mean 11:45 PM.
end time = 3-or-4-digit 24-hour local time to end the new bandwidth schedule.
bandwidth limit = the bandwidth limit (in kB) that is used during the specified time.

Multiple schedules can be strung together on the command line. If hte schedules overlap, the last ones take precident.

Example: trickled -d 50 -u 10:WSaSu130,145,1000:MTTh1200,300,96
This would start a trickled daemon that would enforce the following:
-constant 50 kB/s download limit
-1000 kB/s upload limit between 1:30 AM and 1:45 AM on Wednesdays, Saturdays, and Sundays
-96 kB/s upload limit between 12:00 noon and 3:00 PM on Mondays, Tuesdays, and Thursdays
-10 kB/s upload limit otherwise

Example: trickle -s -u 100 -d "10000:900,1700,10" -v wget www.example.net/bigfile.tar.gz
This would limit the bandwidth available to wget as follows:
-constant 100 kB/s upload limit
-10 kB/s download limit between 9:00 AM and 5:00 PM all days of the week
-10,000 kB/s download limit otherwise

I will attach 2 patches. The first, "trickle_1.07-5.diff.gz" appears to be the total diff between a vanilla source tree of trickle-1.07 and my current version (including my changes and Ubuntu's customization?).

The second patch, "trickle_mydiff.gz" is the diff of my changes from the trickle-1.07-5 source that I obtained in Ubuntu 8.10 using the command "sudo apt-get source trickle". It is really the substance of my changes.

While I can't say that I've thoroughly tested my changes, they seem to work as intended. I used the modified version of trickle to bandwidth shape my remote backup. It was more restrictive during the evening (when I want my web browsing to be quick), and less restrictive during the night (sleeping) and in the middle of the day (at work). It worked exactly as I wanted it to.

mblythester (mblythester) wrote :
mblythester (mblythester) wrote :

P.S. I ran "sudo dpkg-buildpackage" to create the .deb that I installed to test my changes. dpkg thinks the version is 1.07-5, so the Update Manger is prompting me to "upgrade" to version 1.07-5 from the apt repositories. How do I create the package as something like version 1.07-5.1 to let my system know that this is the more up-to-date version?

Thanks in advance!

mblythester (mblythester) wrote :

The attached patch also works against the trickle 1.07-7 source included in Ubuntu 9.10 (Karmic). I just applied the patch again so I could have my improved trickle installed on my system.

Daniel Hahler (blueyed) wrote :

Thank you for your contribution.

This patch should get forwarded to the upstream author of trickle though - please do so either by contacting him by email or using the appropriate bug tracker (if there's any).
If you're using a bug tracker to submit this patch, you might want to link back to it from here.

Thanks again.

Changed in trickle (Ubuntu):
importance: Undecided → Wishlist
status: New → Triaged

Dan,

Thanks for your response.

I had attempted to contact the upstream author a couple of times before
I filed this bug, but I've never gotten a response. There does not seem
to be bug tracker on his website
(http://monkey.org/~marius/pages/?page=trickle), and it seems that he
hasn't updated the trickle code in about 7 years. I'm afraid that he's
abandoned it.

What do you recommend I do?

Thanks,
MattB

Daniel Hahler wrote:
> Thank you for your contribution.
>
> This patch should get forwarded to the upstream author of trickle though - please do so either by contacting him by email or using the appropriate bug tracker (if there's any).
> If you're using a bug tracker to submit this patch, you might want to link back to it from here.
>
> Thanks again.
>
> ** Changed in: trickle (Ubuntu)
> Importance: Undecided => Wishlist
>
> ** Changed in: trickle (Ubuntu)
> Status: New => Triaged
>
>

Ken Sharp (kennybobs) wrote :

Create a new repository on Launchpad?

Lenbok (lenbok) wrote :

Please make a repository and/or PPA containing trickle.

This is a very valuable feature (e.g. I would like to use it to schedule the times when google musicmanager is allowed to do music syncing).

mblythester (mblythester) wrote :

After fighting against launchpad & various command-line utilities for a while, I've managed to create a PPA with my changes: https://launchpad.net/~mblythester/+archive/trickle2

Lenbok (lenbok) wrote :

Many thanks - I have installed this from your PPA and it seems to be working nicely!!!

Lenbok (lenbok) wrote :

Does your patched version include updated documentation? I couldn't see anything in the man pages, and so I keep coming back to this launchpad entry when I need to remind myself how the schedules should be formatted. It would be great if the documentation included the type of information you posted in the initial bug description.l

mblythester (mblythester) wrote :

No, sorry, I didn't update the documentation in the PPA version or my
patches. I'll do it this weekend.

-MattB

On Fri, Apr 26, 2013 at 11:11 PM, Lenbok <email address hidden> wrote:

> Does your patched version include updated documentation? I couldn't see
> anything in the man pages, and so I keep coming back to this launchpad
> entry when I need to remind myself how the schedules should be
> formatted. It would be great if the documentation included the type of
> information you posted in the initial bug description.l
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/364986
>
> Title:
> trickle enhancement: scheduled bandwidth shaping
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/ubuntu/+source/trickle/+bug/364986/+subscriptions
>

jessesmith (jessefrgsmith) wrote :

I am taking over upstream development of Trickle. The patch you so kindly supplied has been applied upstream. Thank you.

If you have any further improvements or additions to things such as documentation I will be happy to accept them. You can send in patches to <email address hidden>.

Thanks again.

jessesmith (jessefrgsmith) wrote :

Quick update: The supplied patch causes programs performing downloads to run into errors with the data stream. Unfortunately this patch will have to be removed until the regression is fixed.

mblythester (mblythester) wrote :

Hmm, that's strange. I applied my patch after the Ubuntu patches were applied, maybe that makes a difference? I'm away from home right now, but I'll take a closer look when I get back.

By the way, thanks for picking up the development!

jessesmith (jessefrgsmith) wrote :

You are correct. There were some other patches involved in bringing trickle up to speed (patches from a variety of sources always plays havoc). I've reordered the patches and now the scheduling patch you posted works. Sorry for the confusion.

The latest version of trickle (1.08) contains your scheduling patch (along with a number of fixes) and can be downloaded from http://trickled.sf.net

jessesmith, original author seems to have put it on github as well: https://github.com/mariusae/trickle/

mblythester (mblythester) wrote :

Kevin, thanks for the github pointer. I've opened a pull request there to get these changes pulled in upstream: https://github.com/mariusae/trickle/pull/11

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers