Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Speed Limit Scheduler
BiglyBT has a built-in scheduler for automatically changing speed limits based on the time of day and also allows for the pausing and resuming of downloads based on either a schedule or total data transferred in a day/week/month.
Pending construction of a graphical configuration tool this is currently all driven from the 'Speed Limits' menu hierarchy found under the 'Tools' menu.
Table of Contents
A 'profile' contains a collection of speed limits that you want to either manually apply or schedule. Rather than manually entering the value when creating a profile, you set BiglyBT up with the limits you want (global limits, per-download limits, category/tag limits) and then create a profile - this will snapshot those limit settings for later use. If you want to edit a profile then first of all 'apply' it (menu option under the profile), then make your changes and re-save it with the same name. As an example, say you want to create a profile called 'Fred' that has a global upload limit of 50 KB/sec and a download limit of 100KB/sec:
- Set the limits in BiglyBT , for example by right-clicking on the speed indicators in the status bar and selecting/entering the required values
- Create the profile via Tools->Speed Limits->Save Current As... - enter Fred when prompted
The schedule is accessed via the 'Schedule...' menu option - this opens a text file containing the current schedule specifications. There is some help text at the top of this file giving an overview of the commands permitted.
If multiple rules apply at the same time then the one furthest down the schedule file will take precedence.
For the schedule to be active it needs to be enabled. This requires a line of the form
To disable the schedule switch the 'yes' to 'no'
Profiles are applied automatically by specifying a rule of the form
<frequency> <profile_name> from <time> to <time> [extension]* frequency: daily|weekdays|weekends|<day_of_week> days_of_week: mon|tue|wed|thu|fri|sat|sun time: hh:mm - 24 hour clock; 00:00=midnight; local time
Say you wanted to download at a slow rate (say 100K/sec max) during the day (9am to 5pm). First you would set the desired speed limits in BiglyBT (right-click on the download speed in the status bar and select/enter 100k) and save this as a profile via the 'Save current as...' - let's call it 'slow_day'. You would then enter the following schedule line
daily slow_day from 09:00 to 17:00
You can see which, if any, profiles are currently being applied by checking the 'View Current...' menu.
Note that the rules are periodically checked to select the currently active rule, so there may be a small delay between a rule's specified start/end times and the actual times a rule is observed to be activated/deactivated.
These consist of zero or more extensions to be applied when the rule is active. The following are defined
These cause downloads assigned to a tag to be started/stopped when the rule is active. Note that if, for example, you define a rule to start downloads assigned to a tag, the downloads will not automatically be stopped when the rule becomes inactive. To do this you would need to define a second rule that caused the tag to be stopped and ensure this was active when the initial one isn't. For example
daily test from 00:00 to 00:00 stop_tag:Test daily test from 13:15 to 14:15 start_tag:Test
would cause downloads assigned to tag 'Test' to be started at 13:15 and stopped at 14:15.
daily null from 08:00 to 16:38 disable_net_limit:fred1;fred2
would cause the net-limit nameds 'fred1' and 'fred2' to be disabled between 8am and 16:38
There are currently three pre-defined profiles called 'null', 'pause_all' and 'resume_all'. The first supports rules that have no associated rate limits but are wanted for their extended features. The second and third support pausing/resuming all downloads. These are scheduled in the same way. If you wanted to prevent downloading during the week from 6am to 6pm you would use:
weekdays pause_all from 06:00 to 18:00
The 'resume_all' profile can be combined with the 'add torrents paused' feature found under Tools->Options->Files->Torrents (select both the 'add torrents stopped' and 'when a torrent is added stopped, pause it' options) to set up a schedule whereby torrents added during the day will sit idle until a 'resume_all' kicks in later at night (for example)
You can also arrange for downloading to be automatically paused when certain limits are exceeded. This is of particular use if your ISP has limits that you don't want to exceed. Of course, these settings only control network traffic generated by BiglyBT so you will need to balance this against network usage by other applications and devices on your network.
Control is at the daily, weekly and monthly level and are based on the current day/week/month (i.e. it is not the 'last week/month'). The start of your week (default Sunday) and month (default 1st) can be adjusted via the Tools->Options->Statistics setting for 'long-term' stats.
The syntax of these rules is
net_limit [hourly|daily|weekly|monthly] total=<limit>|[up=<limit> down=<limit>] [,name=<name>]
There are also sliding window equivalents - these accounting periods don't start at week/day/hour start, rather they continually assess the totals from the week/day/hour period up to the current time:
A multiplier can be appended to the sliding limits to vary the period. For example:
net_limit shourly*2 // two hour sliding window net_limit sdaily*0.5 // 12 hour window
In general you will probably want to control the total network usage (total=upload + download) but if you want you can specify alternative limits for upload and download.
If your ISP had a limit of 250GB a month (accounting starting on 1st of the month) then you might allocate 200GB of this to BiglyBT and use the line:
net_limit monthly total=200G
However, you might not want to blow your entire 200G at the start of the month as this would leave you unable to download towards the end of the month. So you might also add a
net_limit weekly total=50G
in order to spread things out.
The limits described above apply to the entire time period against which they are specified (day, week or month).
It is also possible to attach the limit to a profile. When this is done the limit is applied only against network transfers made while the profile is active, and also only enforced when the profile is active. This allows support for scenarios where there are different off-peak/on-peak limits, or perhaps unlimited transfers during the night. As an example, consider the case where there is a monthly limit of 100GB but unlimited transfer between 2am and 6am daily. To implement this create two profiles (e.g. "limited" and "unlimited") to represent the states, then create two rules and net_limit entries to track usage:
daily limited from 06:00 to 01:59 daily unlimited from 02:00 to 05:59 net_limit monthly:limited total=100GB net_limit monthly:unlimited
The name of the profile is appended to the net_limit period with a ':' - so "monthly:limited" means that this limit applies "monthly" when the "limited" profile is active.
A net_limit with no quantities attached means 'no limits'
It is also possible to attach the limit to a tag or peer set. When this is done the limit is applied only against network transfers made by downloads assigned to the tag/peer set. When the limit is exceeded the tag/peer set will have its up/download speed limits set to 'disabled' to prevent transfer or, if both up and down limits are exceeded then the tag will be paused.
net_limit hourly$fred total=100KB
The name of the tag/peer set is appended to the net_limit period with a '$' - so "hourly$fred" means that this limit applies "hourly" to the tag/peer set named 'fred'.
The schedule can also be used to specify sets of Peers for reporting bandwidth usage against, and also optionally applying speed limits.
BiglyBT already has the concept of 'LAN peers' built-in, and you can manually specify what is to be considered a 'LAN peer' via Tools->Options->Plugins->LAN Peer Finder. However, if you want to report/limit other Peer sets then you can create a 'Peer Set' for doing so:
peer_set <set_name> <CIDR_specs...>|CC List|Network List|<prior_set_name> [,inverse=[yes|no]] [,up=<limit>] [,down=<limit>] [,peer_up=<limit>] [,peer_down=<limit>] [,cat=<cat names>] [,tag=<tag names>]
Each set has a name, a peer selection criteria, an optional 'inverse' parameter (if set to 'yes' this inverts the selected peers to select), an optional upload/download limit, an optional per-peer upload/download limit and an optional list of categories/tags to further restrict the application of the peer set.
- CIDR_specs: list of IP ranges using CIDR notation (e.g. 184.108.40.206/19)
- CC List: list of Country codes (2 character country codes)
- Network List: Networks - Public, I2P or Tor. IPv4, IPv6, LAN and WAN are also supported to segment the Public network further
- prior_set_name: Includes the peer selection criteria from another Peer set to avoid duplication
To define another set the represents everyone else:
peer_set rest=us_ca, inverse=yes
Rate limits and category/tag restrictions can be applied to these as any other Peer Set.
Using the new 'Tag Activity' view in the statistics panel you can see the upload and download rates being achieved by Peer Set too.
Note that for the country code feature to work the 'Location Provider' plugin must be installed in BiglyBT.
Peer Sets also support the ability to use rate limits to disable upload or download entirely (by right-clicking on the set names in the sidebar and selecting the rate limit menu).
Say you only wanted to download from peers in France for certain torrents. This can be achieved by first creating a Tag to use to select the affected torrents - call it FR_Download and assign the required torrents to it. Then create the following Peer Sets
Then right-click on the FR_Download Peer Set in the sidebar and set its download rate limit to 'Disabled'
A further example to limit the maximum upload rate to any peer to 250KB/sec
Similarly you could create Peer Sets to control torrents so that download occurs from one network and upload only occurs to another.
There is been experimental support for prioritising upload (or download) across both tags and peer sets. The syntax for this is
priority_(up|down) <id>=<tag_name|peer_set_name> [,<id>=<tag_name|peer_set_name>]+ [,freq=<secs>] [,max=<limit>] [,min=<limit>] [,probe=<cycles>] [,rest=<cycles>]
Tags/peer sets are listed in descending priority order - it is suggested that for the "id" values you use 1, 2, 3 etc, but anything can be used. The 'freq' value, if supplied, indicates how often the priority assignments should be examined. Default is 5 seconds. The 'max' can be specified as an indicator of the maximum upload rate expected and the 'min' controls the minimum rates that will be applied. The 'probe' parameter controls when all limits should be raised to 'max' to assess total network capacity (the default is 0 and means probing is disabled). Its value corresponds to 'cycles' of the prioritization algorithm. The 'rest' parameter controls how long the algorithm will rest between cycles.
For 'upload priority' it is most likely that you will want to apply this to complete downloads only (otherwise it may interfere with the download process). If the original Tag is called A then create a separate tag with constraint
hasTag( "A" ) && isComplete()
and use this tag for upload priority.
I would like BiglyBT to download at 400kB/s and upload at 40kB/s from 08:00 to 20:00 then Stop from 20:00 to 24:00 then full speed from 00:00 to 08:00.
- Firstly you will need to create a 'profile' to represent the application of specific global transfer limits. You do this be setting the limits in BiglyBT (right-click on the up/down speeds in the status bar for example to set the global up/down limits) and then go to Tools->Speed Limits->Save Current As... and enter a name for this. Let's call it 'limited'
- Now create a second profile for the unlimited case - remove up/down limits in BiglyBT and go through the menu again to save this - call it 'unlimited'
- Lastly create the schedule to apply these limits. Go to Tools->Speed Limits->Schedule and Settings... and add the following after the comment section:
enable=yes daily limited from 08:00 to 20:00 daily pause_all from 20:00 to 24:00 daily unlimited from 00:00 to 08:00
I want to have a schedule that applies general download limits. However, occasionally I have 'priority' downloads that I want to ignore any limits and get unlimited download speed.
The global upload/download limits in BiglyBT are enforced across all downloads so for this scenario these can't be used. A solution is to use Tags to enforce the limits and ensure that only the priority torrents are added to a Tag that has no limit enforcement, with the rest being assigned to a Tag that does enforce the limits.
This is most straight forward if you are not already using tags for your downloads as you can simply use the 'Untagged' Tag to manage speed limits.
First create a tag that you will use for priority downloads. One way to do this is to right-click on the 'MY TORRENTS' heading in the sidebar and select Tags->Add Tag... - call it Priority (for example).
Next enable the 'Untagged' Tag by right-clicking on the 'Priority' tag you created and selecting 'Show/Hide Tag(s)->Untagged. Downloads are automatically assigned to this when they have no other tags assigned. So in this case all downloads that aren't tagged as Priority downloads will be automatically tagged as Untagged.
Now you need to set up your schedule to be based on the 'Untagged' tag speed settings. For each different speed requirement you will need to create a profile. For this example, let's say you want have a 100 kB/sec download limit from 08:00 to 18:00 and 200 kB/sec download limit outside of this. First make sure you have no other speed limits applied (clear global up/down limits and anything else - you can see the current limits via Tools->Speed Limits->View Current). Now assign the first limit (100 kB/sec) to the Untagged tag (right-click on it and select 'set download speed'). Next save this setting as a profile (Tools->Speed Limits->Save Current As...), call it 'limit1' (for example). Now change the limit on the Untagged tag to 200 kB/sec and save again, say 'limit2'.
Next set up your schedule to apply these limits:
enable=yes daily limit1 from 08:00 to 18:00 daily limit2 from 18:00 to 08:00
Now, when you want to prioritize a download, drag it to the 'Priority' tag.
If you are already using tags then it is more complex to arrange for the non-priority downloads to be assigned to a tag that enforces the limits - you can use Tag Constraints to create a tag that contains everything not tagged as Priority by using a constraint of
!hasTag( "Priority" )
I have unlimited upload capacity but want to need to prevent all downloading between 8am and 10pm
To maximize your upload you will probably want to keep uploading for incomplete torrents during this period (this is also good for your overall share ratio as, assuming you have downloaded at least a bit of your downloads, you can upload for them un-interrupted during this period rather than stopping them)
You can specify upload/download Tag rate limits as 'disabled'. This prevents all data flow but still permits protocol flow which is essential for maintaining peer connections.
Create a Tag that is automatically assigned all torrents - use Tag Constraints with
as the constraint. Then you can set the tag download limit as 'disabled', create a profile, and schedule the profile as usual to be active between 8am and 10pm
If you are seeding a number of torrents and are hitting your upload limits you might want to prioritize your upload bandwidth to certain torrents. In this example we assume that your prioritization is based on the torrent's trackers. The approach is to use tags to group downloads by tracker and then use the upload-prioritizer to manage bandwidth.
Use Tag Properties to group by tracker - let's say there are 3 priority levels you want and call them 'HiPriority', 'MediumPriority' and 'LowPriority'. Note that if you want LowPriority to contain everything not in the others then you could use a 'tag constraint' with value
!(hasTag("HiPriority")||hasTag("MediumPriority")) rather than a tracker property.
You would then add a line to the schedule to declare the priorities:
enable=yes priority_up 1=HiPriority,2=MediumPriority,3=LowPriority