Skip to content

Commit 94460c3

Browse files
perf: optimize Arrow-to-Parquet conversion and sync scheduling (#1784)
- add ordered forward Arrow IPC reading for metric conversion - decode multiple small files and multi-batch files concurrently with bounded reader lanes - pipeline metric row-group preparation and Parquet encoding while preserving output order - parallelize metric sorting and column encoding - add detailed Arrow-to-Parquet phase timings - bound periodic Parquet group concurrency per stream - allow configurable overlapping periodic local-sync cycles - atomically isolate processing directories used by concurrent cycles - serialize object-store sync and retain upload claims until staged files are removed - refresh retained claims after deletion failures to prevent duplicate uploads - avoid unnecessary schema cloning during batch adaptation - document conversion sizing and concurrency formulas - add coverage for reader ordering, dictionary batches, invalid files, and Parquet row-group correctness Configuration: New environment variables: - MAX_PERIODIC_LOCAL_SYNC_CYCLES (default: 2): maximum periodic local-sync cycles allowed to run concurrently - METRIC_ARROW_READERS_PER_FILE (default: 4): maximum parallel readers used for record batches within one metric Arrow file increase for multi-batch Arrow files when decoding is slow and CPU is available decrease for one-batch files or CPU contention - METRIC_ARROW_READERS_IN_FLIGHT (default: 4): maximum total Arrow reader lanes active per metric Parquet conversion increase when many small Arrow files must be decoded and CPU/I/O has headroom decrease when many datasets convert concurrently or CPU is saturated - METRIC_ROW_GROUP_ENCODE_IN_FLIGHT (default: 2) maximum metric row groups encoded concurrently per Parquet file increase when Parquet encoding dominates and CPU/memory is available decrease for wide schemas, high memory usage, or many concurrent conversions - PARQUET_COLUMNS_PER_RAYON_TASK (default: 8) minimum Parquet columns assigned to each Rayon encoding task decrease to expose more column parallelism increase for wide schemas or many concurrent conversions to reduce task-scheduling overhead
1 parent 6459688 commit 94460c3

12 files changed

Lines changed: 1833 additions & 241 deletions

‎docker-compose-distributed-test-with-kafka.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ services:
3030

3131
# minio
3232
minio:
33-
image: minio/minio:RELEASE.2025-02-03T21-03-04Z
33+
image: quay.io/parseablehq/minio:edge
3434
entrypoint:
3535
- sh
3636
- -euc

‎docker-compose-distributed-test.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ networks:
44
services:
55
# minio
66
minio:
7-
image: minio/minio:RELEASE.2025-02-03T21-03-04Z
7+
image: quay.io/parseablehq/minio:edge
88
entrypoint:
99
- sh
1010
- -euc
@@ -83,6 +83,7 @@ services:
8383
- P_PARQUET_COMPRESSION_ALGO=snappy
8484
- P_MODE=ingest
8585
- P_INGESTOR_ENDPOINT=parseable-ingest-one:8000
86+
- MAX_PERIODIC_LOCAL_SYNC_CYCLES=1
8687
- RUST_LOG=warn
8788
networks:
8889
- parseable-internal

‎docker-compose-test-with-kafka.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ networks:
33

44
services:
55
minio:
6-
image: minio/minio:RELEASE.2025-02-03T21-03-04Z
6+
image: quay.io/parseablehq/minio:edge
77
entrypoint:
88
- sh
99
- -euc

‎docker-compose-test.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ networks:
33

44
services:
55
minio:
6-
image: minio/minio:RELEASE.2025-02-03T21-03-04Z
6+
image: quay.io/parseablehq/minio:edge
77
entrypoint:
88
- sh
99
- -euc
@@ -43,6 +43,7 @@ services:
4343
- P_PASSWORD=parseableadmin
4444
- P_CHECK_UPDATE=false
4545
- P_PARQUET_COMPRESSION_ALGO=snappy
46+
- MAX_PERIODIC_LOCAL_SYNC_CYCLES=1
4647
- RUST_LOG=warn
4748
depends_on:
4849
minio:

‎src/handlers/livetail.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl FlightService for FlightServiceImpl {
128128

129129
let adapter_schema = schema.clone();
130130
let rx = rx.map(move |x| match x {
131-
Message::Record(t) => Ok(utils::arrow::adapt_batch(&adapter_schema, &t)),
131+
Message::Record(t) => Ok(utils::arrow::adapt_batch(adapter_schema.clone(), &t)),
132132
Message::Skipped(_) => {
133133
warn!("livetail channel capacity is full.");
134134
Ok(RecordBatch::new_empty(adapter_schema.clone()))

0 commit comments

Comments
 (0)