Reader: concurrent scan with a confined arena per worker thread
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 12/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- java
- 领域
- data, performance
调研方向
This is a design proposal, so the first step is deciding the open questions, not editing code. Read ScanIterator, Chunk and the existing confined-versus-shared arena handling, plus ADR 0003 for the exception contract on worker threads. Done means a recorded decision on shared versus per-worker mapping and ordered versus unordered delivery, then an A/B run with RealFileScanBenchmark.
由索引模型根据 Issue 内容生成。
描述
Parked design for a concurrent reader scan. Follow-up to #474 (writer side, shipped).
Reference behavior
- Rust (
vortex-layout/src/scan/scan_builder.rs): the scan is split into row-range tasks (SplitBy), each spawned onto the session runtime, up toconcurrency * num_workersin flight (default 4 per worker).ordered(default) uses.buffered(n), otherwise.buffer_unordered(n). A per-splitmapfunction runs on the spawned task. - .NET (Vorticity):
MaxDegreeOfParallelismper session or per scan,MaxConcurrentReadsfor I/O, sharedSegmentCache, concurrent scans over one open file. - vortex-java today:
ScanIteratoris single-threaded, every arena isofConfined.
Proposed shape
A confined Arena per worker thread, so the callback runs on the worker and the caller never touches decoded memory from another thread:
scan.parallel(executor) // executor + bounded in-flight window on ScanOptions
.map(chunk -> r) // runs on the worker; chunk and its arena close on return
Rmust not reference chunk memory (aggregates, copied-out values); Javadoc states the contract.- Results delivered ordered (Rust
buffered, default) or unordered (buffer_unordered). - The file mapping becomes
ofShared(one close at the end), since workers must read it. Alternative: each worker maps its own view. scan()/ScanIterator/Chunklifetime rules stay unchanged.
Pros
- Rust-shaped (map on the spawned task, ordered/unordered, bounded window), so parity with the reference.
- Confined arenas keep the cheap alloc/close path;
Arena.ofShared().close()needs a cross-thread handshake per chunk. - No change to the existing single-threaded API or its safety checks.
- Same bounded-window idea as the writer's
pendingqueue /MAX_IN_FLIGHT_SEGMENTS. - Overlaps decode with consumption; wide files and slow consumers benefit most.
Cons
- No ordered, parallel, zero-copy
Iterator<Chunk>for a consumer thread: a chunk decoded on a worker cannot be read elsewhere. That case would need a shared per-chunk arena (slower close, and relaxes the "secondnext()while aChunkis open is rejected" rule). - Callback API is less ergonomic than an iterator; callers who must keep data have to copy out.
- Mapping arena goes shared; any cross-thread use after
close()becomes a hazard to test (ADR 0003 security contract still applies on worker threads: onlyVortexExceptionmay escape). - Worker exceptions must be propagated and in-flight work cancelled/drained on failure (the writer's
discardPendingequivalent). - Needs A/B on all 7 real files (
RealFileScanBenchmark, interleaved): memory-bandwidth-bound scans may not scale, and oversubscribing the pool gains nothing.
Out of scope / not planned
- Per-column parallel decode within a chunk: not a Rust pattern, so it would be a deliberate divergence needing an explicit decision.
- Parallel I/O for
VortexHttpReader(concurrent range requests): independent of this, worth its own ticket if pursued. - Writer follow-ups (parallel scheme trials in
CascadingCompressor.chooseBest): comment on #474.
- 主要语言
- Java
- 星标
- 3
- 派生
- 2
- 平均合并
- 9 小时 51 分钟
- 30 天内合并 PR
- 127
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dfa1/vortex-java 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
dfa1/vortex-java#636 ·
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 35/100
dfa1/vortex-java#657 ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 70/100
dfa1/vortex-java#655 ·
维护者通常 1 天内回复
-
perf
难度 4/5 3-5 天 新手友好度 30/100
dfa1/vortex-java#651 ·
维护者通常 1 天内回复
-
Writer: string columns written as per-chunk dicts where Rust uses its dict layout (up to 2x larger)未关闭perf
难度 4/5 3-5 天 新手友好度 30/100
dfa1/vortex-java#650 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
Dans-Plugins/Medieval-Roleplay-Engine#396 ·
维护者通常 1 天内回复
-
bug
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
objectionary/lints#1640 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 72/100
virtualcell/vcell#2193 ·
维护者通常 1 天内回复