Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

maple start --in-memory: generate chDB settings that suit a throwaway store

Đang mở Phù hợp với người mới
#1,888 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
74/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
clickhouse, typescript
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu tại apps/cli/src/commands/server.ts#L1535-L1538, nơi nhánh in-memory bỏ qua bước tạo cấu hình, và đọc resolveChdbConfigFile ở dòng L689-L705 làm mẫu để làm theo. Thêm một đường dẫn in-memory ghi một tệp cấu hình được tạo ra cạnh store, với bốn giá trị <merge_tree> trong bảng, và giữ nguyên --chdb-config-file do người dùng cung cấp. Hoàn thành khi maple start --in-memory tạo ra tệp đó và các thiết lập hiển thị là đã thay đổi trong system.merge_tree_settings; chạy các bài kiểm thử hiện có của lệnh server CLI để xác nhận chế độ data-dir không bị ảnh hưởng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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 in system.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).

Ngôn ngữ chính
TypeScript
Star
1.8k
Fork
120
Merge trung bình
8 giờ 34 phút
Pull request đã merge (30 ngày)
687

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của MapleTechLabs/maple

Tất cả issue của MapleTechLabs/maple

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.