Split crystal_thresh into crystal_thresh + fragment_thresh
So now crystal_thresh only controls when fragments are compacted into
blocks, while fragment_thresh controls when blocks are broken into
fragments. Setting fragment_thresh=-1 will follow crystal_thresh and
keeps the previous behavior.
These were already two separate pieces of logic, so it makes sense to
provide two separate knobs for tuning.
Setting fragment_thresh lower than crystal_thresh has some potential to
reduce hysteresis in cases where random writes push blocks close to
crystal_thresh. It will be interesting to explore this more when
benchmarking.
---
The additional config option adds a bit of code/ctx, but hopefully that
will go away in the future config rework:
code stack ctx
before: 35584 2480 636
after: 35600 (+0.0%) 2480 (+0.0%) 640 (+0.6%)
This commit is contained in:
@@ -446,12 +446,25 @@ struct lfs_config {
|
||||
lfs_size_t fragment_size;
|
||||
|
||||
// Threshold for compacting multiple fragments into a block. Smaller
|
||||
// values will compact more frequently, reducing disk usage, but
|
||||
// increasing the cost of random-writes.
|
||||
// values will compact more eagerly, reducing disk usage, but increasing
|
||||
// the cost of random-writes.
|
||||
//
|
||||
// 0 only writes blocks, minimizing disk usage, while -1 or any value >=
|
||||
// block_size only writes fragments, minimizing random-write cost.
|
||||
lfs_size_t crystal_thresh;
|
||||
|
||||
// Threshold for breaking a block into fragments. Smaller values will
|
||||
// break more lazily, reducing random-write cost, but risk leaving blocks
|
||||
// around with wasted storage.
|
||||
//
|
||||
// This can be set lower than crystal_thresh to prevent repeated
|
||||
// compact/break operations in files with heavy random writes, at a
|
||||
// storage cost. Setting this higher than crystal_thresh is probably not
|
||||
// a good idea.
|
||||
//
|
||||
// 0 will never fragment a block once compacted, while -1 will fragment
|
||||
// as soon as a block drops below crystal_thresh.
|
||||
lfs_size_t fragment_thresh;
|
||||
};
|
||||
|
||||
// File info structure
|
||||
|
||||
Reference in New Issue
Block a user