perf(parquet codec): write one row group per 8192 rows - #49
Closed
vaclav-dvorak wants to merge 2 commits into
Closed
vaclav-dvorak wants to merge 2 commits into
vaclav-dvorak wants to merge 2 commits into
Conversation
Author
|
Closing: the thread-scaling bench shows this is a regression where it matters. At 1024 rows it is 26% slower at 8 threads; 8192 is only neutral at 8-12. All measurements were on a 12-core laptop, while the fleet runs vector with up to 64 threads on superset nodes, so there is no basis to claim it is safe at that width. Throughput peaks at 4-8 threads and declines after, regardless of row group size. Capping vector's thread count is the fix; the row group change does not address the ceiling. |
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
encode()opens one row group for the whole batch, so each of the 78 CloudTrail columns re-walks every event in it. This writes a row group per 8192 rows instead.Details
Two benches, both against the real 78-column
cloudtrail.schemacopied from chronoforge.parquet_encode(criterion, single-threaded, per-iterationformat!corpus):parquet_threads(thread scaling, events backed by ONE sharedBytesblob):1024 looks much better single-threaded and is a 26% regression at 8 threads, so it is not the value to ship. Small row groups mean far more page and dictionary flushes, and that allocation churn appears to contend across threads. 8192 keeps the low-thread win without regressing higher counts.
The shared-blob corpus matters: events parsed from one S3 object hold
Bytesthat all slice the same allocation, so clone/drop during encoding hits one refcount. The criterion corpus builds each value withformat!, giving every value its own refcount, and cannot show this at all.Motivation: gainsight's vector wedged on 2026-09-23, all 32 cores at zero throughput with a 145k SQS backlog.
perf record -F 99 -aon the live pod:32 threads in state
Rwithwchan=0, 32 voluntary context switches for the entire process lifetime, flatread_bytes: no I/O, no blocking, pure coherence traffic. Capping vector to 8 threads stopped the livelock but left the tenant under capacity.Caveats:
All 13 existing parquet codec tests pass, including round-trip and compression.
The
parquet.rsdiff is 17 semantic lines; the rest iscargo fmtre-indenting the block that gained a nesting level (git diff -w).