From 07313554bfc1a4647d01edac633cc9fff82155f2 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 10 Sep 2026 15:42:30 +0100 Subject: [PATCH] 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. --- backend/b2/b2.go | 11 ++++++++--- docs/content/b2.md | 5 +++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/backend/b2/b2.go b/backend/b2/b2.go index 22c5e079a..aea97dd28 100644 --- a/backend/b2/b2.go +++ b/backend/b2/b2.go @@ -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", diff --git a/docs/content/b2.md b/docs/content/b2.md index d6976e609..687ff9090 100644 --- a/docs/content/b2.md +++ b/docs/content/b2.md @@ -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