Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

mount: expose -fuse.maxBackground and -fuse.congestionThreshold flags (closes #9258) (#9268)

Chris Lu735e94f6ba32
diff --git a/go.mod b/go.mod
index 025633139e..78c1e442ed 100644
--- a/go.mod
+++ b/go.mod
@@ -148,7 +148,7 @@ require (
github.com/rdleal/intervalst v1.5.0
github.com/redis/go-redis/v9 v9.18.0
github.com/schollz/progressbar/v3 v3.19.0
- github.com/seaweedfs/go-fuse/v2 v2.9.2
+ github.com/seaweedfs/go-fuse/v2 v2.9.3
github.com/shirou/gopsutil/v4 v4.26.2
github.com/tarantool/go-tarantool/v2 v2.4.2
github.com/testcontainers/testcontainers-go v0.40.0
diff --git a/go.sum b/go.sum
index e26d805fc8..e7fbdab87f 100644
--- a/go.sum
+++ b/go.sum
@@ -1842,6 +1842,8 @@ github.com/seaweedfs/cockroachdb-parser v0.0.0-20260225204133-2f342c5ea564 h1:Tg
github.com/seaweedfs/cockroachdb-parser v0.0.0-20260225204133-2f342c5ea564/go.mod h1:JSKCh6uCHBz91lQYFYHCyTrSVIPge4SUFVn28iwMNB0=
github.com/seaweedfs/go-fuse/v2 v2.9.2 h1:IfP/yFjLGO4rALcJY2Gb39PlebHxLnj7dkIiQAjFres=
github.com/seaweedfs/go-fuse/v2 v2.9.2/go.mod h1:zABdmWEa6A0bwaBeEOBUeUkGIZlxUhcdv+V1Dcc/U/I=
+github.com/seaweedfs/go-fuse/v2 v2.9.3 h1:rJufGrHImTx7yoGUmetUi+To4LrmTQJROJnBHWt92ic=
+github.com/seaweedfs/go-fuse/v2 v2.9.3/go.mod h1:zABdmWEa6A0bwaBeEOBUeUkGIZlxUhcdv+V1Dcc/U/I=
github.com/seaweedfs/goexif v1.0.3 h1:ve/OjI7dxPW8X9YQsv3JuVMaxEyF9Rvfd04ouL+Bz30=
github.com/seaweedfs/goexif v1.0.3/go.mod h1:Oni780Z236sXpIQzk1XoJlTwqrJ02smEin9zQeff7Fk=
github.com/seaweedfs/raft v1.1.7 h1:3mVJZ2p4rdvBtbbrHROPjYKtH+q5qjMBc56G6VRu1kA=
diff --git a/weed/command/mount.go b/weed/command/mount.go
index 1e7c926a3f..d23cdfc1b2 100644
--- a/weed/command/mount.go
+++ b/weed/command/mount.go
@@ -68,9 +68,11 @@ type MountOptions struct {
posixDirNlink *bool
// FUSE performance options
- writebackCache *bool
- asyncDio *bool
- cacheSymlink *bool
+ writebackCache *bool
+ asyncDio *bool
+ cacheSymlink *bool
+ fuseMaxBackground *int
+ fuseCongestionThreshold *int
// macOS-specific FUSE options
novncache *bool
@@ -159,6 +161,8 @@ func init() {
mountOptions.writebackCache = cmdMount.Flag.Bool("writebackCache", false, "enable FUSE writeback cache for improved write performance (at risk of data loss on crash)")
mountOptions.asyncDio = cmdMount.Flag.Bool("asyncDio", false, "enable async direct I/O for better concurrency")
mountOptions.cacheSymlink = cmdMount.Flag.Bool("cacheSymlink", false, "enable symlink caching to reduce metadata lookups")
+ mountOptions.fuseMaxBackground = cmdMount.Flag.Int("fuse.maxBackground", 128, "FUSE max_background: maximum in-flight asynchronous requests the kernel will queue. Heavy upload workloads may benefit from higher values (e.g. 2048). Equivalent to writing /sys/fs/fuse/connections/<id>/max_background. If -fuse.congestionThreshold is 0, the kernel derives it as 3/4 of this value.")
+ mountOptions.fuseCongestionThreshold = cmdMount.Flag.Int("fuse.congestionThreshold", 0, "FUSE congestion_threshold: in-flight async request count at which the kernel marks the FUSE bdi as congested and throttles new submissions. 0 means use the default (3/4 of -fuse.maxBackground). Equivalent to writing /sys/fs/fuse/connections/<id>/congestion_threshold. The kernel silently clamps this to -fuse.maxBackground when set higher.")
// macOS-specific FUSE options
mountOptions.novncache = cmdMount.Flag.Bool("sys.novncache", false, "(macOS only) disable vnode name caching to avoid stale data")
diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go
index 35bbe36dff..f74964acda 100644
--- a/weed/command/mount_std.go
+++ b/weed/command/mount_std.go
@@ -242,11 +242,21 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
fsName = "fuse"
}
+ maxBackground := 128
+ if option.fuseMaxBackground != nil && *option.fuseMaxBackground > 0 {
+ maxBackground = *option.fuseMaxBackground
+ }
+ congestionThreshold := 0
+ if option.fuseCongestionThreshold != nil && *option.fuseCongestionThreshold > 0 {
+ congestionThreshold = *option.fuseCongestionThreshold
+ }
+
// mount fuse
fuseMountOptions := &fuse.MountOptions{
AllowOther: *option.allowOthers,
Options: option.extraOptions,
- MaxBackground: 128,
+ MaxBackground: maxBackground,
+ CongestionThreshold: congestionThreshold,
MaxWrite: 1024 * 1024 * 2,
MaxReadAhead: 1024 * 1024 * 2,
IgnoreSecurityLabels: false,