Jonathan Wills
02/12/2026, 7:49 PMRocky
02/12/2026, 7:49 PMcpu_weight and a dedicated memory slice to ensure speed.
sql
CREATE RESOURCE GROUP rg_interactive
TO (role='interactive_role') -- or specific users
WITH (
'cpu_weight' = '8', -- High priority relative to others
'mem_limit' = '0.3', -- 30% of total memory (~9.6GB)
'concurrency_limit' = '50' -- Allow high concurrency for small queries
);
2. Ingestion (INSERT/DELETE)
Ingestion is critical but can usually tolerate slightly more latency than a dashboard query. We cap the memory to prevent OOMs during heavy write bursts.
sql
CREATE RESOURCE GROUP rg_ingestion
TO (query_type IN ('insert', 'delete'))
WITH (
'cpu_weight' = '2', -- Lower priority than interactive
'mem_limit' = '0.2', -- 20% of memory (~6.4GB)
'concurrency_limit' = '10' -- Prevents too many parallel write transactions
);
3. APIs & Data Exports
These are often "medium-weight" queries. We limit concurrency here because a single large export can easily saturate the 8-core CPU or the network.
sql
CREATE RESOURCE GROUP rg_api_export
TO (user='api_service_user')
WITH (
'cpu_weight' = '4', -- Medium priority
'mem_limit' = '0.2', -- 20% of memory (~6.4GB)
'concurrency_limit' = '5', -- Strict limit to prevent bulk exports from piling up
'spill_mem_limit_threshold' = '0.7' -- Enable intermediate spilling to disk if memory is tight
);
4. Long-running Processes (Up to 10 mins)
For processes taking up to 10 minutes, you must prevent them from occupying all 8 cores simultaneously. We use big_query_cpu_second_limit to allow them to run long, but keep concurrency_limit very low.
sql
CREATE RESOURCE GROUP rg_long_tasks
TO (role='batch_process_role')
WITH (
'cpu_weight' = '1', -- Lowest priority; gets "leftover" CPU
'mem_limit' = '0.3', -- 30% of memory (~9.6GB)
'concurrency_limit' = '2', -- ONLY allow 1 or 2 at a time on an 8-core node
'big_query_cpu_second_limit' = '1200' -- 20 minute limit (600s is 10 min, 1200s adds safety)
);
Key Recommendations for your m8gd.2xlarge setup:
1. CPU Scheduling: StarRocks uses cpu_weight for relative scheduling. If rg_interactive and rg_long_tasks are running at the same time, the interactive group will get 8/9ths of the CPU cycles (8 weight vs 1 weight).
2. Memory Management: On a 32GB node, roughly 28GB is available for the StarRocks process. Totaling your mem_limit percentages to 1.0 (100%) is fine, as StarRocks handles the internal allocation.
3. Spilling: For your APIs/Data Exports, I added 'spill_mem_limit_threshold' = '0.7'. This is crucial for an 8-core/32GB node; if an export query exceeds 70% of its allocated group memory, it will spill to the local NVMe disk (provided by the m8gd instance) instead of failing with an "Out of Memory" error.
4. Monitoring: Use the following command to see how your groups are performing:
sql
SELECT * FROM information_schema.resource_group_usage;
5. Query Queuing: If you want queries to wait instead of failing when the concurrency_limit is hit, ensure global queuing is enabled in your FE config (enable_query_queue = true).
ReferencesJonathan Wills
02/12/2026, 7:54 PMRocky
02/12/2026, 7:54 PMJonathan Wills
02/12/2026, 7:56 PMRocky
02/12/2026, 8:16 PMconcurrency_limit)
Should they change? Yes (Increase them).
The concurrency_limit in a resource group is an integer value that defines the maximum number of concurrent queries allowed for that group.
* Why: In StarRocks, most queries run across all available nodes. If you have a limit of 10 and you double your nodes from 4 to 8, the system is now twice as powerful, but the resource group will still only allow 10 concurrent queries to start.
* Action: If your goal for scaling is to support more simultaneous users, you should increase (e.g., double) the concurrency_limit. If you don't, the extra nodes will make individual queries faster, but you won't be able to run more of them at the same time.
2. Resource Quotas (cpu_weight and mem_limit)
Should they change? Usually No.
These parameters are relative or percentage-based, so they "auto-scale" in terms of absolute resources as you add nodes:
* `mem_limit`: This is a percentage (e.g., 0.5 for 50%). If you add more nodes, the resource group still gets 50% of each node. Because you have more nodes, the total cluster memory available to that group increases automatically.
* `cpu_weight`: This is a relative priority (e.g., Group A has weight 10, Group B has weight 20). This ratio remains valid regardless of how many nodes you have.
3. CPU Core Limits (max_cpu_cores and exclusive_cpu_cores)
Should they change? Depends on node specs.
* `max_cpu_cores`: This limit is applied per BE/CN node. If you set this to 8, every node in the cluster (including new ones) will limit that resource group to 8 cores.
* Action: You only need to change this if your new CN nodes have a different number of cores than your old ones, or if you want to change the "size" of a query "slot" on a per-node basis.
4. Big Query Limits (big_query_scan_rows_limit, etc.)
Should they change? Usually No.
These are "guardrail" limits designed to kill runaway queries.
* `big_query_scan_rows_limit`: This is the maximum rows a query can scan on a single node. When you add more nodes, the data is distributed more thinly. A query that used to scan 100M rows on one node might now scan 50M rows on two nodes.
* Result: These limits actually become "safer" (harder to hit) as you scale out, so you typically don't need to change them unless you are trying to tighten restrictions.
Summary Table
Parameter | Type | Scaling Action
concurrency_limit | Absolute Integer | Increase to allow more simultaneous queries.
mem_limit | Percentage | Keep same. (Total memory grows with node count).
cpu_weight | Relative Ratio | Keep same.
max_cpu_cores | Per-node Integer | Keep same (unless new hardware has more cores).
big_query_... | Per-node Limit | Keep same (becomes less restrictive as data spreads).
Note for v3.1.4+: StarRocks introduced collective concurrency management where the Leader FE manages the queue. Even with this centralized management, the concurrency_limit is the threshold the FE uses to decide when to queue. Therefore, you still must increase this number to allow the FE to let more queries through to your new CNs.
References
• administration/management/resource_management/query_queues.md
• faq/operation_maintenance_faq.md
• administration/management/resource_management/resource_group.md