You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(daemon): mark all pieces verified when adding torrent in seed mode
libtorrent's seed_mode triggers a lazy async_hash on every piece the
first time a peer requests it (peer_connection.cpp 5298), to defend
against on-disk corruption between the time the torrent was created
and the time we start seeding.
For ezio's typical use case — partclone or similar generates the raw
image and the torrent in one step, then ezio seeds that exact image —
the source data is trusted by construction, and that lazy verify just
re-reads + re-hashes the whole 60+ GiB image as peers ask for pieces.
In 1-on-1 cold runs we measured ~48s of wall time (40% of elapsed)
spent on this verify pass; in 1-to-3 cold the cost is ~6s.
libtorrent provides a per-torrent knob for exactly this: filling
add_torrent_params::verified_pieces with all-true bits marks every
piece as already verified, so the lazy-verify branch in peer_connection
is skipped and async_read is reached directly.
Scope:
- Only takes effect when seeding_mode=true (the gRPC AddTorrent flag).
Leecher behaviour is unchanged — they still hash every downloaded
piece against the torrent's expected SHA1.
- No gRPC API change. Existing AddTorrent semantics remain the same;
callers that don't want this behaviour can simply not add the torrent
in seeding mode.
Expected gain:
- 1-on-1 cold: 122s -> ~74s (+65% throughput, matches warm-seeder)
- 1-to-3 cold: 172s -> ~165s (+3-4% throughput)
- multi-peer deployments (Clonezilla Lite-Server style) benefit most
on the seeder CPU side, less on wall clock.
Signed-off-by: Date Huang <tjjh89017@hotmail.com>