From 88c307b65be76690e317b5442a6ba0721a98cfbc Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Sat, 28 Jun 2025 08:59:50 +0000 Subject: [PATCH] chore(config): increase max concurrent writes default (#10200) I lately wanted some photos on my phone, and watched them sync excrutiatingly slowly. I am used to android being slow, but not that slow. This restriction caught my eye and I increased it beyond the limit (didn't spot it at first), and I did see a clear improvement. Of course as always with such a one-off test, I might also have hallucinated it, but it seems plausible with the slow thing in android being some layer between the actual filesystem and apps. Also increase the max limit, mostly just because I don't see any reason to restrict it that low - not that I have a particular reason to want more. I also changed the xml default to 0: The `prepare` code will change it to the actual default - no need to change that anymore if we change the default in the future. --- lib/config/config.go | 2 +- lib/config/config_test.go | 2 +- lib/config/folderconfiguration.go | 6 +++--- lib/config/migrations.go | 13 +++++++++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/config/config.go b/lib/config/config.go index 08feb4aa1..45eff1600 100644 --- a/lib/config/config.go +++ b/lib/config/config.go @@ -31,7 +31,7 @@ import ( const ( OldestHandledVersion = 10 - CurrentVersion = 50 + CurrentVersion = 51 MaxRescanIntervalS = 365 * 24 * 60 * 60 ) diff --git a/lib/config/config_test.go b/lib/config/config_test.go index 1ae4404fa..71c0b5238 100644 --- a/lib/config/config_test.go +++ b/lib/config/config_test.go @@ -120,7 +120,7 @@ func TestDefaultValues(t *testing.T) { }, MaxConflicts: 10, MarkerName: ".stfolder", - MaxConcurrentWrites: 2, + MaxConcurrentWrites: maxConcurrentWritesDefault, XattrFilter: XattrFilter{ Entries: []XattrFilterEntry{}, MaxSingleEntrySize: 1024, diff --git a/lib/config/folderconfiguration.go b/lib/config/folderconfiguration.go index 1dee2085e..a6abedab5 100644 --- a/lib/config/folderconfiguration.go +++ b/lib/config/folderconfiguration.go @@ -36,8 +36,8 @@ var ( const ( DefaultMarkerName = ".stfolder" EncryptionTokenName = "syncthing-encryption_password_token" //nolint: gosec - maxConcurrentWritesDefault = 2 - maxConcurrentWritesLimit = 64 + maxConcurrentWritesDefault = 16 + maxConcurrentWritesLimit = 256 ) type FolderDeviceConfiguration struct { @@ -76,7 +76,7 @@ type FolderConfiguration struct { MarkerName string `json:"markerName" xml:"markerName"` CopyOwnershipFromParent bool `json:"copyOwnershipFromParent" xml:"copyOwnershipFromParent"` RawModTimeWindowS int `json:"modTimeWindowS" xml:"modTimeWindowS"` - MaxConcurrentWrites int `json:"maxConcurrentWrites" xml:"maxConcurrentWrites" default:"2"` + MaxConcurrentWrites int `json:"maxConcurrentWrites" xml:"maxConcurrentWrites" default:"0"` DisableFsync bool `json:"disableFsync" xml:"disableFsync"` BlockPullOrder BlockPullOrder `json:"blockPullOrder" xml:"blockPullOrder"` CopyRangeMethod CopyRangeMethod `json:"copyRangeMethod" xml:"copyRangeMethod" default:"standard"` diff --git a/lib/config/migrations.go b/lib/config/migrations.go index 532b3012c..99dadb6ed 100644 --- a/lib/config/migrations.go +++ b/lib/config/migrations.go @@ -28,6 +28,7 @@ import ( // put the newest on top for readability. var ( migrations = migrationSet{ + {51, migrateToConfigV51}, {50, migrateToConfigV50}, {37, migrateToConfigV37}, {36, migrateToConfigV36}, @@ -98,6 +99,18 @@ func (m migration) apply(cfg *Configuration) { cfg.Version = m.targetVersion } +func migrateToConfigV51(cfg *Configuration) { + oldDefault := 2 + for i, fcfg := range cfg.Folders { + if fcfg.MaxConcurrentWrites == oldDefault { + cfg.Folders[i].MaxConcurrentWrites = maxConcurrentWritesDefault + } + } + if cfg.Defaults.Folder.MaxConcurrentWrites == oldDefault { + cfg.Defaults.Folder.MaxConcurrentWrites = maxConcurrentWritesDefault + } +} + func migrateToConfigV50(cfg *Configuration) { // v50 is Syncthing 2.0 }