Santosh Kumar Katkam
06/30/2026, 5:43 PMRocky
06/30/2026, 5:44 PMCREATE TABLE, INSERT into internal tables, or schema changes) are handled by the Leader. Even if a connection hits a Follower pod, the request is forwarded to the Leader. If your load is primarily write-heavy metadata operations, the Leader will naturally be busier.
* Sticky Connections/Long-lived Sessions: Kubernetes Service (ClusterIP/LoadBalancer) typically balances connections, not individual queries. If a client (like a BI tool or a long-running application) opens a connection and keeps it open for hours, all queries on that connection will stay on the same FE pod.
* Service Routing Policy: In Kubernetes, if you use a Service to access FEs, the default load balancing is performed by kube-proxy (via iptables/ipvs), which might not always distribute connections perfectly evenly, especially with low connection counts.
2. Where to check
You can verify the status and connection distribution using these commands:
* Check FE Roles: Run SHOW FRONTENDS; in your SQL client. Look at the IsLeader column to see which pod is the Leader.
* Check Connection Count: You can check how many connections are active on each FE by running:
sql
SHOW PROCESSLIST;
To see the total connections per FE, you would need to run this on each specific FE pod (or check your monitoring dashboard like Grafana if you have the StarRocks Prometheus exporter set up).
3. How to spread the load
To achieve a more even distribution, consider these configurations:
A. Use a SQL Proxy (Recommended for Production)
The most robust way to balance FE load is to deploy ProxySQL or F5/Nginx in front of your FE pods. ProxySQL is specifically aware of the MySQL protocol and can perform:
* Query-level load balancing: Distributing individual queries rather than just TCP connections.
* Read/Write splitting: Automatically sending write queries to the FE Leader and read queries to Followers/Observers.
B. JDBC Load Balancing
If your application uses Java, you can configure the JDBC connection string to balance load across all FE IPs:
sql
jdbc:mysql:<loadbalance://fe1_ip:9030,fe2_ip:9030,fe3_ip:9030/db_name?loadBalanceStrategy=random>
C. Kubernetes Service Tuning
If you are using a Kubernetes Service:
* Check Session Affinity: Ensure service.spec.sessionAffinity is set to None (default). If it is set to ClientIP, the same client will always hit the same FE.
* External Traffic Policy: If using a LoadBalancer type, setting externalTrafficPolicy: Local can sometimes cause imbalance depending on how nodes are weighted; Cluster is generally more balanced but adds a hop.
D. FE Configurations
There aren't many "balancing" knobs inside fe.conf, but you can check:
* `forward_to_leader`: This is true by default. It ensures Follower FEs can handle write requests by forwarding them. Disabling this would cause writes to Followers to fail, which is not recommended.
For further investigation, I recommend checking the StarRocks Grafana dashboard (specifically the FE tab) to see if the imbalance is in CPU, Memory, or just Query Count. If it's just Query Count, a proxy layer is your best solution.
References
• quick_start/helm.md
• administration/management/resource_management/Load_balance.mdRocky
06/30/2026, 5:44 PM