Eliezer Talker
07/12/2026, 12:11 PMRocky
07/12/2026, 12:11 PMStarRocksCluster YAML, add the starRocksCnSpec with an autoScalingPolicy. The StarRocks Operator will automatically create a Kubernetes HPA resource for you.
yaml
apiVersion: <http://starrocks.com/v1|starrocks.com/v1>
kind: StarRocksCluster
metadata:
name: starrockscluster-sample
spec:
# BE nodes for storage (fixed/manual scaling)
starRocksBeSpec:
replicas: 3
storageVolumes:
- name: be-storage
storageClassName: "gp3"
storageSize: "1Ti"
mountPath: "/opt/starrocks/be/storage"
# CN nodes for elastic compute (automatic scaling)
starRocksCnSpec:
image: starrocks/cn-ubuntu:4.1.1
autoScalingPolicy:
minReplicas: 2
maxReplicas: 10
hpaPolicy:
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 60
2. Why BEs are scaled manually
* Scale-out (BE): When you manually increase the replicas in starRocksBeSpec, StarRocks automatically detects the new nodes and starts rebalancing data (tablets) to them.
* Scale-in (BE): This is a critical operation. You must use the DECOMMISSION command to ensure data is safely moved to other nodes before the pod is deleted. The Operator does not currently automate this safety check for HPA-driven scale-down of BEs.
Summary of Scaling Capabilities
Node Type | Stateful? | Auto-scaling (HPA) | Recommended Usage
FE | Yes | No | Fixed (typically 3 for HA).
BE | Yes | No | Manual scaling for storage capacity.
CN | No | Yes | Automatic scaling for query performance.
Note for 4.1.1: Ensure you are using the latest version of the StarRocks Kubernetes Operator (v1.9.0 or later), which supports the autoScalingPolicy and refined management of CN nodes in hybrid environments. If you need to scale storage automatically, you would typically need to switch to shared-data mode (using S3/GCS/HDFS), where all compute nodes (CNs) are stateless and can be auto-scaled freely.
References
• administration/management/Scale_up_down.md
• deployment/sr_operator.md
• administration/management/resource_management/Replica.md
• deployment/shared_data/feature-support-shared-data.mdEliezer Talker
07/12/2026, 12:13 PMRocky
07/12/2026, 12:14 PMStarRocksCluster spec. They are stateless, so they can be scaled up and down automatically by the Operator using HPA based on CPU/memory usage.
2. Configuration Example
In your StarRocksCluster YAML, you include both starRocksBeSpec and `starRocksCnSpec`:
yaml
apiVersion: <http://starrocks.com/v1|starrocks.com/v1>
kind: StarRocksCluster
metadata:
name: starrocks-hybrid
spec:
starRocksBeSpec:
replicas: 3 # Fixed storage layer
storageVolumes:
- name: be-storage
storageSize: 500Gi
mountPath: /opt/starrocks/be/storage
starRocksCnSpec: # Elastic compute layer
image: starrocks/cn-ubuntu:4.1.1
autoScalingPolicy:
minReplicas: 1
maxReplicas: 10
hpaPolicy:
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
3. Making it Work (The "Catch")
By default, if you have both BEs and CNs in a shared-nothing cluster, StarRocks prefers to run queries on the BEs because the data is local to them. To make your auto-scaling CNs actually do the work, you must set these session or global variables:
* SET GLOBAL prefer_compute_node = true; — This tells the FE to prioritize CN nodes for query execution.
* SET GLOBAL use_compute_nodes = -1; — This ensures the system uses all available CN nodes.
Important Considerations for 4.1.1:
* Performance: When a CN node processes data from an internal table stored on a BE, it must fetch that data over the network. This is slightly slower than local BE processing but is the only way to get true "auto-scaling" without switching to shared-data mode.
* External Tables: This hybrid setup is extremely effective if you are querying data lakes (Iceberg, Hive, etc.), as CNs can process that data directly without involving the BE storage.
* Shared-Data Mode: If your primary goal is to have everything scale automatically (storage and compute), you should consider switching to shared-data mode (using S3/GCS/MinIO as storage), where you use only CN nodes and no BEs at all.
In summary: You can have both BE and CN nodes in 4.1.1. You scale the CNs automatically to handle query spikes, while keeping the BEs fixed to manage your local data storage needs.
References
• deployment/deploy_manually.md
• deployment/upgrade.md
• administration/management/Scale_up_down.mdEliezer Talker
07/12/2026, 12:17 PMRocky
07/12/2026, 12:17 PMreplicas count in your StarRocksCluster YAML), automatic scale-down for BE nodes is not recommended and is not natively supported by the Operator for the following reasons:
* Scale-Up (Safe): When you increase the BE replica count, the Operator adds new Pods. StarRocks automatically detects these new nodes and begins rebalancing tablets (data) to them. This can be automated with KEDA based on CPU or disk usage.
* Scale-Down (Dangerous): Scaling down a BE requires a "Decommission" process. You must run ALTER SYSTEM DECOMMISSION BACKEND "..." in SQL and wait for StarRocks to move all data off that node before the Pod is deleted.
* If a Kubernetes HPA or KEDA simply reduces the replica count, Kubernetes will kill the Pod and delete/detach the PVC immediately.
* If you don't have enough replicas of your data, this leads to data loss or offline partitions.
* The StarRocks Operator currently requires you to scale down BE nodes one at a time manually to ensure data safety.
2. Handling "Storage Full" Scenarios
If your concern is "storage is full," there are two ways to handle this in a non-shared environment:
* PVC Expansion (Recommended): If your Kubernetes StorageClass supports allowVolumeExpansion: true (most cloud providers like AWS EBS, GCP PD, and Azure Disk do), you can simply increase the storageSize in your StarRocksCluster spec. The Operator will update the PersistentVolumeClaims, and the file system will expand without needing to add new nodes.
* Scale-Out (Add Nodes): If you hit the disk limit on existing nodes, you increase the replicas. StarRocks will move data to the new nodes, freeing up space on the old ones.
3. The Best Way to Auto-Scale
If you need true elasticity (where nodes come and go automatically), the recommended architecture in StarRocks 4.1.1 is:
1. Keep a fixed BE tier: Deploy a stable number of BE nodes with enough storage for your data.
2. Add an elastic CN tier: Add starRocksCnSpec with an autoScalingPolicy.
* CN nodes are stateless. They can be scaled up and down instantly by KEDA/HPA without any data rebalancing or decommissioning risk.
* Set SET GLOBAL prefer_compute_node = true; so that the cluster uses these elastic nodes for the heavy lifting of queries.
Summary
Action | Can it be automated? | Tool | Recommendation
Scale-Up BE | Yes | KEDA / HPA | Good for handling storage/write pressure.
Scale-Down BE | No | Manual | Must decommission manually to prevent data loss.
Expand Storage | Yes | Operator | Change storageSize in YAML (requires VolExpansion support).
Scale CN | Yes | KEDA / HPA | Best way to handle variable query loads.
Bottom line: Do not use KEDA or HPA to scale down your BE nodes. It will lead to data integrity issues. Use them to scale up BEs or to scale CNs in both directions.
References
• deployment/sr_operator.md
• administration/management/Scale_up_down.md
• administration/management/resource_management/Replica.md
• faq/operation_maintenance_faq.md
References
• deployment/sr_operator.md
• quick_start/helm.md
• faq/Others.mdEliezer Talker
07/12/2026, 12:21 PMRocky
07/12/2026, 12:21 PMINSERT INTO iceberg_table SELECT ...) involves two heavy phases: scanning the source data and sinking (encoding and uploading) it to S3.
Adding CN nodes allows you to offload and parallelize the "sink" portion of this workload.
How CNs Increase Throughput
1. Parallel Writing (Sink Offloading): When you run an INSERT INTO or EXPORT command, the FE generates a distributed execution plan. By setting prefer_compute_node = true, the FE can schedule the "sink" operators (the part of the query that converts data to Parquet/ORC and uploads it to S3) onto the CN nodes.
2. Horizontal Scaling of Network/CPU: Sinking data to S3 is CPU-intensive (for Parquet compression/encoding) and network-intensive (for the upload). Since CNs are stateless and auto-scale in K8s, you can spin up 10+ CNs to act as a massive "upload farm" that drains data from your BEs and pushes it to S3 in parallel.
3. Bypassing BE Bottlenecks: Without CNs, your BE nodes must handle both the local disk I/O (scanning) and the S3 upload (sinking). If your BEs are already busy with user queries, the export will be slow. CNs provide dedicated, isolated compute for the data movement task.
Recommended Configuration
To ensure the CN nodes are used for the data movement, you should set the following session variables:
sql
-- Tell the FE to prioritize CN nodes for the execution plan
SET GLOBAL prefer_compute_node = true;
-- Ensure all available nodes (including CNs) are used for the query
SET GLOBAL use_compute_nodes = -1;
-- Optional: Increase parallelism for the sink (if supported by the catalog)
SET parallel_fragment_exec_instance_num = 16;
Important Considerations
* The "Read" Bottleneck: While CNs can speed up the writing to S3, the reading still happens on the BE nodes where the data lives. If your BE disks or network are already saturated, adding CNs will only help to a certain point.
* Data Shuffle: Moving the "sink" to CNs requires the data to be sent over the network from BEs to CNs. Ensure your Kubernetes internal network has enough bandwidth (e.g., 10Gbps+ nodes) to handle this internal transfer.
* Asynchronous Tasks: For very large data movements, use SUBMIT TASK AS INSERT INTO... to run the job in the background, allowing you to monitor it via information_schema.task_runs.
Summary
In a shared-nothing cluster, BEs provide the storage bandwidth, and CNs provide the processing/upload bandwidth. Adding auto-scaling CNs is the most effective way to scale the throughput of data exports to Iceberg/S3 without over-provisioning your permanent storage nodes.
References
• data_source/catalog/iceberg/DML.md
• sql-reference/System_variable.md
• unloading/Export.md
• loading/InsertInto.md
• data_source/External_table.md
References
• deployment/shared_data/s3.md
• unloading/Export.md
• loading/s3.md
• introduction/Architecture.mdEliezer Talker
07/12/2026, 12:22 PMRocky
07/12/2026, 12:22 PMINSERT INTO iceberg_table SELECT * FROM native_table, the process consists of two main parts:
* Scanning: Reading data from the BE local disks.
* Sinking (The "Heavy" part): Converting that data into Parquet/ORC format, compressing it, and uploading it to S3.
How CNs help:
By setting SET GLOBAL prefer_compute_node = true;, the StarRocks FE will schedule the Sink operation onto your CN nodes. The CNs will pull the raw data from the BEs over the network, perform the heavy Parquet encoding and compression using their own CPU, and handle the multi-part upload to S3. This prevents your BE nodes from being "pinned" by high CPU usage during large exports.
2. Loading data from S3 into Native Tables (FILES or Pipe)
When you use INSERT INTO native_table SELECT * FROM FILES(...) or a Pipe, the process is reversed:
* Scanning (The "Heavy" part): Downloading files from S3 and parsing/decompressing them (e.g., decoding Parquet or CSV).
* Sinking: Writing the parsed rows into the local tablets on the BE nodes.
How CNs help:
* Offloading the Parse: With prefer_compute_node = true, the CN nodes act as the "Load Workers." They perform the network-heavy download from S3 and the CPU-heavy task of parsing the files.
* Data Shuffle: Once the CN has parsed the data into rows, it shuffles that data to the specific BE nodes that own the destination tablets.
* Throughput Gain: Because you can scale CNs up to 10s or 100s of nodes without worrying about data rebalancing, you can achieve massive ingestion throughput. The BE nodes only have to focus on the final step: receiving the rows and writing them to disk.
Summary of the Role of CNs in Data Movement
Direction | CN Node Task | Benefit
BE → Iceberg | Encoding & S3 Upload | Offloads compression CPU from storage nodes.
S3 → BE (Native) | S3 Download & Parsing | Offloads parsing CPU; enables elastic load capacity.
Important Note: To make this work, ensure you have set the following global variables so the FE knows it is allowed to use CNs for these tasks:
sql
SET GLOBAL prefer_compute_node = true;
SET GLOBAL use_compute_nodes = -1;
Without these settings, StarRocks may default to running the entire job on the BE nodes to keep data "local," which defeats the purpose of having an elastic compute layer for your data movement.
References
• data_source/catalog/iceberg/DML.md
• loading/loading_introduction/loading_concepts.md
• sql-reference/sql-functions/table-functions/files.md
• sql-reference/System_variable.md
• administration/management/Scale_up_down.md
• loading/s3.md
References
• loading/loading_introduction/loading_concepts.md
• loading/hdfs_load.md
• sql-reference/System_variable.md
• loading/minio.mdEliezer Talker
07/12/2026, 12:27 PMRocky
07/12/2026, 12:27 PMSUM, COUNT, GROUP BY), the final result might only be a few kilobytes or megabytes.
* The FE's Role: The FE only receives this final, tiny "shrunken" result from the BEs to pass back to you. The massive CPU and network load of processing the 1TB stays entirely on the BEs.
2. Metadata vs. Data
The FE's primary job is SQL Planning. It calculates which BEs have the data and how they should talk to each other. Once the plan is sent to the BEs, the BEs communicate with each other directly (via a high-speed "Shuffle" or "Exchange" process) without the FE being involved in those intermediate data transfers.
3. Distributed Result Return (Arrow Flight SQL)
For scenarios where you do need to pull millions of rows (e.g., feeding a Python dataframe or a Machine Learning model), StarRocks supports Arrow Flight SQL.
* Traditional (MySQL/JDBC): Data is serialized into rows, gathered at the FE, and sent to the client. This can bottleneck the FE if you try to pull 10GB of raw data.
* Arrow Flight: This protocol allows the client to fetch data in a distributed manner. The FE provides the client with "tickets" (locations), and the client can pull data directly from the multiple BE nodes in parallel, completely bypassing the FE for the data stream.
4. Multiple FEs (Observers)
If your bottleneck is simply the number of incoming connections (thousands of concurrent users), you can scale the FE layer horizontally:
* Follower FEs: Handle metadata and can take over if the Leader fails.
* Observer FEs: These are stateless "read-only" FEs. You can add many Observers behind a Load Balancer. They handle the SQL parsing and result returning for their own connected clients, spreading the network and CPU load across multiple machines.
5. Efficient Serialization
Even when using the standard MySQL protocol, StarRocks uses a highly optimized serialization format between BEs and FEs to minimize the CPU overhead on the FE node when it acts as the final "gatekeeper" for results.
When could it be a bottleneck?
The FE will become a bottleneck if:
1. *Massive `SELECT `: You try to fetch millions of rows of raw data over a standard JDBC/MySQL driver (use Arrow Flight instead).
2. Too many small queries: If you run 10,000+ tiny queries per second, the SQL parsing/planning overhead on the FE's CPU will spike (scale out with Observer FEs).
3. Large Metadata: If you have millions of partitions, the FE's memory can become a bottleneck (requires increasing FE JVM heap).
-Xmx
heap size).
References
• introduction/Architecture.md
• unloading/arrow_flight.md
• administration/management/FE_configuration.md
• faq/Sql_faq.md
References
• unloading/arrow_flight.md