Does the LoadBalancer need to be 'sticky'?

sql
deployment

(Guru) #1

I am using the Digital Ocean based CDB setup and evaluating to see if CDB will be good for our needs. I have been able to configure everything - A question on the load balancer configuration - Does it need to be sticky? (Am yet to write programs after this configuration, but am already thinking of how a transaction with multiple DB create/update statements will work since the load balancer is on a round robin algorithm).

Any help/clarity is appreciated.

~guru.


(Taylor Wrobel) #2

Hey there guru,

Nope, the load balancer doesn’t need to be sticky. In fact, if you use the cockroach gen haproxy command, you’ll notice that it generates an HAProxy config with the balancing algorithm set to round robin by default.

The reason that the case of multiple create/update statements isn’t a problem with round robining is because the statements run are separate from the connection to the DB. The establishment of the initial connection is what your load balancer is round robin-ing. All of the commands you run as part of a transaction are executed as part of the same client session, which is all going over the same connection.

The client isn’t re-establishing a connection to the database for each command you run as part of a transaction, which would cause the issue you are concerned about.


(Guru) #3

Thanks for your quick reply, that helps in getting a good picture of the connections and statements in CDB.