Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust/cache/src/foyer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ where
.with_name(config.name.clone())
.with_metrics_registry(otel_0_27_metrics)
.with_tracing_options(tracing_options.clone())
.with_policy(foyer::HybridCachePolicy::WriteOnInsertion)
.with_policy(foyer::HybridCachePolicy::WriteOnEviction)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommended

[Documentation] This change from WriteOnInsertion to WriteOnEviction is a good optimization for insert latency, as it defers disk writes until an item is evicted from the in-memory tier.

This introduces a trade-off: improved performance at the cost of durability. In the case of an unclean shutdown (e.g., a process crash), any data in the memory cache that hasn't been evicted will be lost. The previous WriteOnInsertion policy provided stronger durability against crashes.

This is a reasonable trade-off for a cache, but it's an important change in behavior. To ensure this is clear for future maintainers, could you add a brief note about this durability trade-off to the PR description?

Context for Agents
This change from `WriteOnInsertion` to `WriteOnEviction` is a good optimization for insert latency, as it defers disk writes until an item is evicted from the in-memory tier.

This introduces a trade-off: improved performance at the cost of durability. In the case of an unclean shutdown (e.g., a process crash), any data in the memory cache that hasn't been evicted will be lost. The previous `WriteOnInsertion` policy provided stronger durability against crashes.

This is a reasonable trade-off for a cache, but it's an important change in behavior. To ensure this is clear for future maintainers, could you add a brief note about this durability trade-off to the PR description?

File: rust/cache/src/foyer.rs
Line: 352

.memory(config.mem)
.with_shards(config.shards);

Expand Down
Loading