Skip to content

asyncreader: remove soft-start logic - #9284

Open
paf0186 wants to merge 1 commit into
rclone:masterfrom
paf0186:remove-soft-start
Open

paf0186 wants to merge 1 commit into
rclone:masterfrom
paf0186:remove-soft-start

Conversation

@paf0186

@paf0186 paf0186 commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor

The AsyncReader's soft-start began reads at 4KB and doubled each read until reaching the full 1MB buffer size. This added 9 undersized reads at the start of every transfer for no benefit:

  • The buffer is already allocated at full size from the pool, so slicing it smaller doesn't save memory.
  • The kernel handles small files naturally - read(fd, buf, 1MB) on a 3KB file just returns 3KB.
  • Each undersized read is a wasted syscall.

Remove it and always use the full buffer from the first read.

Fixes: #9282

What is the purpose of this change?

Remove unnecessary/strange IO soft-start reader logic.

The AsyncReader's soft-start began reads at 4KB and doubled each read until reaching the full 1MB buffer size. This added 9 undersized reads at the start of every transfer for no benefit:

  • The buffer is already allocated at full size from the pool, so slicing it smaller doesn't save memory.
  • The kernel handles small files naturally - read(fd, buf, 1MB) on a 3KB file just returns 3KB.
  • Each undersized read is a wasted syscall.

Remove it and always use the full buffer from the first read.

Was the change discussed in an issue or in the forum before?

#9282

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

The AsyncReader's soft-start began reads at 4KB and doubled
each read until reaching the full 1MB buffer size.  This
added 9 undersized reads at the start of every transfer for
no benefit:

- The buffer is already allocated at full size from the
  pool, so slicing it smaller doesn't save memory.
- The kernel handles small files naturally - read(fd, buf,
  1MB) on a 3KB file just returns 3KB.
- Each undersized read is a wasted syscall.

Remove it and always use the full buffer from the first read.

Fixes: rclone#9282

Signed-off-by: Patrick Farrell <[email protected]>
@paf0186

paf0186 commented Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

Note: this touches the same AsyncReader code as #9285 (configurable I/O block size). They're independent changes — whichever lands first, the other will need a trivial rebase.

@ncw

ncw commented Mar 25, 2026

Copy link
Copy Markdown
Member

The soft start logic is about latency, not throughput. It enables rclone to start delivering bytes quicker

Now whether it is still working or needed I don't know, but we need to benchmark the latency to see the effects. I usually do this by setting a --bwlimit . Somewhere I have some python scripts to measure the latency ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

local: remove soft-start logic from AsyncReader

2 participants