Mahesha Subrahamanya
05/19/2026, 11:13 PMcol1 = md5(col1),
col2 = ifnull(col2, 'nan'),
col3 = col3,
col4 = col4)
)
WITH BROKER
(
--aws properties----
)
PROPERTIES
(
"timeout" = "7200",
"max_filter_ratio" = "0.0",
"load_mem_limit" = "1073741824"
);
with 450 millions dataset (450 parquets files of each size is 125 mb) which is taking 35 mins to load. could you please help me in order to improve performance and also, any best practices to improve and optimize this code. thanksRocky
05/19/2026, 11:13 PMBROKER LOAD on a Primary Key model with shared-data architecture, there are several bottlenecks in your current configuration.
1. Increase Ephemeral Storage (Critical)
You have assigned 512Mi of ephemeral storage to your CN nodes. This is the most likely bottleneck for a Primary Key table with 450 million rows:
* Persistent Index: In shared-data mode, the persistent_index is stored on the local disk of the CN nodes. 450 million keys will require significantly more than 512MB of space (typically 10-20GB+ depending on key size).
* Impact: When local storage is insufficient, StarRocks cannot effectively manage the index, leading to severe I/O contention or load failures.
* Recommendation: Increase the ephemeral storage to at least 100GB - 200GB per CN to allow for the persistent index and local data caching.
2. Adjust Memory and Load Limits
Your CN nodes have 16Gi of RAM, which is very tight for StarRocks.
* `load_mem_limit`: You have restricted the load to 1GB (1073741824). For a dataset of this size and 450 files, this limit may cause frequent "flushing" to disk, slowing down the process.
* Recommendation:
* Increase CN memory to 32Gi or 64Gi if possible.
* Set "load_mem_limit" = "8589934592" (8GB) in your PROPERTIES to give the load task more room to buffer data before committing.
3. Improve Parallelism
StarRocks splits a Broker Load into instances across your CNs. You can increase the parallelism to utilize more of your 8-core CPUs:
* FE Configuration: Increase load_parallel_instance_num (default is usually 1 per BE/CN).
* Run: ADMIN SET FRONTEND CONFIG ("load_parallel_instance_num" = "4");
* Pipeline DOP: Since v3.x, you can also set the pipeline degree of parallelism.
* Set the session variable: SET GLOBAL pipeline_dop = 8; (or half of your CPU cores).
4. Optimize Transformations
You are performing md5(col1) on 450 million rows during the load.
* MD5 is CPU intensive: Performing this transformation at the ingestion layer adds significant overhead to each row.
* Best Practice: If col1 is already unique or if you can pre-calculate the hash before uploading to S3, the load will be much faster. If you must do it in StarRocks, ensure your CN nodes have enough CPU headroom.
5. Check Table Configuration
* Bucket Count: Ensure your table has an appropriate number of buckets. For 450M rows across 3 CN nodes, you should aim for roughly 30-60 buckets (approx. 10-20 per node) to ensure even distribution and parallel processing.
* Persistent Index: Since you are using shared-data, ensure enable_persistent_index is indeed "true" (as you have it), but it must have enough local disk space (see point 1).
Recommended Optimized Load Command
sql
LOAD LABEL starrocks_external_lkp_tables.shadow_hcp_impact_score__v_insert_unique_label
(
DATA INFILE("<s3://bucket/temp1/*>")
INTO TABLE test1
FORMAT AS "parquet"
SET
(col1 = md5(col1),
col2 = ifnull(col2, 'nan'),
col3 = col3,
col4 = col4)
)
WITH BROKER ( ... )
PROPERTIES
(
"timeout" = "7200",
"max_filter_ratio" = "0.0",
"load_mem_limit" = "8589934592" -- Increased to 8GB
);
Summary of Actions
1. Increase ephemeral-storage from 512Mi to 100Gi+.
2. Increase CN Memory to 32Gi if possible.
3. Set load_parallel_instance_num to 4 in FE config.
4. Increase load_mem_limit in the load statement to 8GB.
References
• sql-reference/sql-statements/loading_unloading/BROKER_LOAD.md
• loading/loading_introduction/loading_considerations.md
• sql-reference/System_variable.mdRocky
05/19/2026, 11:13 PMRocky
05/19/2026, 11:14 PMenable_persistent_index = true, the index (which maps primary keys to row locations) is stored on the local disk of your CN nodes.
* The Math: For 450 million rows with a primary key of md5(col1) (32 bytes) + col2 (let's assume 10 bytes), the index requires approximately 9GB to 12GB of disk space cluster-wide.
* The Bottleneck: You have only 512Mi of ephemeral storage per CN. When StarRocks runs out of disk space for the persistent index, performance collapses as it struggles with I/O or fails to persist the index.
* Solution A (Increase Disk): Increase your CN ephemeral-storage to at least 50GB - 100GB. This allows for the index and local data caching.
* Solution B (Cloud Native Index): If you are on StarRocks v3.3.2+, use the Cloud Native persistent index which stores the index on S3 and uses local disk only as a cache:
sql
PROPERTIES (
"enable_persistent_index" = "true",
"persistent_index_type" = "CLOUD_NATIVE"
);
2. Increase Load Parallelism
Your 3 CN nodes have 8 CPUs each (24 total), but the default Broker Load settings may only be using 3 concurrent instances (one per CN).
* FE Configuration: Increase the number of parallel instances allowed per CN. Run this on your leader FE:
sql
ADMIN SET FRONTEND CONFIG ("load_parallel_instance_num" = "4");
* Pipeline Parallelism: Ensure the pipeline engine can utilize all cores during the transformation phase (md5 is CPU heavy):
sql
SET GLOBAL pipeline_dop = 8;
3. Adjust Memory and Load Limits
Your CN nodes have 16Gi RAM, but you limited the load to only 1Gi (load_mem_limit).
* The Impact: A 1GB limit for 450 million rows forces the CN to flush data to S3 very frequently, creating many small files and increasing metadata overhead.
* Recommendation: Increase the memory limit in your LOAD statement to allow larger buffers:
sql
PROPERTIES (
"timeout" = "7200",
"load_mem_limit" = "8589934592" -- Increase to 8GB (8589934592 bytes)
);
4. Optimize the Primary Key
The md5(col1) transformation is problematic for two reasons:
1. CPU Cost: Calculating MD5 for 450M rows during ingestion is very expensive. If possible, pre-calculate this value or use a numeric hash if the raw col1 is not unique.
2. Index Size: MD5 produces a 32-character string. Large string primary keys significantly increase the memory and disk footprint of the persistent index.
5. Check Bucket Count
For a 450M row dataset on 3 CNs, ensure your table has an appropriate number of buckets.
* Goal: Each tablet should be around 500MB - 1GB.
* Recommendation: Use approximately 32 to 48 buckets (DISTRIBUTED BY HASH(col1) BUCKETS 48). Too few buckets will limit the parallelism of the load.
Summary Checklist
1. Disk: Increase CN ephemeral storage to 50GB+ (or switch to CLOUD_NATIVE index).
2. Memory: Increase CN memory to 32Gi if possible; set load_mem_limit to 8GB.
3. Parallelism: Set load_parallel_instance_num to 4 in FE config.
4. Transformation: Avoid md5 in the load's SET clause if it can be handled upstream.
References
• deployment/shared_data/hdfs.md
• quick_start/shared-data.md
• deployment/shared_data/azure.md
• deployment/shared_data/s3.md
• deployment/shared_data/minio.md
• faq/Others.mdRocky
05/19/2026, 11:14 PM