Skip to main content
RisingWave’s built-in Iceberg maintenance — including automatic compaction and snapshot expiration — runs on the compactor node. When you enable enable_compaction = true on an internal Iceberg table or Iceberg sink, the compactor node executes those background maintenance tasks.
Dedicated compactor required for automatic Iceberg maintenanceBefore enabling enable_compaction = true, ensure your cluster has at least one compactor node deployed. Without a compactor, automatic Iceberg maintenance will not run, small files will accumulate, and query performance will degrade over time.

Why a dedicated compactor is needed

When RisingWave writes to Iceberg, it produces many small data files and frequent snapshots. Without compaction:
  • Query performance degrades due to excessive file scanning.
  • Storage costs increase from accumulated small files and stale snapshots.
  • Metadata overhead grows with each new snapshot, slowing down catalog operations.
RisingWave’s compactor node handles this by periodically merging small files and expiring old snapshots. It uses an embedded Rust/DataFusion engine that can outperform a single-node Apache Spark setup for Iceberg compaction tasks. See the compaction benchmark for details. The compactor node is separate from the compute node and can be scaled independently, so it will not interfere with your streaming workloads.

Deploy a compactor node

Kubernetes (Helm)

If you deployed RisingWave using the Helm chart, add or update the compactorComponent section in your values.yaml file.

Minimal configuration

values.yaml
Apply the change:

Production configuration

For production workloads with frequent writes or large data volumes, allocate more CPU and memory:
values.yaml
See Helm chart configuration for the full list of supported compactorComponent fields.

Kubernetes (Operator)

If you deployed RisingWave using the Kubernetes Operator, add or update the compactor section under spec.components in your RisingWave custom resource. To dedicate a compactor node for Iceberg maintenance, add a node group named iceberg-compactor and set the RW_COMPACTOR_MODE environment variable to dedicated_iceberg. This node group handles only Iceberg compaction and snapshot expiration. The default node group (with empty name "") continues to handle regular Hummock compaction and must remain in place.

Minimal configuration

risingwave.yaml
Apply the change:

Production configuration

For production workloads with frequent writes or large data volumes, allocate more CPU and memory to both node groups:
risingwave.yaml
For a complete end-to-end example manifest that includes meta store, state store, and all component definitions, see the risingwave-postgresql-s3-with-iceberg-compaction.yaml reference in the risingwave-operator repository.

Verify the compactor is running

After applying the configuration, check that the compactor Pod is running:
The output should show a compactor Pod with status Running:

Sizing guidelines

The right compactor size depends on your write volume and compaction frequency. Use the following guidelines as a starting point.

Minimum requirements

This is sufficient for small workloads with infrequent writes (for example, test environments or low-volume pipelines).

Sizing considerations

  • CPU: Compaction is CPU-intensive due to file reading, sorting, and writing. Allocate more CPU for high write volumes or shorter compaction intervals.
  • Memory: The compactor buffers file data in memory during compaction. For large target file sizes (for example, compaction.target_file_size_mb = 512), increase memory proportionally.
  • Replicas: In most cases, a single compactor replica is sufficient. Consider adding a second replica if the compactor consistently becomes a bottleneck (observable via the RisingWave monitoring dashboard).
The compaction benchmark tested RisingWave’s compaction engine on a 16-core, 64 GB machine against ~193 GB of data (17,000+ small files). For reference, that configuration compacted the dataset significantly faster than a single-node Apache Spark setup.

Adjusting compaction frequency

Reducing compaction_interval_sec increases how often compaction runs, which keeps tables healthier but increases compactor load. Increase CPU and memory if you lower the interval significantly.
For complete maintenance configuration options, see Iceberg table maintenance.