> For the complete documentation index, see [llms.txt](https://v2.dataos.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v2.dataos.info/concepts/resources/nilus/pipeline-optimization.md).

# Pipeline Optimization

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                                              | [Optimizing for Time](/concepts/resources/nilus/pipeline-optimization/optimizing-for-time.md)                                                        |
| Pipeline uses too much CPU or memory                                 | [Optimizing for Resource](/concepts/resources/nilus/pipeline-optimization/optimizing-for-resource.md)                                                |
| Destination has too many files, poor partitioning, or costly queries | [Optimize Sink Datasets](/concepts/resources/nilus/pipeline-optimization/optimize-sink-datasets.md)                                                  |
| Large Lakehouse (Iceberg) load is slow or runs out of memory         | [Tuning Large Lakehouse (Iceberg) Loads](/concepts/resources/nilus/pipeline-optimization/optimize-sink-datasets/optimize-lakehouse-iceberg-loads.md) |
| Pipeline fails or produces unexpected data                           | [Troubleshooting](/concepts/resources/nilus/troubleshooting.md)                                                                                      |

## 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.               |
| `DATA_WRITER__FILE_MAX_BYTES` | `spec.use.projection.projections.envVars` | Controlling per-file byte size for Iceberg destinations.             |
| `LOAD__WORKERS`               | `spec.use.projection.projections.envVars` | Increasing destination load worker concurrency for large writes.     |
| `NORMALIZE__WORKERS`          | `spec.use.projection.projections.envVars` | Increasing normalization worker concurrency for wide or nested data. |

All runtime env vars go under `spec.use.projection.projections.envVars` (not `spec.runtime.env`). For the wiring pattern and validated Lakehouse configurations, see [Optimizing for Time](/concepts/resources/nilus/pipeline-optimization/optimizing-for-time.md) and [Tuning Large Lakehouse (Iceberg) Loads](/concepts/resources/nilus/pipeline-optimization/optimize-sink-datasets/optimize-lakehouse-iceberg-loads.md).

## Related docs

* [Observability](/concepts/resources/nilus/observability.md)
* [Optimizing for Time](/concepts/resources/nilus/pipeline-optimization/optimizing-for-time.md)
* [Optimizing for Resource](/concepts/resources/nilus/pipeline-optimization/optimizing-for-resource.md)
* [Optimize Sink Datasets](/concepts/resources/nilus/pipeline-optimization/optimize-sink-datasets.md)
* [Tuning Large Lakehouse (Iceberg) Loads](/concepts/resources/nilus/pipeline-optimization/optimize-sink-datasets/optimize-lakehouse-iceberg-loads.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://v2.dataos.info/concepts/resources/nilus/pipeline-optimization.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
