Commit 2cc37e5
committed
metadata: set NoFreelistSync on bolt databases to avoid write amplification
bbolt rewrites the entire freelist on every transaction commit. Once a
metadata database accumulates many free pages (for example after GC frees
most of a large database), each small metadata write amplifies into a
multi-MB disk write. With a high commit rate this can saturate disk write
bandwidth and, because every commit holds bbolt's single writer lock while
fsyncing, stall otherwise-cheap build operations.
Set NoFreelistSync on the bolt databases that buildkit opens itself
(containerdmeta.db, metadata_v2.db and cache.db). The freelist is not data;
it is reconstructed by scanning the database on open, so durability is
unaffected. containerd applies the same option to its own metadata database
for the same reason: containerd/containerd#6761
Signed-off-by: ZRHann <zrhann@foxmail.com>1 parent e7b395c commit 2cc37e5
3 files changed
Lines changed: 15 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
99 | 106 | | |
100 | 107 | | |
101 | 108 | | |
| |||
0 commit comments