question

an.leopardi_173590 avatar image
an.leopardi_173590 asked Erick Ramirez answered

How many control connections should the driver start?

Hey all, first time posting here! I’m the co-author of Xandra, the Cassandra driver for the Elixir programming language.

The driver has been around for a few years but I’m working on some improvements around cluster management. Historically, we opened one control connection for each node in the cluster and listened to status/topology change events from all of those. I have noticed that in the Python and Ruby drivers, however, there's only one single control connection connected to a single node. If the connection goes down, then the control connection tries other nodes. The single control connection queries the node it's connected to for info about the cluster topology and listens to events from that node.

Is this the way to go? Are there downsides to opening more than one control connections?

(Obligatory preemptive apology in case this was already asked or this isn't the right space to ask such a question. I searched the forum for a bit but couldn't quite find anything.)

driver
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

You are correct. One control connection to a node in the local DC is enough for the driver to manage connections and listen to cluster events. This is the same for all the drivers maintained by DataStax.

If the driver loses the control connection, it should be quick and simple to establish a new control connection to another node in the local DC so it's not necessary for the driver to have to maintain multiple control connections. If there is an issue starting a new control connection (for whatever reason) then it needs to be investigated by an operator rather than an issue for the driver to handle because opening a control connection should be easy for the driver.

Off the top of my head, the only downside I can think of for opening multiple control connections is the overhead on the driver for having to maintain multiple connections. Cheers!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.