Repository navigation
Conversation
StoreSessionStorage did not override AtomicSessionStorage.readAll, so JournalSessionLog.scan fell back to one BaseStore.get per commit segment on remote JDBC/Redis/Mongo stores. Add an opt-in BulkReadableStore capability with getAll implementations for in-memory, JDBC, MySQL, PostgreSQL, MongoDB and Redis stores, and use it from StoreSessionStorage. StoreSessionStorage reads a single path directly, uses getAll for multiple paths when supported, and otherwise keeps the paged search fallback with missing-path reads and per-key fallback when search is unsupported. Preserve read semantics and leave BaseStore source-compatible. Refs agentscope-ai#3995
chcodex
force-pushed
the
perf/store-session-batch-read
branch
from
November 5, 2026 13:10
28fb2cb to
9712712
Compare
This was referenced Nov 7, 2026
chcodex
marked this pull request as draft
November 10, 2026 02:26
This was referenced Nov 10, 2026
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
Description
JournalSessionLog.scanbulk-loads committed segments throughAtomicSessionStorage.readAll(added in #3666).StoreSessionStorage, used by remote workspace stores such as JDBC/MySQL, Redis and MongoDB, did not overridereadAll, so it fell back to the default implementation and issued oneBaseStore.getper commit segment. A journal with 2,658 segments therefore performed 2,658JdbcStore.getcalls; on remote MySQL that takes tens of seconds.This PR adds an opt-in bulk-read capability to
BaseStoreand uses it fromStoreSessionStorage, so replay costs a bounded number of store queries for supporting backends.Closes #3995
Changes
BulkReadableStore extends BaseStorecapability interface declaringgetAll(namespace, keys).BaseStoreitself stays source-compatible; existing implementations compile and keep working unchanged.getAllimplementations:InMemoryStore— direct compound-key lookup.JdbcStore,PostgresBaseStore— oneIN (...)query per 256-key chunk, reusing one connection across chunks.MongoBaseStore—_id $inper 256-key chunk.RedisStore— bounded 256-keyHGETALLpipelines with explicit sync.StoreSessionStorage.readAll:get;store instanceof BulkReadableStore→ onegetAllcall;searchfallback, continuing past short pages, reading still-missing paths individually, and falling back to per-key reads whensearchis unsupported.RedisStore.searchnow also uses boundedHGETALLpipelines per page, solistPathsavoids one round-trip per key.ControlPlaneBaseStore,CosBaseStore,OssBaseStoreand the codingagentSqliteBaseStoreremain plainBaseStoreimplementations and use the search fallback.Semantics
version < 1still throwsSessionLogException.byte[].AtomicSessionStorageinterface semantics and event formats are unchanged.Tests
StoreSessionStorageTestcovers parity with per-pathread, bulk reads, single-path reads, paged-search fallback, unsupported-search fallback, missing paths, duplicate paths, versions and unversioned objects.BaseStoreContractTest,JdbcStoreH2Test,PostgresBaseStoreTest,MongoBaseStoreTest, newRedisStoreTestand new MySQLJdbcStoreTestcover the backend implementations.Both pass, including
spotless:check.Performance
With a fake store adding 1 ms latency per call and 2,658 requested paths:
getcalls, ~2,957 msgetAll: 0getcalls, 11search/batch pages, ~44 msThis is a simulated latency comparison, not a MySQL measurement; real gains depend on RTT and on how many non-requested objects the session namespace contains.
Checklist
mvn spotless:applymvn testfor the affected modules)Merge order
StoreDialect/JdbcStore/BaseStorefiles and rebases onto this PR (onlyJdbcStoreH2Testconflicts today).Scope note: this PR only accelerates the
readAllbulk path (used by full replay whenafter == 0). Incremental per-segment read acceleration is handled separately by #4051'slistKeysand #4039's single-scan path.