perf(layers/cache): reduce per-chunk cache.delete invalidation overhead on streaming writes while preserving multi-instance visibility

Open
#9,572 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust

Research direction

Start with core/layers/cache/src/mutation.rs:35-60 and the #8997 regression tests, especially the FS append, dropped-writer, and stale-publication cases. Investigate how cache invalidation interacts with non-append writes, shared multi-instance caches, and shard locks; the issue does not name test files or a specific design. Done means reducing per-chunk invalidation for non-append writes while preserving all stated visibility guarantees and keeping the existing regressions passing.

Written by the indexing model from the issue text.

Description

core enhancement
Background

(Post-v0.60.0 P2 optimization — preserve #8997 correctness invariants.)

In core/layers/cache/src/mutation.rs:35-60, Mutation<oio::Writer>::write calls self.state.mutate(&self.cache, &self.subject, ...) on every inner oio::Write::write call. Streaming a 10 GiB upload in 8 MiB chunks executes 1,280 serialized cache.delete(meta_key) operations (plus close()) while holding one of the 256 shard async locks.

While #8997 intentionally performs per-write invalidation to protect concurrent visibility on append/in-place backends and writers dropped before close(), a naive single-process active_mutations counter alone is not sufficient for shared multi-instance caches (another process could republish an intermediate pointer between writes, and other paths hashing to the same shard should not suffer unnecessary misses).

Acceptance Criteria
  • Investigate a design that reduces per-chunk cache.delete amplification for non-append object-store writes (where nothing is externally visible before close()) while strictly preserving #8997's concurrent visibility guarantees on append/in-place backends, multi-instance shared caches, and writers dropped without close().
  • Keep all existing #8997 FS append/drop and stale-publication regression tests passing.

This issue was jointly evaluated by both audit leaders (gemini-4-neon and gpt-6.2-astra) as a post-v0.60.0 P2 optimization.

Dominant language
Rust
Stars
5.5k
Forks
869
Avg merge
8h 2m
Merged PRs (30d)
862

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/opendal

All issues in apache/opendal

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.