FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

chore(model): improve block pull scheduler by calmh · Pull Request #10678 · syncthing/syncthing · GitHub

chore(model): improve block pull scheduler - #10678

Draft
calmh wants to merge 2 commits into
syncthing:mainfrom
calmh:jb/ratebased
Draft

chore(model): improve block pull scheduler#10678
calmh wants to merge 2 commits into
syncthing:mainfrom
calmh:jb/ratebased

Conversation

calmh commented May 4, 2026

Copy link
Copy Markdown
Member

The current scheduler is based only on the number of outstanding blocks towards each device. This will, in the long run and under most circumstances, result in using maximum throughput from each device. However, it means that when we start pulling (in each iteration) we'll distribute blocks equally regardless of device speed, and will keep requesting blocks from slower devices when we don't have to. E.g., if we need four blocks and have two devices, we will almost always schedule two blocks for each device, even if one device is 100 times faster to respond.

This change improves the selection:

  • remember the last ten block download times and calculate average download rate by device
  • track the amount of outstanding request bytes per device
  • for a new block request, select the device with the shortest queue (in seconds)

The current scheduler is based only on the number of outstanding blocks
towards each device. This will, in the long run and under most
circumstances, result in using maximum throughput from each device.
However, it means that when we start pulling (in each iteration) we'll
distribute blocks equally regardless of device speed, and will keep
requesting blocks from slower devices when we don't have to.

This change improves the selection:

- remember the last ten block download times and calculate average
  download rate by device
- track the amount of outstanding request bytes per device
- for a new block request, select the device with the shortest queue (in
  seconds)

Signed-off-by: Jakob Borg <jakob@kastelo.net>
github-actions Bot added the chore label May 4, 2026

Copy link
Copy Markdown
Contributor

Cool :-) Any chance the queue length and/or observed rates could be exposed somehow through app.Internals? (Or more generically, a way to use this logic when invoking RequestGlobal)?

As I described here there is similar logic in Synctrain, albeit with different goals (low latency and mostly sequential fetches, needs to be robust when connections are not).

Tangentially, it would be nice if RequestGlobal could be told to use a wholly separate connection (for existing connections the queue may be long, while for Synctrain on-demand files should ideally be prioritized).

Signed-off-by: Jakob Borg <jakob@kastelo.net>
Proof-of-Ineffective-Input pushed a commit to mindires/syncdesic that referenced this pull request Jul 24, 2026
…upstream research

- replace simple RTT selection with Adam momentum (beta1=0.7, beta2=0.9)
  for connection quality scoring (smoothed RTT + variance decay)
- add section 4: upstream PR research (syncthing#10678, syncthing#8918, syncthing#10516, sushitrain)
- add Adam paper reference to section 9
- update expected effects and implementation steps accordingly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL