b2: reduce default chunk size to 16M and increase upload concurrency to 8

The 96M default chunk size dates from 2016 when 100,000,000 bytes was
the minimum part size B2 allowed. The minimum is now 5,000,000 bytes.

Measurements against B2 EU on a 1 Gbit/s link show that each part has
a fixed overhead of about a second regardless of size, so throughput
is governed by chunk size multiplied by upload concurrency rather than
by chunk size alone. 16M chunks with concurrency 8 upload a 1 GiB file
as fast as 96M chunks with concurrency 4 while using a third of the
memory per transfer, and retry much less data when a part fails.

This also means that files between --multi-thread-cutoff and the chunk
size are no longer uploaded as a single part large file, which B2
rejects with "large files must have at least 2 parts", unless the
cutoff is set below 16M.
This commit is contained in:
Nick Craig-Wood committed 2026-09-10 15:57:25 +01:00
1 parent 417ecce222
commit 07313554bf
2 files changed
+11 -5

No files matched your search

+8 -3
View File
@@ -64,7 +64,7 @@ const (
maxParts = 10000
maxVersions = 100 // maximum number of versions we search in --b2-versions mode
minChunkSize = 5 * fs.Mebi
defaultChunkSize = 96 * fs.Mebi
defaultChunkSize = 16 * fs.Mebi
defaultUploadCutoff = 200 * fs.Mebi
largeFileCopyCutoff = 4 * fs.Gibi // 5E9 is the max
defaultMaxAge = 24 * time.Hour
@@ -153,7 +153,12 @@ The minimum is 0 and the maximum is 4.6 GiB.`,
When uploading large files, chunk the file into this size.
Must fit in memory. These chunks are buffered in memory and there
might a maximum of "--transfers" chunks in progress at once.
might be a maximum of "--transfers" * "--b2-upload-concurrency"
chunks in progress at once.
B2 has a fixed per part overhead of about a second, so upload speed
is roughly proportional to the chunk size multiplied by
"--b2-upload-concurrency".
5,000,000 Bytes is the minimum size.`,
Default: defaultChunkSize,
@@ -168,7 +173,7 @@ concurrently.
Note that chunks are stored in memory and there may be up to
"--transfers" * "--b2-upload-concurrency" chunks stored at once
in memory.`,
Default: 4,
Default: 8,
Advanced: true,
}, {
Name: "disable_checksum",
+3 -2
View File
@@ -169,8 +169,9 @@ to load your computer, etc. The default of `--transfers 4` is
definitely too low for Backblaze B2 though.
Note that uploading big files (bigger than 200 MiB by default) will use
a 96 MiB RAM buffer by default. There can be at most `--transfers` of
these in use at any moment, so this sets the upper limit on the memory
`--b2-upload-concurrency` (8 by default) buffers of `--b2-chunk-size`
(16 MiB by default) each. There can be at most `--transfers` files
uploading at any moment, so this sets the upper limit on the memory
used.
### Versions