Skip to content
Advanced

Checking many pieces at once

A long recording is a chain of pieces, each a file that reads alone. A reader can verify one piece or hash one track's chunks in it without reading the others. So a large archive can check its pieces in parallel.

What runs at once

ww_tape_fs::check takes the paths of piece files and gives one result per path, in the order given.

  • verify_each runs TapeReader::verify on each piece, one piece at a time.
  • range_hash_each runs TapeReader::range_hash on each piece, one piece at a time.
  • verify_each_parallel and range_hash_each_parallel give the same results with the pieces spread over rayon's threads. They exist under the cargo feature parallel.

ww_tape itself keeps no thread pool and builds without the standard library. Only ww_tape_fs takes rayon.

Each piece is folded from the start of its track hash, so the results are each piece's own. They are not one hash of the whole chain. Chaining pieces into the chain's hash still folds every chunk in order, once.

What it gains

The bench archive_parallel writes three sets of piece files, each where its operation does real BLAKE3 work. A chain at Full is verified. A chain at CrcOnly is range-hashed: its index carries no unit hashes, so every chunk's payload is read and hashed. Unclosed pieces are resumed, which walks each piece from its start.

Every timed pass is preceded by reading each piece once, so both strategies run on warm pages. The two strategies run several times each, alternating which goes first. The tables give the shortest, median and longest run.

Strategy Shortest s Median s Longest s GB/s at the median Speedup at the median
20 pieces one at a time 3.26 3.66 28.52 2.93 1.00
20 pieces in parallel (rayon) 0.58 0.89 1.42 12.13 4.14

just bench-archive-parallel on build-1, load average 14.72 before, 14.72 after.

Strategy Shortest s Median s Longest s GB/s at the median Speedup at the median
12 pieces one at a time 2.65 2.89 3.11 2.23 1.00
12 pieces in parallel (rayon) 0.56 0.70 0.73 9.22 4.13

just bench-archive-parallel on build-1, load average 15.25 before, 15.25 after.

Strategy Shortest s Median s Longest s GB/s at the median Speedup at the median
12 pieces one at a time 4.36 4.73 7.96 1.02 1.00
12 pieces in parallel (rayon) 0.96 1.00 1.26 4.82 4.71

just bench-archive-parallel on build-1, load average 15.03 before, 15.03 after.

BLAKE3's own multithreaded hashing is a ceiling for hashing one piece, not a stand-in. A piece's content hash chains and substitutes chunk payloads. It is not one buffer to hand to update_rayon.

Set GiB Single-threaded update_rayon Ratio
verify_chain 10.00 2.29 5.09 2.23
range_chain 6.00 2.47 5.50 2.22
resume_pieces 4.50 2.25 4.88 2.17

just bench-archive-parallel on build-1, load average 15.03 before, 7.45 after.

Reading is bound by the storage too. A chain larger than memory is read cold, and its speedup is what the storage serves to several readers at once.

The bench ran on build-1, a virtual machine with 14 logical CPUs (AMD EPYC-Genoa Processor, x86_64) and 35 GiB of memory. It was a release build at opt-level 3 of commit 60db6275, built with the default jobs. The load average ran from 7.45 to 24.76 across the tables.