Add no_sync option to mount manager and erofs snapshotter bolt DBs#13143
Draft
djs55 wants to merge 1 commit intocontainerd:mainfrom
Draft
Add no_sync option to mount manager and erofs snapshotter bolt DBs#13143djs55 wants to merge 1 commit intocontainerd:mainfrom
djs55 wants to merge 1 commit intocontainerd:mainfrom
Conversation
The metadata plugin already exposes a no_sync option (PR containerd#10745) that disables F_FULLFSYNC on its bolt DB. This extends the same pattern to two more bolt databases: the mount manager (mounts.db) and the erofs snapshotter (metadata.db). On macOS, F_FULLFSYNC costs ~8ms per bolt transaction, particularly affecting nerdbox, see this benchmark (Apple M-series, bbolt v1.4.3): ``` mkdir /tmp/test cat > /tmp/test/main.go <<EOT package main import ( "fmt"; "os"; "path/filepath"; "time" bolt "go.etcd.io/bbolt" ) func bench(label string, noSync bool) { dir, _ := os.MkdirTemp("", "bolt-*") defer os.RemoveAll(dir) db, _ := bolt.Open(filepath.Join(dir, "t.db"), 0600, &bolt.Options{NoSync: noSync, NoGrowSync: noSync}) defer db.Close() db.Update(func(tx *bolt.Tx) error { _, e := tx.CreateBucket([]byte("b")); return e }) const N = 200 start := time.Now() for i := range N { db.Update(func(tx *bolt.Tx) error { return tx.Bucket([]byte("b")).Put([]byte(fmt.Sprintf("k%d", i)), []byte("v")) }) } d := time.Since(start) fmt.Printf("%-10s %d writes in %v (%.0f ops/s, %.2f ms/op)\n", label, N, d.Round(time.Millisecond), float64(N)/d.Seconds(), float64(d.Milliseconds())/float64(N)) } func main() { bench("sync:", false); bench("no_sync:", true) } EOT cd /tmp/test go mod init test go mod tidy go run main.go ``` Results: ``` sync: 200 writes in 1.605s (125 ops/s, 8.03 ms/op) no_sync: 200 writes in 3ms (74203 ops/s, 0.01 ms/op) ``` Configuration: ``` [plugins.'io.containerd.mount-manager.v1.bolt'] no_sync = true [plugins.'io.containerd.snapshotter.v1.erofs'] no_sync = true ``` Signed-off-by: David Scott <dave@recoil.org>
011c60f to
58bf47a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The metadata plugin already exposes a no_sync option (PR #10745) that disables F_FULLFSYNC on its bolt DB. This extends the same pattern to two more bolt databases: the mount manager (mounts.db) and the erofs snapshotter (metadata.db).
On macOS, F_FULLFSYNC costs ~8ms per bolt transaction, particularly affecting nerdbox, see this benchmark (Apple M-series, bbolt v1.4.3):
Results:
Configuration: