Repository navigation
[PR] perf(storage): use a point lookup for session removal - #6615
Merged
ranxianglei merged 1 commit intoNov 14, 2026
Merged
Conversation
Owner
|
Superseded by #6677 (merged as Landed into master via the real merge commit The fix for #6613 is now in master. Closing this PR as superseded — thanks for the careful, well-tested fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6613.
Deleting one session currently materializes the whole session catalog to obtain that session's protocol and origin. The catalog query also calculates two block aggregates and parses statistics JSON for every session. Repeating the maintenance operation repeats that unrelated work.
Read the two identity columns directly through the existing
sessions.session_idkey. The shadow wrapper retains itsnullresult on an async-only backend. The existing error fallback, envelope metadata precedence, row-existence check, cascade/CAS deletion and session-file discovery stay in their original order.Measured effect
Seven alternating fresh-process pairs per workload on Node 24.22.1, using the real SQLite store and complete sequential
SessionStore.removeSessionoperations. Each process starts from a copy of the same seeded database and performs one separate warmup deletion. Setup, database open, output verification and teardown are outside the timer.All seven large-catalog pairs improve (9.59–18.59x). The small control is mixed and its median is slower; no small-store benefit or general request-latency improvement is claimed. These fixtures use DB-only sessions with two stored messages each and no compression blocks. Legacy-file search, cascades and CAS refcount release are included in the measured operation.
Every baseline/candidate process has the same input-file hash and resulting logical hash over all database tables for its workload. The large workload leaves exactly 4,899 sessions and 9,798 messages/content rows after the warmup plus measured deletions. The benchmark driver is included:
Run the second command against both revisions with the same fixture directory. Use a new empty directory when seeding a fixture.
Validation
git diff --checkpass.Scope
No configuration, persistence format/version, wire behavior or kernel changes. No new network-backend behavior: this synchronous lookup previously returned no catalog rows for async-only backends and still degrades to the existing file path. Current-head remote CI remains a separate check after publication.