Does Stargate load balance the requests sent to it by default?


  • Single datacenter with 3 racks and with replication of 3 on a key space
  • 3 stargate instance
  • 2 application services which use stargate api to access cassandra

When requests are sent to the application, I dont see requests distributed to 3 stargate instances equally? Infact one of the stargate does not get any requests.

Is there any additional configuration to do this ? Also, is there any mapping between cassandra nodes and stargate nodes (say stargate-1 always sends requests to cassandranode-1)

1 Like

Thanks for the excellent question. I assume that clients would connect to the cluster through a K8s service but I don’t have a definite answer for you so I’ve reached out to the team to get them to respond to you directly. Cheers! :beers:

Hi @Preetam,

if you access Stargate through the corresponding service (--stargate-service) then calls will get load balanced between the existing Stargate pods.
If you use one of the DataStax CQL drivers, the service will be used as contact point and then the driver will discover all the Stargate nodes and handle the load balancing by itself.
If one of the Stargate nodes isn’t getting any traffic, then maybe there’s a problem with the list of peers that some Stargate nodes see.

Could you confirm which API you’re using to communicate with Stargate (CQL, CQL over REST, GraphQL, Document)?
Could you indicate which connection settings you’re using to interact with Stargate?

Thanks @alexander ,

I am using service to call stargate. W.r.t to API I am using Document API.
Also by default, how does stargate make call to cassandra. Does stargate1 always call cassandra-1 ? Is there any mapping or does it use any service from cassandra to make request

Hi @Preetam,

there’s no direct association between a Stargate node and a Cassandra node. stargate-1 can coordinate calls involving any other cassandra node.
It’s definitely weird that one of the stargate instances isn’t getting any traffic, especially if you’re going through the stargate service (--stargate-service) which is handling the load balancing natively :thinking:
Are you accessing Stargate through this service?
How do you measure the calls that each stargate pod is getting?
Could you maybe share your K8ssandraCluster manifest or helm values files so that we can take a look at it, along with some metrics that are supporting your observations?
One thing that would be interesting to try is to shrink the number of Stargate instances to 2, check how the load distributes, and then scale out again to 3 instances and check again.