perf(db): dev 模式启用 SQLite WAL 提升本地写性能 - #2474
Open
suantea wants to merge 1 commit into
Open
Conversation
开发模式下 journal_mode 此前为 DELETE,每次写入事务都要 fsync, 本地运行(hermes-web-ui dev / 桌面运行时)写路径明显偏慢。 统一为与测试、生产一致的 WAL + synchronous=NORMAL + busy_timeout, 改善本地读写并发与写吞吐。 Co-Authored-By: AtomCode (deepseek-v4-flash) <noreply@atomgit.com>
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.
问题
开发模式下
packages/server/src/db/index.ts对 SQLite 使用PRAGMA journal_mode=DELETE,每次写入事务都要 fsync,本地运行(hermes-web-uidev / 桌面运行时)的写路径明显偏慢;测试与生产环境则已使用 WAL。改动
移除 dev 分支的特例,让开发模式与测试、生产保持一致:
PRAGMA journal_mode=WALPRAGMA synchronous=NORMALPRAGMA busy_timeout=5000PRAGMA foreign_keys=ON净改动:-2 行(删除
else if (isDev)分支)。验证
npx tsc -p packages/server/tsconfig.json --noEmit→ exit 0npx vitest run tests/server/db-index.test.ts→ 2/2 通过说明
按维护约束未改动
packages/ekko-agent(hermes 内核)。代码体检中发现的其余性能点(记忆召回的 js-tiktoken 同步编码缓存、queryNodes的LIKE '%term%'改用 FTS5MATCH、captureMessages批量事务)都在ekko-agent包内,本 PR 未包含,留作上游评估。