For the complete documentation index, see llms.txt. This page is also available as Markdown.

Pipeline optimization

Symptom-to-page routing table for Nilus pipeline optimization, plus the measurement loop and common tuning knobs shared across guides.

Pipeline optimization is a measured change to improve one of three outcomes: shorter runtime, lower resource use, or a better destination layout.

Optimize only with a symptom

Symptom
First pages

Pipeline takes too long

Pipeline uses too much CPU or memory

CDC lag, snapshot OOM, or Debezium heap pressure

Validating, testing, or doing a partial backfill

Destination has too many files, poor partitioning, or costly queries

Pipeline fails or produces unexpected data

Measurement loop

  1. Capture the current run: status, duration, records processed, CPU, memory, source object, destination, and config.

  2. Pick one hypothesis: extraction bottleneck, load bottleneck, destination layout, source throttling, or resource pressure.

  3. Change one knob.

  4. Run the same workload again.

  5. Compare duration, throughput, cost, and destination correctness.

  6. Keep the change only if it improves the symptom without hiding a correctness issue.

Common knobs

Knob
Placement
Use for

page_size

source.options

Reducing memory pressure or API/page overhead.

extract_parallelism

source.options

Increasing supported extraction concurrency.

loader_file_size

sink.options

Reducing small files or loader batch overhead.

partition_by

sink.options

Improving Lakehouse query pruning.

cluster_by

sink.options

Improving locality for common filters where supported.

LOAD__WORKERS

Runtime environment

Increasing destination load worker concurrency for large writes.

NORMALIZE__WORKERS

Runtime environment

Increasing normalization worker concurrency for wide or nested data. Keep the default on CDC pipelines.

NILUS_JVM_HEAP_PERCENT

Runtime environment

CDC only: share of pod memory given to the embedded Debezium JVM. See Optimizing CDC for the tested 12 GiB / 30% / 500k–700k reference.

Set runtime environment variables under runtime.env.

For the full knob reference, including placement, defaults, valid values, and symptoms, see Optimizing for Time (throughput and validation-sampling knobs) and Optimizing for Resource (memory/CPU and width-sampling knobs). For CDC heap and queue tuning, see Optimizing CDC. For how the destination dataset is physically laid out, see Optimize Sink Datasets.

Use these as starting points. Tune each profile for available CPU, memory, and source limits.

For Lakehouse (Iceberg) destinations, table shape and query patterns drive file sizing. See Tuning large Lakehouse (Iceberg) loads for benchmark-backed configurations.

Faster: throughput-oriented

For large lakehouse or warehouse loads where wall-clock time matters more than resource cost.

Lower-resources: memory/CPU-conservative

For shared runtimes, tight pod budgets, or pipelines that previously OOMKilled.

Balanced: default starting point

The shape of most well-behaved pipelines.

Sizing playbook

Use this process for a new pipeline with unfamiliar data.

  1. Baseline. Run once with defaults and conservative compute. Record runtime, peak CPU/memory, network throughput, and destination file count. If the run gets OOMKilled, prioritize memory mitigations: lower extract_parallelism, lower LOAD__WORKERS, lower page_size to 25k, and keep loader_file_size large.

  2. Size files first. Estimate row_bytes ≈ raw_table_size_bytes / total_rows. Target Parquet files of 128–512 MB. Use loader_file_size ≈ target_file_bytes / row_bytes, then check expected_files = ceil(total_rows / loader_file_size). Aim for 20–200 files for a very large table.

  3. Bound memory via page_size. Estimate page memory as page_size × row_bytes. Choose page_size so peak RSS stays well under pod memory. Start at 50k–100k; drop to 25k–50k for OOM-prone or wide-row pipelines.

  4. Set parallelism from available CPU. extract_parallelism and LOAD__WORKERS near 60–80% of allocatable vCPU is a good starting point. Keep NORMALIZE__WORKERS low (1–2). On CDC pipelines, leave NORMALIZE__WORKERS and LOAD__WORKERS at defaults. See Optimizing CDC. Use parallel for lakehouse and most warehouses; use sequential for fragile or strictly locked destinations.

  5. Validate on a slice. Use sql_limit or a tight interval_start/interval_end window to confirm sizing, memory headroom, and file count on a partial run before scaling to the full dataset. See Optimizing for time.

  6. Iterate by bottleneck:

    • Long commit tail → raise loader_file_size.

    • Low CPU, long runtime → raise extract_parallelism and/or LOAD__WORKERS.

    • Source throttling → lower extract_parallelism or page_size.

    • Memory spikes → lower parallelism first; only then lower page_size.

  7. Add partitioning last. Align partition_by with consumer queries. Confirm each partition still hits a healthy file size. High-cardinality partitions that produce tiny files cost more than they save. See Shape knobs.

Last updated

Was this helpful?