Add column-based stripe boundary cutting to VeloxWriter#563
Open
tanjialiang wants to merge 2 commits intofacebookincubator:mainfrom
Open
Add column-based stripe boundary cutting to VeloxWriter#563tanjialiang wants to merge 2 commits intofacebookincubator:mainfrom
tanjialiang wants to merge 2 commits intofacebookincubator:mainfrom
Conversation
…ations (facebookincubator#562) Summary: X-link: facebookincubator/velox#16695 MallocAllocator currently uses mmap/munmap for contiguous allocations despite its name suggesting it delegates everything to malloc. The mmap/munmap syscall pair on every contiguous alloc/free cycle adds overhead. This diff: 1. Adds an `Options` struct to `MallocAllocator` (mirroring `MmapAllocator::Options`) for cleaner configuration. 2. Adds a `mallocContiguousEnabled` option that, when true, uses `aligned_alloc`/`free` for contiguous allocations instead of `mmap`/`munmap`. 3. Wires the option through `MemoryManager::Options`. 4. Updates `CachedBufferedInputTest` to use the new `Options` struct. The option defaults to false to preserve existing behavior. When enabled, contiguous allocations use `aligned_alloc(kPageSize, maxBytes)` which immediately commits physical memory (vs mmap's lazy page faulting), but this is acceptable for MallocAllocator's use case. `growContiguous` requires no changes since both mmap and malloc allocate `maxPages` upfront, so growth stays within already-allocated memory. Reviewed By: duxiao1212 Differential Revision: D95875673
Summary: For user sequence storage with cluster index, having one user per stripe reduces read amplification by ~21x. Currently, callers must manually split input batches at column value boundaries and call flush() — this is fragile and duplicates logic across every caller. This diff embeds stripe boundary detection into VeloxWriter via a new `stripeBoundaryColumnCount` option. When set, the writer automatically detects value transitions in the leading N index columns during write() and flushes stripes at boundaries. This handles both intra-batch transitions (slicing within a single write() call) and cross-batch transitions (between consecutive write() calls). The normal write path has zero overhead — when no boundary columns are configured, it calls writeBatch() directly without any boundary checks. Differential Revision: D96025164
|
@tanjialiang has exported this pull request. If you are a Meta employee, you can view the originating Diff in D96025164. |
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.
Summary:
For user sequence storage with cluster index, having one user per stripe
reduces read amplification by ~21x. Currently, callers must manually split
input batches at column value boundaries and call flush() — this is fragile
and duplicates logic across every caller.
This diff embeds stripe boundary detection into VeloxWriter via a new
stripeBoundaryColumnCountoption. When set, the writer automaticallydetects value transitions in the leading N index columns during write()
and flushes stripes at boundaries. This handles both intra-batch transitions
(slicing within a single write() call) and cross-batch transitions (between
consecutive write() calls).
The normal write path has zero overhead — when no boundary columns are
configured, it calls writeBatch() directly without any boundary checks.
Differential Revision: D96025164