Reader: concurrent scan with a confined arena per worker thread
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 12/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- java
- Domain
- data, performance
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Java
- Stars
- 3
- Forks
- 2
- Avg merge
- 9h 19m
- Merged PRs (30d)
- 154
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dfa1/vortex-java
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dfa1/vortex-java#738 ·
Maintainers usually reply within 1 day
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dfa1/vortex-java#737 ·
Maintainers usually reply within 1 day
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dfa1/vortex-java#736 ·
Maintainers usually reply within 1 day
-
help wanted project
Difficulty 5/5 Over a week Newbie friendliness 25/100
dfa1/vortex-java#729 ·
Maintainers usually reply within 1 day
-
enhancement good first issue
Difficulty 3/5 1-2 days Newbie friendliness 72/100
dfa1/vortex-java#728 ·
Maintainers usually reply within 1 day
All issues in dfa1/vortex-java
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 2/5 Under an hour Newbie friendliness 84/100
cpp-best-practices/project_validator#251 ·
Maintainers usually reply within 1 day
-
backend enhancement
Difficulty 2/5 Half a day Newbie friendliness 70/100
damodharg6/payledger#16 ·
-
[Bug]: An initiative list with no current entry logs an error on every changePossibly taken @dwizard0 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day