Skip to content

Commit ee695e6

Browse files
Merge pull request #1 from beam-cloud/codex/geesefs-fuse-tuning
Tune FUSE init limits for geesefs
2 parents 7a12c25 + 8cb1c36 commit ee695e6

5 files changed

Lines changed: 36 additions & 10 deletions

File tree

connection.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ var contextKey interface{} = contextKeyType(0)
5656
// Reading a page at a time is a drag. Ask for a larger size.
5757
const maxReadahead = 1 << 20
5858

59+
const (
60+
defaultMaxBackground = 128
61+
defaultCongestionThreshold = 96
62+
)
63+
5964
// Connection represents a connection to the fuse kernel process. It is used to
6065
// receive and reply to requests from the kernel.
6166
type Connection struct {
@@ -159,6 +164,17 @@ func (c *Connection) Init() error {
159164
initOp.Library = c.protocol
160165
initOp.MaxReadahead = maxReadahead
161166
initOp.MaxWrite = buffer.MaxWriteSize
167+
initOp.MaxBackground = c.cfg.MaxBackground
168+
if initOp.MaxBackground == 0 {
169+
initOp.MaxBackground = defaultMaxBackground
170+
}
171+
initOp.CongestionThreshold = c.cfg.CongestionThreshold
172+
if initOp.CongestionThreshold == 0 {
173+
initOp.CongestionThreshold = defaultCongestionThreshold
174+
if initOp.CongestionThreshold >= initOp.MaxBackground {
175+
initOp.CongestionThreshold = initOp.MaxBackground * 3 / 4
176+
}
177+
}
162178

163179
initOp.Flags = 0
164180

conversions.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,9 +1061,8 @@ func (c *Connection) kernelResponseForOp(
10611061
out.Minor = o.Library.Minor
10621062
out.MaxReadahead = o.MaxReadahead
10631063
out.Flags = uint32(o.Flags)
1064-
// Default values
1065-
out.MaxBackground = 12
1066-
out.CongestionThreshold = 9
1064+
out.MaxBackground = o.MaxBackground
1065+
out.CongestionThreshold = o.CongestionThreshold
10671066
out.MaxWrite = o.MaxWrite
10681067
out.TimeGran = 1
10691068
out.MaxPages = o.MaxPages

internal/buffer/in_message_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ package buffer
1616

1717
// The maximum fuse write request size that InMessage can acommodate.
1818
//
19-
// As of kernel 4.20 Linux accepts writes up to 256 pages or 1MiB
20-
const MaxWriteSize = 1 << 17
19+
// As of kernel 4.20 Linux accepts writes up to 256 pages or 1MiB.
20+
const MaxWriteSize = 1 << 20

mount_config.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@ type MountConfig struct {
169169
// being read from the file as a list of slices in ReadFileOp.Data.
170170
UseVectoredRead bool
171171

172+
// Linux only. Controls the maximum number of outstanding FUSE requests the
173+
// kernel may queue before applying backpressure. If zero, the library uses a
174+
// high-throughput default.
175+
MaxBackground uint16
176+
177+
// Linux only. Controls the number of outstanding FUSE requests at which the
178+
// kernel considers the connection congested. If zero, the library derives a
179+
// value from MaxBackground.
180+
CongestionThreshold uint16
181+
172182
// OS X only.
173183
//
174184
// The name of the mounted volume, as displayed in the Finder. If empty, a

ops.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ type initOp struct {
4040
Flags fusekernel.InitFlags
4141

4242
// Out
43-
Library fusekernel.Protocol
44-
MaxReadahead uint32
45-
MaxBackground uint16
46-
MaxWrite uint32
47-
MaxPages uint16
43+
Library fusekernel.Protocol
44+
MaxReadahead uint32
45+
MaxBackground uint16
46+
CongestionThreshold uint16
47+
MaxWrite uint32
48+
MaxPages uint16
4849
}

0 commit comments

Comments
 (0)