maple start --in-memory: generate chDB settings that suit a throwaway store
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 74/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- clickhouse, typescript
- 领域
- cli
调研方向
从 apps/cli/src/commands/server.ts#L1535-L1538 开始,这里的内存模式分支跳过了配置生成;参考 L689-L705 的 resolveChdbConfigFile 作为要效仿的模型。添加一条内存模式路径,在存储旁边写入生成的配置文件,其中包含表格中的四个 <merge_tree> 值,并保持用户提供的 --chdb-config-file 不被修改。完成标准是 maple start --in-memory 能生成该文件,并且 system.merge_tree_settings 中的设置显示为已更改;运行 CLI server 命令的现有测试,确认 data-dir 模式不受影响。
由索引模型根据 Issue 内容生成。
描述
Written by an AI agent (Claude) on behalf of @jasonkuhrt.
maple start --in-memory keeps one run's telemetry and deletes it on exit, but its chDB runs with chDB's defaults, which suit a long-lived store. Each OTLP export is a synchronous INSERT per datasource that fans out through the materialized views into 16 to 20 new parts, so even a small dev workload writes about 315 files per insert. To get settings that suit a throwaway store, each caller has to write a chDB config and pass it in:
maple start --in-memory --offline --chdb-config-file ./throwaway-store.chdb.xml
<!-- throwaway-store.chdb.xml -->
<clickhouse>
<merge_tree>
<min_bytes_for_wide_part>10737418240</min_bytes_for_wide_part>
<min_parts_to_merge_at_once>20</min_parts_to_merge_at_once>
<cleanup_delay_period>1</cleanup_delay_period>
<max_cleanup_delay_period>5</max_cleanup_delay_period>
</merge_tree>
</clickhouse>
Cause
Data-dir mode generates a chDB config (resolveChdbConfigFile, for checkpoints), while in-memory mode passes on only a user-supplied file (apps/cli/src/commands/server.ts#L1535-L1538):
const chdbConfigFile =
inMemory === undefined
? yield* resolveChdbConfigFile(dataDir, Option.getOrUndefined(a.chdbConfigFile))
: Option.getOrUndefined(a.chdbConfigFile)
Proposal
When --in-memory is set and no --chdb-config-file is given, generate a config beside the in-memory store holding the four <merge_tree> settings above, the way resolveChdbConfigFile generates one for data-dir mode. A user-supplied file stays untouched.
| Setting | Value | What it does for a throwaway store |
|---|---|---|
min_bytes_for_wide_part |
10 GiB (chDB default 10 MiB) | Parts stay compact, one data file for all columns. A merged wide traces part is about 200 files and is rewritten on nearly every merge; a new compact one is 29. |
min_parts_to_merge_at_once |
20 | A merge waits for 20 parts instead of rewriting on every insert. |
cleanup_delay_period / max_cleanup_delay_period |
1 s / 5 s (chDB default 30 s / 300 s) | Merged-away parts were over 90% of what sat on disk; they now go within seconds. |
Costs: up to about 20 active parts per partition per table, and compact parts read single columns more slowly. Neither shows at the size of one run's telemetry.
Measurements
A harness ran Maple v0.3.0's schema (local schema v41) on libchdb 26.7 directly, 15k rows preloaded, 5 rows inserted every 2 s, 150 s per variant, on an M-series Mac under heavy unrelated load. File counts were stable between repeats; CPU was noisy.
| Variant | Parts per insert | Files per insert | CPU-s per row |
|---|---|---|---|
| chDB defaults | 20.0 | 314 | 0.08 |
| chDB defaults, repeat | 20.1 | 316 | 0.11 |
| compact parts | 20.1 | 284 | 0.07 |
min_parts_to_merge_at_once 20 |
17.5 | 251 | 0.06 |
compact + min_parts_to_merge_at_once 20 |
17.6 | 246 | 0.07 |
| same + cleanup delay 1 s | 17.4 | 244 | 0.11 |
- Files per insert: 315 → 244, about 22% fewer.
- Files standing at the end of the run: 11,096 → 2,492 with the 1 s cleanup delay.
- The harness under-counts merges (0.19 merges per insert on
traces, against about 0.9 on a live store), so the compact-parts gain on a live store is likely larger. maple start --in-memory --chdb-config-file <file>on v0.2.0 shows all four overrides as changed insystem.merge_tree_settings.
We run Maple this way, with the file above, for every dev stack and every test.
Related: #1852 (per-export cost), #1764 (added --in-memory).
- 主要语言
- TypeScript
- 星标
- 1.8k
- 派生
- 120
- 平均合并
- 8 小时 11 分钟
- 30 天内合并 PR
- 667
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MapleTechLabs/maple 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
MapleTechLabs/maple#1921 ·
维护者通常 1 天内回复
-
Alerting: Linear as a destination type, opening one issue per incident可能已有人在做 @Makisuo 于 1 天前认领。 未关闭
难度 5/5 一周以上 新手友好度 20/100
MapleTechLabs/maple#1896 ·
维护者通常 1 天内回复
-
@maple-dev/alchemy: typed dashboard props, a managed refresh interval, and adopting a dashboard built in the UI可能已有人在做 @jasonkuhrt 于 2 天前认领。 未关闭
难度 5/5 一周以上 新手友好度 18/100
MapleTechLabs/maple#1891 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 42/100
MapleTechLabs/maple#1874 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 68/100
MapleTechLabs/maple#1873 ·
维护者通常 1 天内回复
查看 MapleTechLabs/maple 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
area:web p3
难度 2/5 1-3 小时 新手友好度 72/100
Lets-Parley/Parley#912 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
wealthfolio/wealthfolio#2376 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
be-BOP-io-SA/be-BOP#2817 ·
维护者通常 5 天内回复
-
documentation good first issue
难度 1/5 1-3 小时 新手友好度 84/100
sno-ai/sno-station#149 · 1 条评论 ·
维护者通常 1 天内回复