ankitects / ankitects/anki

Bump media syncing constants?

Open
#4,467 3 comments 2 reactions 0 assignees View on GitHub
ankiweb rust
Dominant language
Rust
Stars
30.5k
Forks
3.2k
Avg merge
2d 8h
Merged PRs (30d)
72

Description

> Is your feature request related to a problem? Please describe.
> I noticed media syncs between devices taking much longer than expected.
> My ~1.5 GB collection took >5 minutes to sync on my 100MB/s download connection, which felt much slower than necessary.
> Poking a bit into the rslib, it seems like we have these constants that limit bandwidth. The git log shows these values used to be higher ~10 years ago, got bump down in 2014 in this commit, and these values were carried over in the core re-write.
> Please correct me if I’m mistaken here.
> Describe the solution you’d like
> If possible, increase these values.
> // anki/rslib/src/sync/media/mod.rs
>
> ...
>
> pub static MAX_MEDIA_FILES_IN_ZIP: usize = 25;
>
> /// If reached, no further files are placed into the zip.
>
> pub static MEDIA_SYNC_TARGET_ZIP_BYTES: usize = (2.5 * 1024.0 * 1024.0) as usize;
>
> It’ll add some complexity, but it would also improve latency to send batches with multiple threads and process them concurrently. My current understanding is that this loop is sequential and could be parallelized.

Originally reported on https://forums.ankiweb.net/t/increase-performance-of-media-syncs/67794

Contributor guide

Open the contributing guide

Research direction

Start in anki/rslib/src/sync/media/mod.rs, inspect MAX_MEDIA_FILES_IN_ZIP and MEDIA_SYNC_TARGET_ZIP_BYTES, then trace the media-sync loop that builds and sends batches. Review the historical values and determine whether larger batches or concurrent processing are appropriate. Done means the chosen change is justified and media-sync latency is demonstrably improved without breaking batching behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.