Arun Krishna
07/29/2026, 5:00 AMRocky
07/29/2026, 5:01 AMTotal Cores / Concurrent Queries doesn't drop too low.
* Recommendation: Start with a cluster of at least 10–15 BE/CN nodes, each with 32 or 64 vCPUs.
* Memory: Ensure each BE has at least 128GB–256GB RAM to handle the execution state and Page/Query caches for 2,000 concurrent sessions.
2. Key Performance Tuning (Session Variables)
To allow the system to handle many queries without context-switching overhead:
* Set pipeline_dop = 1: By default, StarRocks tries to use half the available CPU cores for a single query. For 2,000 parallel queries, you must set pipeline_dop = 1 (globally or per session) to reduce the number of threads per query, allowing more queries to run simultaneously without exhausting the thread pool.
* Enable Query Cache: High concurrency often involves repetitive or similar complex aggregations.
sql
SET GLOBAL enable_query_cache = true;
* Connection Limits: Ensure the FE can accept enough connections.
* qe_max_connection (FE config): Default is 4096; ensure it is set higher than your expected connection peak.
* max_user_connections (User property):
sql
ALTER USER 'your_user' SET PROPERTIES ("max_user_connections" = "3000");
3. Resource Management & Queuing
Trying to execute exactly 2,000 at the same millisecond can crash a cluster if they are truly "complex." Use Query Queues to smooth out spikes:
* Enable Query Queues:
sql
SET GLOBAL enable_query_queue_select = true;
SET GLOBAL query_queue_concurrency_limit = 2000; -- Max parallel running on BE
* Resource Groups: Create a specific resource group for these queries to isolate them from other workloads (like data loading).
4. System/OS Level Configurations
High concurrency requires the OS to support a large number of threads and file descriptors:
* vm.max_map_count: Set to 262144.
* kernel.threads-max: Set to 120000.
* kernel.pid_max: Set to 200000.
* brpc_connection_type: In the be.conf, set brpc_connection_type = pooled to improve RPC efficiency under high pressure.
Summary Checklist
Component | Recommendation
FE Nodes | 3 Followers + 3 Observers
BE/CN Nodes | 10+ nodes (32+ cores each)
Concurrency Variable | SET GLOBAL pipeline_dop = 1;
Queuing | Enable query_queue_select to protect the cluster.
Network | Use a Load Balancer (F5/Nginx/HAProxy) to distribute connections across FEs.
Note: "Complex" queries are subjective. If your queries involve massive joins or window functions, you may need to increase the BE node count further. It is highly recommended to perform a stress test using a tool like JMeter or a custom script to find the saturation point of your specific hardware.
References
• using_starrocks/caching/query_cache.md
• best_practices/query_tuning/query_planning.mdRocky
07/29/2026, 5:01 AMqe_max_connection parameter in fe.conf (default is 4096) to at least 10,000 or more per FE to accommodate the 20,000 parallel connections.
* Load Balancing: Use a proxy like ProxySQL, Nginx, or F5 in front of the FEs to distribute the 20,000 connections evenly across all FE nodes.
2. Performance Tuning: The "Concurrency Mode"
For massive concurrency, you must prevent a few queries from hogging all CPU cores.
* Pipeline DOP: Set pipeline_dop = 1.
* By default, StarRocks tries to use many cores for a single query. In high-concurrency scenarios, this causes massive context switching. Setting pipeline_dop to 1 forces each query to use fewer resources, allowing the CPU to handle more queries in parallel.
* SET GLOBAL pipeline_dop = 1;
* Query Cache: Enable the Query Cache. If these 20,000 queries have repetitive patterns or share intermediate results, the Query Cache can improve efficiency by 3x to 17x.
* SET GLOBAL enable_query_cache = true;
* Page Cache: Ensure the BE Page Cache is large enough to keep the entire 22M row table in memory to avoid disk I/O.
3. Resource Management & Protection
To prevent a "thundering herd" from crashing the cluster, use Resource Groups and Query Queues.
* Query Queues: Enable global query queuing to buffer requests if the CPU or memory hits a saturation point.
* SET GLOBAL enable_query_queue_select = true;
* SET GLOBAL query_queue_concurrency_limit = 1000; (Set this based on your BE capacity).
* Resource Groups: Create a specific resource group for these queries with a strict concurrency_limit to ensure other system tasks (like data loading) still have resources.
4. Hardware Estimation
While the "complex" nature of your queries determines the exact core count, you can use this rough capacity planning formula:
$$Estimated\ Cores = \frac{\text{Scan Rows} / \text{Cores Processing Power}}{\text{Response Time}} \times \text{QPS}$$
* Estimated BE Nodes: For 20,000 QPS on 22M rows, assuming each query takes roughly 200ms–500ms of CPU time, you would likely need a cluster of 20 to 40 BE nodes, each with 32 or 64 cores.
* Memory: 22M rows is small, so 128GB RAM per BE is more than sufficient, provided you focus on CPU-intensive instances (e.g., AWS c6g or c7g).
5. Essential OS-Level Limits
Modify /etc/sysctl.conf and /etc/security/limits.conf on all nodes to support the high number of threads and sockets:
* vm.max_map_count = 262144
* kernel.threads-max = 120000
* kernel.pid_max = 200000
* net.core.somaxconn = 1024 (or higher)
Recommendation: Start with 5 FE Observers and 20 BE nodes (32-core each), set pipeline_dop = 1, and use a Load Balancer. Monitor the fe_connection_total and be_cpu_utilization metrics to scale further.
References
• administration/management/BE_configuration.md
• faq/Sql_faq.md
• faq/Deploy_faq.mdRocky
07/29/2026, 5:01 AM