Skip to content

revocation: add LoadedStore for checks without disk I/O - #279

Open
xonatius wants to merge 1 commit into
rustls:mainfrom
xonatius:loaded-store
Open

xonatius wants to merge 1 commit into
rustls:mainfrom
xonatius:loaded-store

Conversation

@xonatius

@xonatius xonatius commented Nov 4, 2026

Copy link
Copy Markdown

Store::check opens the index and reads and decodes every covering filter on each call, which is nearly all of its ~7.5 ms. Store::load reads the index and all its filters once; LoadedStore::check then answers from memory in a few microseconds, and is_stale tells a long-running process when a fetch has replaced the index.

Both paths run the same traversal: Index now abstracts where its entry sections come from (seeking the file, or the file held in memory) and where filters come from, so verdicts cannot drift between them.

Loading tolerates a concurrent fetch per the C2SP reader rule: a filter the index names but the disk lacks means the index was replaced, so the load starts over with the new one.

`Store::check` opens the index and reads and decodes every covering
filter on each call, which is nearly all of its ~7.5 ms. `Store::load`
reads the index and all its filters once; `LoadedStore::check` then
answers from memory in a few microseconds, and `is_stale` tells a
long-running process when a fetch has replaced the index.

Both paths run the same traversal: `Index` now abstracts where its
entry sections come from (seeking the file, or the file held in memory)
and where filters come from, so verdicts cannot drift between them.

Loading tolerates a concurrent fetch per the C2SP reader rule: a filter
the index names but the disk lacks means the index was replaced, so
the load starts over with the new one.
@codspeed

codspeed Bot commented Nov 4, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 3 untouched benchmarks
🆕 2 new benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 revocation-check-loaded N/A 53.7 µs N/A
🆕 revocation-load N/A 186.9 ms N/A

Comparing xonatius:loaded-store (6e5cf22) with main (4ed3321)

Open in CodSpeed

@djc

djc commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

I think it makes sense to do something like this. In my mind, this would happen internal to the Store, having it store a private enum (maybe StoreKind) with a variant that holds all the required data. I think we should probably make reloading on a changed index.bin implicit, unless you have a different design for that in mind?

If we're going to review this, I think it needs to be broken up into some smaller commits.

@xonatius

xonatius commented Nov 6, 2026

Copy link
Copy Markdown
Author

Thanks for taking a look!

In my mind, this would happen internal to the Store, having it store a private enum (maybe StoreKind) with a variant that holds all the required data

Makes sense, will change!

I think we should probably make reloading on a changed index.bin implicit, unless you have a different design for that in mind?

Not sure on this one - reloading requires a FS check (either to load new content or to do mtime check, etc) which I don't think the call to check should be paying. In my mind this is something that should be left up to a consumer to decide on when it wants to check freshness and reload.

If we're going to review this, I think it needs to be broken up into some smaller commits.

I can split. I assume 1 commit = 1 pr?

@djc

djc commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Not sure on this one - reloading requires a FS check (either to load new content or to do mtime check, etc) which I don't think the call to check should be paying. In my mind this is something that should be left up to a consumer to decide on when it wants to check freshness and reload.

In order to be misuse-resistant, I think we should probably at least check freshness and reflect it in the return type (adding a check() alternative). What would your downstream strategy be for deciding when/how to refresh?

If we're going to review this, I think it needs to be broken up into some smaller commits.

I can split. I assume 1 commit = 1 pr?

I think we'd prefer multiple commits working towards a single goal being in a single PR together (but no fixup commits etc, see CONTRIBUTING.md).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants