Mohan
07/31/2026, 7:53 AMRocky
07/31/2026, 7:54 AMSHOW COMPUTE NODES; (or SHOW BACKENDS;). Check the Alive and SystemDecommissioned columns. If they are false, the FE will not send traffic to them.
* Check for Blacklisting (New in 4.x): StarRocks 4.0 introduced automatic node blacklisting. If a node performs poorly or has high RPC failure rates, the FE may temporarily stop sending queries to it.
* Action: Check the FE leader logs (fe.log and fe.warn.log) for messages containing "blacklist", "unhealthy", or "remove from scheduler".
* Check Warehouse Assignment: If you are using the multi-warehouse feature, ensure your user/session is not restricted to a specific warehouse that accidentally contains only one active node. Run SHOW WAREHOUSES;.
2. Analyze the Query Load
If all nodes appear "Alive," the issue is likely in how the fragments are distributed.
* SHOW PROCESSLIST;: While the cluster is under load, run this to see the Backend column. Confirm if all active query IDs are associated with the same IP address.
* Get a Query Profile: For a timed-out or slow query, retrieve the profile:
sql
-- Get the last query ID
SELECT last_query_id();
-- Get the profile (you may need to use the web UI or a tool like get_profile.py)
Look at the Fragment distribution. If the Fragment count is high on one node and zero on others, the FE scheduler is intentionally avoiding the other nodes.
3. Likely Causes in Shared-Data (4.0.6)
* Cache Locality Skew: In shared-data mode, StarRocks tries to send queries to the node that already has the relevant data in its Data Cache to avoid remote storage latency. If one node "wins" the initial cache for a hot dataset, the scheduler may continue to prefer it, creating a "hotspot" cycle where the node stays busy, gets more cache, and thus attracts more queries.
* Consistency Hash Issues: StarRocks uses a consistent hashing algorithm to assign tablets to CNs. If the number of tablets is too small (e.g., a table with only 1-4 buckets), the fragments cannot be distributed across many nodes.
* Debug: Check SHOW TABLET FROM <table_name>; to see if tablets are balanced across your 4 CNs.
* ShardManager Lock Contention: There is a known behavior in 3.5/4.0 where heartbeat failures can trigger a write lock in the metadata manager (ShardManager). If one node has network flakiness, it can cause the FE to block updates for other nodes, potentially leading to a state where only one node is considered "stable."
* Resource Group Restrictions: If you use Resource Groups, check if the queries are hitting a group that is restricted to a specific set of nodes or is configured such that it saturates one node before spilling.
4. Debugging Steps via K8s
* Check for Clock Skew: Shared-data clusters are sensitive to time differences. Check if the pods have significant clock skew:
bash
kubectl exec -it <fe-pod> -- date
kubectl exec -it <cn-pod-1> -- date
* Connection Termination: If you have a K8s Service (LoadBalancer/ClusterIP) in front of the FE, ensure sessionAffinity is NOT set to ClientIP. If the FE is busy, it might be the app pinning connections. But if the CN is busy, it's an internal StarRocks scheduling issue.
* Examine CN Metrics: Check if the busy node is actually doing Compaction rather than user queries.
```sqlRocky
07/31/2026, 7:54 AMIf one node is stuck in a heavy compaction loop, it can hit 90% CPU, causing subsequent query timeouts.
*Recommended Fixes to Try:*
1. *Increase Buckets:* If your tables have few buckets, recreate them with more buckets (at least 2-4x the number of CNs) to allow better distribution.
2. *Adjust Scheduler Settings:* Try disabling "preferred" cache locality temporarily to see if traffic balances:
```sql
SET GLOBAL enable_schedule_by_cache = false;
3. FE Logs: Look for Drop node <IP> from query as it is not alive in fe.log. This is the smoking gun for heartbeat/K8s networking issues.
References
• knowledge/trouble_shooting/fe_deadlock_problems.md
• deployment/deploy_manually.mdMohan
07/31/2026, 7:54 AMRocky
07/31/2026, 7:55 AMSHOW COMPUTE NODE BLACKLIST;
* What to look for: If you see your other 3 nodes here with AddBlackListType = AUTO, the FE has stopped sending them work.
* Reason: This often happens in K8s if there is intermittent network jitter between the FE pod and CN pods. Restarting the "healthy" node doesn't fix the underlying blacklist state of the others, but restarting the "bad" nodes (or the FE leader) often resets the state temporarily.
2. Check for Compaction Skew
In shared-data mode, the FE schedules compaction tasks on CNs. If one node is assigned a massive compaction task (e.g., for a very large table with many small files), it will saturate its network RX to download data and its CPU to merge it.
* Command: SHOW PROC '/compactions';
* Look for: Check the BackendId or IP column. If almost all active compaction tasks are on that one busy node, it's a compaction hotspot.
* Debug: Check the MaxCS (Max Compaction Score) in information_schema.partitions_meta. If it's very high (>100) for certain partitions, those are triggering heavy compaction.
3. Cache Locality "Hotspots"
StarRocks uses Cache-Aware Scheduling. It prefers to send queries to the node that already has the data in its local disk cache.
* If one node happens to cache a very popular "hot" dataset, the FE will keep sending all queries for that data to that node.
* The node stays busy, caches more data, and attracts even more queries—a feedback loop.
* Test: Disable cache-aware scheduling temporarily to see if traffic balances:
sql
SET GLOBAL enable_schedule_by_cache = false;
4. Tablet/Bucket Distribution
If your tables have a very small number of buckets (e.g., DISTRIBUTED BY HASH(...) BUCKETS 1), StarRocks cannot split the work across multiple nodes.
* Command: SHOW TABLET FROM <table_name>;
* Check: Ensure the number of buckets is at least 2-4x your number of CNs (e.g., 8-16 buckets for a 4-node cluster).
5. Check FE Leader Logs
If the FE is unable to "see" the other nodes for specific query fragments, it will log the reason. Search the FE leader's fe.log for:
* Drop node <IP> from query as it is not alive
* failed to get shards
* ShardManager related errors.
Summary Checklist for you:
1. Run SHOW COMPUTE NODE BLACKLIST;. If nodes are there, check K8s network stability between pods.
2. Run SHOW PROC '/compactions'; to see if that node is overwhelmed by background merges.
3. Check SHOW COMPUTE NODES; and ensure the Alive status is true for all.
4. Try SET GLOBAL enable_schedule_by_cache = false; to force the balancer to ignore the cache and spread the load.
References
• knowledge/admin_and_operation/shared_data_compaction.mdMohan
07/31/2026, 9:34 AMRocky
07/31/2026, 9:35 AMWHERE id = 123), it may only hit 1 tablet, meaning only 1 CN will do 100% of the work. This explains why you see one node at 90% CPU while others are low.
2. Can you increase buckets for an existing table?
In version 4.0.6, you have a few options, but there are limitations for existing partitions in Shared-Data mode:
* For New Partitions: You can change the "default" number of buckets for any future partitions created in that table. This is supported in 4.0.1+:
sql
ALTER TABLE <table_name> DISTRIBUTED BY HASH(<columns>) DEFAULT BUCKETS <new_num>;
* For Existing Partitions:
* Shared-Nothing: Supports ALTER TABLE ... DISTRIBUTED BY ... BUCKETS ..., which triggers a background data reshuffle.
* Shared-Data: As of version 4.0.x, directly altering the bucket count for existing data partitions is often restricted or requires a full table rewrite. If you try to run the ALTER TABLE ... BUCKETS command on an existing partition in shared-data mode and it fails with an "Unsupported" error, the standard workaround is:
1. Create a new table with the correct bucket count (e.g., 8 or 16 buckets for your 4 CNs).
2. Run INSERT INTO new_table SELECT * FROM old_table;.
3. Use ALTER TABLE ... SWAP WITH ... to swap them.
3. Immediate Debugging Steps for your Skew
Since you see traffic pinning to one node, try these steps to verify if cache-locality is the cause:
1. Test Balance (Disable Cache Locality): Run this in your session and check if the load spreads:
sql
SET enable_schedule_by_cache = false;
If the load balances across all nodes, the issue is that your table has too few tablets (3) or a "hot" tablet that all your queries are hitting.
2. Verify Tablet Count:
sql
SHOW TABLETS FROM <table_name>;
Count the number of tablets. If it's 3, you cannot effectively utilize 4 CNs for that table.
3. Check for "Pinned" Nodes: Run SHOW COMPUTE NODE BLACKLIST;. If 3 of your nodes are blacklisted due to network issues, the FE will force all traffic to the only "healthy" node left.
Recommendation
For a 4-node CN cluster, your table should have at least 8–16 buckets (2x to 4x the number of CNs). This allows the FE to distribute fragments more granularly and prevents a single hot bucket from overwhelming a single node.
References
• knowledge/usage/best-practice.md
• table_design/data_distribution/Data_distribution.md
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.md
• faq/shared_data_faq.mdMohan
07/31/2026, 10:02 AMRocky
07/31/2026, 10:02 AMBackendId (Compute Node) is currently assigned to each tablet in a table:
sql
SHOW TABLET FROM <db_name>.<table_name>;
* Result Column: Look at the BackendId column.
* In Shared-Data: This represents the node that the FE has designated to process this tablet (usually for cache locality). If you see the same BackendId repeated for all tablets, it confirms that all traffic for this table is pinned to one node.
2. Check tablet counts per node
To quickly see if the total number of tablets is distributed evenly across all CNs in your cluster:
sql
SHOW COMPUTE NODES;
-- OR --
SHOW BACKENDS;
* Result Column: Look at the TabletNum column.
* Analysis: If one node has a significantly higher TabletNum than others, the FE is concentrating the workload there.
3. Check detailed mapping for a specific tablet
If you have a specific TabletId from a query profile or error log, you can find its location details:
sql
SHOW TABLET <tablet_id>;
This returns a DetailCmd column with a internal path like:
SHOW PROC '/dbs/<db_id>/<table_id>/partitions/<partition_id>/<index_id>/<tablet_id>';
Running that resulting command will show the BackendId currently "owning" that tablet.
4. Check Compaction Task Mapping
If the node is busy with background work (which also follows tablet mapping), check where compaction is happening:
sql
SELECT * FROM information_schema.be_cloud_native_compactions WHERE STATUS = 'OK';
Look at the BE_ID and TABLET_ID columns to see which node is processing which tablet's background merge.
──────────
Why is this happening in your cluster?
If SHOW TABLET FROM <table_name> shows all tablets mapped to one `BackendId`:
1. Too few tablets: If your table only has 1 bucket, it only has 1 tablet per partition. That 1 tablet can only be on 1 node.
2. Node Blacklisting: If the FE perceives other nodes as "unhealthy" (check SHOW COMPUTE NODE BLACKLIST;), it will reassign all tablets to the remaining healthy node.
3. Cache Locality: StarRocks 4.0 tries to keep tablets on nodes where the data is already cached. If one node "won" the race to cache the data, the FE may keep sending work there to avoid a "cache miss." You can test this by setting SET GLOBAL enable_schedule_by_cache = false;.
References
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_COMPUTE_NODES.md
• faq/operation_maintenance_faq.md
• faq/Sql_faq.md
• sql-reference/sql-statements/table_bucket_part_index/SHOW_TABLET.md
• administration/management/resource_management/Replica.mdMohan
07/31/2026, 10:08 AMRocky
07/31/2026, 10:08 AMBackendId and tablet distribution during scaling:
1. Does the BackendNodeId change?
Yes. In shared-data mode, the BackendId you see in SHOW TABLET is a logical assignment made by the FE's Shard Manager. It is not a permanent physical home for the data.
* Scale Down (10 → 2): When you remove 8 nodes, the FE detects they are gone. It must reassign the tablets that were mapped to those 8 nodes to the remaining 2 nodes. The BackendId for those tablets will change to the IDs of the 2 surviving nodes.
* Scale Up (2 → 10): When you add 8 nodes back, the FE (by default) will perform tablet rebalancing. It will move the logical "ownership" of some tablets from the 2 busy nodes to the 8 new nodes to spread the load. The BackendId for many tablets will change again to point to the new nodes.
2. Is there data migration?
No physical data migration occurs. This is the core advantage of shared-data:
* The actual data (S3/OSS/HDFS files) stays exactly where it is in remote storage.
* Only the metadata mapping in the FE changes. This happens in seconds.
* However, the Local Disk Cache will be lost for those tablets. The new node will have to pull the data from remote storage again to fill its local cache, which usually causes a temporary performance dip (increased IOTimeRemote) immediately after scaling.
3. Controlling this behavior
The FE has a specific parameter that controls whether it automatically redistributes these "BackendId" mappings when you scale up:
* Parameter: lake_enable_balance_tablets_between_workers (Default: true).
* If set to true, the FE will ensure that each of your 10 nodes has a roughly equal number of tablets (e.g., if you have 1000 tablets, each node gets ~100).
* If set to false, the FE will not move existing mappings to new nodes automatically. This prevents cache misses on the original nodes but leaves the new nodes idle until you create new data or manually trigger a balance.
4. Why you see "Skew" during scaling
If you scale down to 2 nodes and then scale back to 10, but the BackendId for a table doesn't seem to move to the new nodes:
1. Too few tablets: If your table only has 3 tablets (buckets), only 3 nodes can ever be assigned a BackendId for that table. The other 7 nodes will have 0 tablets for that table.
2. Balancing hasn't finished: The FE moves mappings in background batches. You can check the progress by looking at the TabletNum column in SHOW COMPUTE NODES;.
3. Cache-Aware Scheduling: Even if a tablet is mapped to Node A, StarRocks might try to keep it there if Node A has a "warm" cache.
Summary
When you scale, the BackendId mapping changes automatically to maintain balance. The only "cost" is that the new nodes start with an empty local cache and must download data from remote storage for their first few queries.
References
• deployment/shared_data/feature-support-shared-data.md
• administration/management/resource_management/Replica.md
• data_source/data_cache.md
• introduction/Architecture.mdMohan
07/31/2026, 10:25 AMRocky
07/31/2026, 10:26 AMstarrocks_fe_tablet_num
* Description: Indicates the total number of tablets assigned to each Backend/Compute Node.
* Labels: This metric includes a label (typically backend) that identifies the specific CN host and port.
* Endpoint: http://<FE_IP>:<FE_HTTP_PORT>/metrics (Default port: 8030)
2. How to use it in Prometheus/Grafana
You can query this metric to see the distribution across your nodes. For example:
promql
# Show total tablets per node
starrocks_fe_tablet_num
If you see one node with a much higher value than others, it confirms a data skew or an imbalance in how the FE is assigning shards.
3. Alternative: SQL-based Check
If you want to verify this via SQL (which you can also pull into monitoring tools via SQL exporters), you can query the `information_schema`:
sql
SELECT BE_ID, COUNT(TABLET_ID)
FROM information_schema.be_tablets
GROUP BY BE_ID;
Or use the management command:
sql
SHOW COMPUTE NODES; -- Look at the TabletNum column
Summary for Monitoring
For your Prometheus dashboard, always scrape the FE metrics endpoint for tablet distribution data. While individual CNs (Backends) have their own /metrics endpoints, they primarily report local resource usage (CPU, Memory, Cache hit rates) rather than the global tablet metadata.
References
• administration/management/monitoring/metrics.md
• sql-reference/information_schema/be_tablets.md
• administration/management/monitoring/Monitor_and_Alert.md
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_COMPUTE_NODES.md
References
• administration/management/monitoring/metrics.md
• sql-reference/information_schema/be_tablets.mdMohan
07/31/2026, 11:07 AMRocky
07/31/2026, 11:08 AMstarrocks_fe_tablet_num should still report counts, but it might appear as 0 if the FE hasn't finished the logical assignment or if you are looking at the "shared-nothing" version of the metric.
For Shared-Data, use these alternatives to monitor distribution:
* SQL (Best for accuracy):
sql
SELECT BE_ID, COUNT(*) FROM information_schema.be_tablets GROUP BY BE_ID;
* FE Metric: Check for starrocks_fe_lake_tablet_num (if available in your specific v4.0.x build) or starrocks_fe_tablet_num specifically with the label type="lake".
* Compute Node Metric: On the CNs themselves, monitor starrocks_be_data_cache_bytes_total to see which nodes are actually doing the "reading" and caching.
3. Will increasing buckets to 12 fix it?
Yes, absolutely. This is the recommended fix.
* Redistribution: If you increase buckets to 12, StarRocks will be able to use all 10 nodes in your cluster (each node will handle 1 or 2 tablets). This will resolve the "90% CPU" bottleneck on CN0/CN1 because the processing load will be fanned out.
* How to do it:
* WARNING: In StarRocks Shared-Data (Cloud-native) mode, the ALTER TABLE ... BUCKETS command is not supported in v4.0.6 for data redistribution. It only changes the bucket count for future partitions.
* To redistribute existing data, you must perform a "Reinsert":
sql
CREATE TABLE table_new LIKE table_old;
-- Set the new bucket count
ALTER TABLE table_new DISTRIBUTED BY HASH(...) BUCKETS 12;
-- Migrate data (this rewrites the data into 12 buckets)
INSERT INTO table_new SELECT * FROM table_old;
-- Atomic swap
ALTER TABLE table_old SWAP WITH table_new;
4. Recommendation: Remove "Manual" Bucket Numbers
If you don't want to keep managing this as you scale, use Automatic Bucketing:
1. When creating or altering the table, omit the BUCKETS number:
sql
ALTER TABLE my_table DISTRIBUTED BY HASH(join_key); -- No BUCKETS N
2. StarRocks will then automatically calculate the bucket count based on your current node count and the data volume (targeting ~1GB–10GB per tablet).
3. Note: This "auto" count is set at the time the partition is created. If you scale the cluster significantly later, you still need to use the SWAP method above to "re-bucket" the old data to match your new capacity.
Summary Checklist
1. Check Skew: Run SHOW TABLET FROM <table_name> to confirm all 3 tablets are stuck on CN0/CN1.
2. Verify Scaling: Run SHOW COMPUTE NODES and look at the TabletNum column to see if the nodes you added actually have any work assigned.
3. Fix: Recreate the table with 12+ buckets (or use DISTRIBUTED BY RANDOM if it's a Duplicate Key table) to ensure all 10 nodes can share the load.
ReferencesRocky
07/31/2026, 11:08 AMMohan
07/31/2026, 11:22 AMRocky
07/31/2026, 11:23 AMALTER TABLE handles bucket counts compared to standard clusters.
1. Does it redistribute old data?
No, not automatically in Shared-Data mode.
While StarRocks recently added the ability to alter bucket counts for existing data in "Shared-Nothing" clusters, the documentation explicitly states that Shared-Data mode does not yet support redistributing existing data via the ALTER TABLE command.
If you run:
sql
ALTER TABLE my_table DISTRIBUTED BY HASH(id) BUCKETS 10;
* Result: This will likely return an error or simply fail to trigger any background redistribution for your existing 3 buckets.
* Old Data: Remains stuck in 3 tablets (3 files in S3/OSS), continuing to overload your CN0 and CN1.
* New Data: Even if you change the setting, if the table is not partitioned, new data is appended to the existing 3 tablets.
2. Relation to Partitions
If your table is partitioned (e.g., by date), you have more flexibility:
* Future Partitions: If you run ALTER TABLE my_table DISTRIBUTED BY HASH(id) DEFAULT BUCKETS 10; (available in v4.0.1+), any new partitions created tomorrow will have 10 buckets. Your old partitions (e.g., from yesterday) will still have only 3 buckets.
* Specific Existing Partitions: You can try to alter specific partitions, but again, in Shared-Data mode, the redistribution of existing data files is not supported.
3. How to actually fix the "3 Bucket Skew"
Since your 3 tablets are the bottleneck, the only way to spread that data across your 10 nodes is to rewrite the data into 10 buckets. Use the "Swap" method:
1. Create a temporary table with the correct bucket count:
sql
-- Use 10 or 20 buckets to utilize all 10 CNs
CREATE TABLE table_new LIKE table_old;
ALTER TABLE table_new DISTRIBUTED BY HASH(your_key) BUCKETS 10;
2. Migrate the data (this physically reads the 3 old files and writes 10 new files to remote storage):
sql
INSERT INTO table_new SELECT * FROM table_old;
3. Atomic Swap:
sql
ALTER TABLE table_old SWAP WITH table_new;
DROP TABLE table_new;
4. Recommendation for Scaling
If you plan to scale up and down frequently, avoid hardcoding bucket numbers.
* Use Automatic Bucketing: ALTER TABLE table_new DISTRIBUTED BY HASH(your_key); (omit the BUCKETS keyword).
* StarRocks will automatically choose a bucket count based on your current node count.
* Note: Even with "Auto," it only calculates the number at the moment a partition is created. If you scale from 2 nodes to 10 nodes, you still need to perform the "Swap" or "Reinsert" step above to take advantage of the new nodes for your old data.
Summary
* ALTER TABLE ... BUCKETS 10 will not move your old data from 3 to 10 buckets in Shared-Data mode.
* The "overload" on CN0/CN1 will persist until you use the INSERT INTO ... SELECT method to re-bucket the data.
* Always aim for a bucket count that is a multiple of your node count (e.g., 10, 20, or 30 buckets for 10 nodes).
References
• table_design/data_distribution/Data_distribution.md
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.md
• knowledge/usage/best-practice.md
References
• table_design/data_distribution/Data_distribution.md
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.md
• knowledge/usage/best-practice.mdMohan
07/31/2026, 11:38 AMRocky
07/31/2026, 11:39 AMDISTRIBUTED BY HASH. You cannot use RANDOM distribution for this model.
* Recommendation: Use Automatic Bucketing (omit the BUCKETS keyword).
* Why: When you omit the number, StarRocks automatically calculates it based on your current node count (usually 2x the number of BE/CN nodes for small clusters).
* Is 2x or 4x better? If you plan to autoscale significantly (e.g., from 10 nodes to 40 nodes), manual 4x (e.g., 40 buckets for 10 nodes) is safer.
* Reason: If you have 10 nodes and set 10 buckets, and then scale to 20 nodes, 10 of your new nodes will have zero data and will be idle during scans for that table. Setting 40 buckets ensures that even after scaling to 40 nodes, every node has at least 1 tablet to work on.
2. Duplicate Key Tables (Non-Partitioned)
If your table is a Duplicate Key model, you have two great options for auto-scaling:
* Option A: Distributed by Random (Highly Recommended)
Since v3.2, you can use DISTRIBUTED BY RANDOM with a bucket_size property:
sql
ALTER TABLE my_table SET ("bucket_size" = "1073741824"); -- 1GB per bucket
This is the "ultimate" auto-scaling setting. StarRocks will dynamically increase the number of tablets as your data grows or as you scale your cluster. It removes the need for "2x or 4x" math entirely.
* Option B: 2x–4x Manual Buckets
If you prefer HASH (for join performance/colocation), use 2x–4x your maximum expected node count.
──────────
3. Summary Comparison for Auto-scaling
Scenario | Best Distribution Strategy | Why?
Primary Key Table | HASH(...) (No bucket count) | Uses StarRocks' automatic calculation ($2 \times Nodes$).
Duplicate Key Table | RANDOM + bucket_size | Supports Dynamic Tablet Splitting as data grows.
Expected Huge Scale | HASH(...) BUCKETS 40+ | Ensures high parallelism even after the cluster grows 4x.
4. Important: The "Existing Data" Trap
Even if you change the bucket count to 10, 20, or 40 today using ALTER TABLE, your existing 3 tablets will not split automatically in Shared-Data mode.
The "90% CPU on CN0/CN1" issue will persist for your old data until you rewrite it. You must use the "Swap" method to force the redistribution:
1. CREATE TABLE new_table LIKE old_table;
2. ALTER TABLE new_table DISTRIBUTED BY HASH(...) BUCKETS 20; (or omit BUCKETS for auto).
3. INSERT INTO new_table SELECT * FROM old_table;
4. ALTER TABLE old_table SWAP WITH new_table;
Final Advice
For your Primary Key tables, use Automatic Bucketing (don't specify a number). If you find that the auto-calculated number is too small for your future scaling needs, manually set it to 4x your current node count. This provides a good balance between "parallelism for queries" and "metadata overhead for the FE."
References
• table_design/data_distribution/Data_distribution.md
• best_practices/bucketing.md
• table_design/table_types/primary_key_table.md
References
• best_practices/primarykey_table.md
• table_design/table_types/primary_key_table.md
• best_practices/bucketing.mdMohan
08/01/2026, 9:38 AMRocky
08/01/2026, 9:39 AMenable_tablet_internal_parallel=true), which allows multiple threads to scan a single tablet. This means you no longer need hundreds of tiny tablets to get high CPU utilization.
2. How many tablets can your cluster handle?
The limit on the number of tablets is usually dictated by the FE (Front-End) memory, not the CN (Compute Node) memory.
* Total Cluster Capacity: With a standard FE configuration (16GB RAM for FE), StarRocks can comfortably manage up to 1 million tablets across the entire cluster.
* Per Node Capacity: For your 16 vCPU / 100GB nodes, each node can easily handle 10,000+ tablets without significant overhead.
* The "Goldilocks" Zone: For a 6-node cluster, aim for 12 to 30 tablets per table (or per partition).
* Minimum: 6 tablets (so every node does at least some work).
* Recommended: 12–24 tablets (2x to 4x the node count). This allows for better distribution and accommodates future scaling to 10 or 12 nodes without needing to re-bucket immediately.
3. Why your 3 tablets are causing 90% CPU on CN0/CN1
In a Shared-Data architecture, even though data is in S3/Object Storage, the Compute Node assignment is 1:1 with tablets for a specific query fragment.
* With only 3 tablets, only 3 nodes can ever participate in a scan for that table.
* The other 3 nodes in your 6-node cluster will sit idle (0% CPU) while CN0, CN1, and CN2 are hammered at 90%+.
* Because the FE tries to maintain "Data Cache locality," it will repeatedly send those 3 tablets to the same nodes that already have the data cached. This creates the "hot node" effect you are seeing.
4. Recommendation for your setup
To fix the overload and timeouts on your 16vCPU nodes:
1. Re-bucket to 12 or 24: This ensures all 6 nodes (and their 16 vCPUs) can process the data in parallel.
2. Enable Parallel Scan: Ensure SET GLOBAL enable_tablet_internal_parallel = true; is on. This allows each node to use multiple cores to scan its assigned tablets.
3. Use Automatic Bucketing: If you don't want to calculate this manually, define your table without a bucket number:
sql
ALTER TABLE my_table DISTRIBUTED BY HASH(join_key); -- Omit BUCKETS X
StarRocks will automatically choose a number (typically $2 \times Nodes$) based on your cluster size at that moment.
Summary: Your cluster can handle hundreds of thousands of tablets, but your performance issue is caused by having too few (3). Increase to 12–24 to distribute the 90% CPU load across all 6 nodes.
References
• table_design/data_distribution/Data_distribution.md
• faq/Deploy_faq.md
• faq/shared_data_faq.md nodes.md)6 nodes.
References
• faq/Deploy_faq.md
• faq/Others.md
• administration/management/BE_configuration.mdMohan
08/01/2026, 9:45 AMRocky
08/01/2026, 9:45 AMDISTRIBUTED BY RANDOM, StarRocks can split tablets if they grow too large (provided you set a bucket_size), but it cannot shrink/merge them back.
* Auto-Increase: As data grows, 1 tablet becomes 2, then 4.
* No Auto-Decrease: If you delete 90% of the data, those 4 tablets will remain as 4 small tablets forever.
Summary Comparison
Action | Hash Distribution (Primary/Unique/Agg) | Random Distribution (Duplicate Key only)
Initial Count | Fixed at creation (Auto-chosen or manual). | Fixed at creation (Auto-chosen or manual).
Automatic Split | No. | Yes (if bucket_size is set and data grows).
Automatic Merge | No. | No.
Cluster Scaling | Tablets move nodes; count stays the same. | Tablets move nodes; count stays the same.
Recommendation
If you accidentally created a table with too many tablets (e.g., you created a table on a 100-node cluster and now only have 3 nodes), you must manually fix it using the Swap method:
1. Create a new table with a lower bucket count.
2. INSERT INTO new_table SELECT * FROM old_table;
3. ALTER TABLE old_table SWAP WITH new_table;
This rewrite is the only way to physically reduce the number of tablets in StarRocks.
References
• table_design/data_distribution/Data_distribution.md
• best_practices/bucketing.md
• administration/management/compaction.md
References
• knowledge/admin_and_operation/shared_data_compaction.md
• administration/management/compaction.mdMohan
08/01/2026, 10:27 AMRocky
08/01/2026, 10:27 AMbucket_size property behaves differently depending on the table model and distribution type. Here is the breakdown:
1. It only works for "Random Distribution" (Duplicate Key Tables)
The bucket_size property was introduced in v3.2 specifically for Duplicate Key tables using DISTRIBUTED BY RANDOM.
* How it works: It acts as a trigger for dynamic splitting. If you set bucket_size = 1GB, StarRocks monitors the data volume during loading. When the data in a partition grows, StarRocks will automatically increase (split) the number of buckets to try and keep each tablet around that 1GB target.
* Is it a hard limit? No. It is a "soft target." Because data is loaded in batches, a tablet might temporarily grow to 1.1GB or 1.2GB before the system triggers the creation of new buckets for subsequent data.
2. It does NOT work for "Hash Distribution" (Primary/Unique/Aggregate)
If you use DISTRIBUTED BY HASH, the bucket_size property is ignored.
* In Hash tables, the number of buckets is fixed when the partition is created.
* If you omit the bucket count (Automatic Bucketing), StarRocks calculates a fixed number (e.g., 20) based on your node count at that moment.
* The Problem: If that partition later grows to 100GB, those 20 tablets will each become 5GB. They will not split into more tablets just because they crossed a 1GB threshold.
3. Comparison of "Auto" Behaviors
Feature | Hash Distribution (Primary Key) | Random Distribution (Duplicate Key)
Initial Count | Auto-calculated (e.g., $2 \times Nodes$). | Auto-calculated.
Dynamic Splitting | No. Count is fixed for that partition. | Yes. If bucket_size is set.
Tablet Size | Grows indefinitely as you add data. | Stays close to bucket_size by adding buckets.
Best for Scaling | Good, but requires manual re-bucketing later. | Excellent. Perfectly handles data growth and node scaling.
Summary Recommendation
* For Duplicate Key tables: Always use DISTRIBUTED BY RANDOM and set PROPERTIES("bucket_size" = "1073741824"). This is the most "hands-off" way to manage scaling.
* For Primary Key tables: You cannot use bucket_size. You should either use the default Automatic Bucketing (which scales with the number of nodes) or manually set a high bucket count (e.g., 4x your node count) to allow for future data growth without tablets becoming too huge (aim for 1GB–10GB per tablet).
References
• table_design/data_distribution/Data_distribution.md
• sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE.md
• best_practices/bucketing.md
References
• table_design/data_distribution/Data_distribution.md
• best_practices/bucketing.md
• knowledge/usage/best-practice.md
• faq/operation_maintenance_faq.mdMohan
08/01/2026, 10:40 AMRocky
08/01/2026, 10:41 AMBuckets = 2 * X
* If $12 < X \le 24$: Buckets = 1.5 * X
_ _(where $X$ is the number of Alive Compute/BE nodes)*
In your scenario:
* $X = 3$ (Alive nodes)
_ $3 \le 12$, so Buckets = 2 _ 3
* Result: 6 Tablets (Buckets)
2. Why it uses Alive nodes
When you execute CREATE TABLE, the Front-End (FE) must immediately assign the new tablets to active nodes to initialize them. It ignores nodes in a Dead or Offline state to ensure the table creation doesn't fail or wait for timed-out nodes.
3. Important Consequences
* Performance Bottleneck: If you later bring the other 3 nodes back online (restoring your 6-node cluster), the table you created will still have only 6 tablets.
* Query Impact: With 6 nodes and 6 tablets, you have a 1:1 ratio. This means each node handles exactly 1 tablet. If you increase your cluster to 12 nodes later, 6 of those nodes will sit completely idle during scans for this table because there are no tablets for them to process.
* The "3 Tablet" trap: If you had only 1 node alive and created the table, it would have created only 2 tablets. Even when you fixed the cluster, that table would be stuck at a very low level of parallelism.
Recommendation
If you know your cluster is currently degraded but will eventually have 6 or more nodes, do not use automatic bucketing while nodes are down. Instead, manually specify the count:
sql
DISTRIBUTED BY HASH(pk_column) BUCKETS 12; -- or 18/24 for better headroom
This ensures that once your nodes are healthy, the table is already optimized to use the full power of all 6 nodes (and allows for future growth).
References
• table_design/data_distribution/Data_distribution.md
• knowledge/usage/best-practice.md
• sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE.md
References
• knowledge/usage/best-practice.md
• table_design/data_distribution/Data_distribution.mdMohan
08/03/2026, 11:18 AMRocky
08/03/2026, 11:18 AMDISTRIBUTED BY HASH(id) BUCKETS 20) so that every partition is identical regardless of the cluster state at that moment.
References
• knowledge/usage/best-practice.md
• table_design/data_distribution/Data_distribution.md
• sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE.md
References
• table_design/data_distribution/Data_distribution.md
• knowledge/usage/best-practice.md
• best_practices/bucketing.mdMohan
08/03/2026, 11:24 AMRocky
08/03/2026, 11:24 AMuser_id, order_id, device_sn).
* Use Composite Distribution Keys: If a single column has some "hot" values (e.g., a specific city_id that has 50% of your traffic), distribute by multiple columns: DISTRIBUTED BY HASH(city_id, user_id). This mixes the data more thoroughly. (Limit this to 2-3 columns for join efficiency).
* Avoid "Default" Values: If your distribution key often contains 0, -1, or NULL, all those rows will land in the same bucket. Filter these out or use a more specific key.
* Modify Keys After Creation: Since v3.2, you can change the distribution columns of an existing table using ALTER TABLE. If you realize your initial choice was bad, you can fix it without recreating the table.
2. Decision Logic for Buckets
For PK tables, you have two choices: Automatic or Manual.
A. When to use Automatic Bucketing (Recommended)
Use this if you are unsure of your final data volume or if your cluster size might change.
* How it works: StarRocks calculates the bucket count based on the number of Alive BE nodes and the data volume of the last 5 partitions.
* Limitation: If a single partition is expected to exceed 100GB, StarRocks recommends switching to Manual bucketing for better control.
B. When to use Manual Bucketing
Use this for large-scale production tables where performance must be predictable.
* The "Size" Rule: Aim for 100MB to 1GB per tablet (after compression). Tablets larger than 10GB can cause slow compactions and long recovery times.
* The "Parallelism" Rule: Set the bucket count to a multiple of your BE node count (e.g., $2\times$ or $4\times$ the number of BEs). This ensures every node participates equally in a scan.
_ _Example:* For a 6-node cluster, use 12, 18, or 24 buckets.
* The "High-Concurrency" Exception: If you have thousands of small queries per second (point lookups), fewer buckets are better because they reduce the "fan-out" overhead across the cluster.
3. How to Detect Skew
If you suspect skew, run this command:
sql
SHOW TABLETS FROM my_table;
Look at the DataSize column. if some tablets are 10GB and others are 100MB, you have a skew problem. You should then consider changing your distribution keys to higher cardinality columns.
Summary Checklist for PK Tables
Goal | Strategy
Prevent Skew | Use high-cardinality columns (IDs/UUIDs) as distribution keys.
Optimize Parallelism | Set buckets to $2\times$ or $4\times$ the number of BE nodes.
Manage Size | Keep tablets between 100MB and 1GB.
Flexible Growth | Use Automatic Bucketing unless a partition exceeds 100GB.
References
• table_design/data_distribution/Data_distribution.md
• best_practices/bucketing.md
• table_design/table_types/primary_key_table.md
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.md
References
• table_design/data_distribution/Data_distribution.md
• best_practices/bucketing.mdRocky
08/03/2026, 11:24 AMMohan
08/03/2026, 12:57 PMRocky
08/03/2026, 12:58 PMDISTRIBUTED BY HASH(...) BUCKETS 30, then the merged partition will have 30 buckets.
* It does not double. A partition is a physical container. When you merge Partition A (30 buckets) and Partition B (30 buckets), StarRocks creates a new Partition C and re-shuffles all data from A and B into the buckets of C.
* Because your table definition specifies 30 buckets, every new partition created—including those created by a merge operation—will strictly follow that rule.
2. If you are using Automatic Bucketing
If you created the table without specifying the number of buckets (letting StarRocks decide), the behavior is more dynamic:
* Recalculation: StarRocks treats the merge as the creation of a brand-new partition. It will calculate the bucket count based on the total data volume of the partitions you are merging.
* Result:
* If the merged data is still relatively small, it might stay at the same bucket count (e.g., 30).
* If the merged data volume is significantly larger (e.g., you merge 30 small partitions into one large one), StarRocks may increase the bucket count for that monthly partition to keep tablet sizes within the healthy range (100MB–1GB).
* It will never simply "double" (30+30=60) unless the data volume calculation happens to land exactly on that number.
Summary
Configuration | Original Partitions | Result of Merge
Fixed Buckets (30) | 30 buckets each | 30 buckets
Automatic Bucketing | 30 buckets (based on daily volume) | Recalculated (often higher if volume is large)
Pro-Tip for Merging
If you are merging partitions because the initial ones were "very small" (as you mentioned), the Fixed 30 count is likely perfectly fine.
However, if the merged monthly partition becomes very large (e.g., >100GB), you should check the tablet size after the merge:
sql
SHOW TABLETS FROM my_table;
If the tablets in the new partition are exceeding 10GB, you may want to manually increase the bucket count for that specific partition after the merge:
sql
ALTER TABLE my_table PARTITION p_monthly
DISTRIBUTED BY HASH(key) BUCKETS 60;
References
• table_design/data_distribution/expression_partitioning.md
• table_design/data_distribution/Data_distribution.md
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.md
References
• table_design/data_distribution/expression_partitioning.md
• table_design/data_distribution/Data_distribution.md
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.md
• knowledge/usage/best-practice.md
• best_practices/bucketing.md
References
• table_design/data_distribution/Data_distribution.md
• faq/operation_maintenance_faq.mdRocky
08/03/2026, 1:19 PMMohan
08/03/2026, 1:19 PMRocky
08/03/2026, 1:20 PMuser_id, order_id) as distribution keys.
* Subset of PK: The DISTRIBUTED BY HASH(...) columns must be a subset of the columns defined in your PRIMARY KEY.
* Avoid Skew: If one value (like a "default" ID or a very large tenant) appears in 20% of your rows, do not use that column alone for distribution. Use a composite key like HASH(tenant_id, order_id).
* Automatic Bucketing: For tables where you aren't sure of the volume, StarRocks (v2.5.7+) can set buckets automatically. However, for large production tables (>100GB/partition), manual bucketing is still recommended for better control.
3. Node Capacity: 16 vCPU & 96 GB RAM
Your node is a solid "standard" production specification. Here is how it handles tablets efficiently:
* Efficient Tablet Range: A node of this size can typically handle 10,000 to 30,000 tablets comfortably.
* Factors Limiting Efficiency:
* Memory (96GB): PK tables are memory-hungry. Each tablet requires memory for the Primary Key Index (especially if not using Persistent Index on SSD) and Memtables during ingestion. If you have too many tablets (e.g., >50k), the metadata and index overhead will eat into your query memory.
* CPU (16 vCPU): CPU is consumed by Compaction. Every tablet eventually needs "cumulative" and "base" compactions. Having 100,000 small tablets will cause "compaction storms," where the CPU is 100% utilized just merging small files, causing query latency to spike.
* Metadata: Excessive tablets increase the burden on the FE (Frontend). For a cluster with 16GB RAM on the FE, you should keep the total tablet count (sum across all BEs) under 1 million.
Summary Checklist for your 16vCPU / 96GB Node:
* Aim for tablet sizes of ~1GB to keep the total count low.
* Target <20,000 tablets per BE to ensure background tasks (compaction/checksums) don't starve your queries of CPU.
* If you see memory issues: Check tablet_meta and PK index memory usage. If it's high, you likely have too many small tablets and should increase your bucket size (reduce bucket count) for new partitions.
References
• best_practices/bucketing.md
• faq/Deploy_faq.md
• table_design/data_distribution/Data_distribution.md
• administration/management/BE_configuration.md
References
• faq/Deploy_faq.md
• administration/management/BE_configuration.md
• faq/Others.mdRocky
08/03/2026, 1:20 PM