Repository navigation
perf(session): reuse scoped reads within journal scans - #3673
Draft
chengqiangrd wants to merge 1 commit into
Draft
chengqiangrd wants to merge 1 commit into
chengqiangrd wants to merge 1 commit into
Conversation
chengqiangrd
force-pushed
the
perf/session-scan-commit-cache
branch
from
October 21, 2026 03:09
4bbba92 to
9bd0e43
Compare
This was referenced Oct 28, 2026
chengqiangrd
force-pushed
the
perf/session-scan-commit-cache
branch
from
October 29, 2026 06:24
9bd0e43 to
36fc451
Compare
This branch has not been deployed
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.
AgentScope-Java Version
2.1.0-SNAPSHOT (PR base:
mainat997c60ac; change commit:9bd0e43f)Description
Refs #3647
This revision avoids opening a fresh SQLite connection for every journal commit read without loading every row under a session prefix. It adds a synchronous, callback-scoped
AtomicSessionStorage.withReadSessionAPI with a backward-compatible default, then forwards that scope throughLocalSessionStorage. The Windows SQLite backend reuses one connection and prepared statement whileJournalSessionLog.scanfollows the captured head's actual parent chain.The reader is thread-confined and cannot be used after the callback returns. It intentionally does not promise snapshot isolation: each SQLite
SELECTremains independently visible, so a concurrent writer is not held behind a long read transaction. Journal commits are immutable once linked, and the scan still validates chain continuity before returning its resource-freeIterable.Compared with the current #3666 implementation, this does not list a prefix or build a map containing all commit payloads. Unreachable/orphan rows are not loaded. Up to 1 MiB of reachable raw commit JSON is retained for repeated iteration; overflow commits use the existing read path. This is not a total JVM memory limit: commit IDs, one materialized oversized row, deserialized events, and SQLite/JDBC buffers remain outside the budget. A single oversized row therefore still has to fit in memory.
Checksum validation remains enabled, and external payload blobs are still loaded and hash-checked on every iteration. The tests cover the default backend fallback, callback failure cleanup, escaped and cross-thread readers, exact/overflow cache boundaries, repeated and concurrent iteration, orphan rows, corrupt reachable commits, Windows file-handle release, and a concurrent SQLite writer.
Verification
clean verifypassed on both Java 17 / Ubuntu and Java 17 / Windows.LocalFilesystem→LocalSessionStorage→ SQLite), 17 sessions × 6 commits, five fresh-process runs: median projection time was 1088 ms onmainand 400 ms with this change. This is a local fixture, not a general performance guarantee.verifyreached Javadoc packaging but could not resolve several old Javadoc-plugin dependencies from the task-local Maven repositories. PR CI intentionally skips release-only Javadoc/source jars and passed on both platforms.Checklist
mvn spotless:checkmvn test) — full GitHub CI passed on Windows and Ubuntu