Hello, we are using Cassandra as a data storage for some time without problems, but during testing we've found out that creating a session always takes very long time, always around 21s. We create one session per keyspace and cache result in memorycache, so after creating there's no trouble while cache holds.
We use CassandraCSharpDriver 3.19.5 within .NET 6 WebApi which provides access to stored data. We build a cluster as following (with 4 nodes):
var queryOpts = new QueryOptions()
.SetConsistencyLevel(ConsistencyLevel.Quorum);
var socketOpts = new SocketOptions()
.SetReadTimeoutMillis(90 * 1000)
.SetConnectTimeoutMillis(30 * 1000);
return Cluster.Builder()
.AddContactPoints(nodes)
.WithCredentials(_userName, _password)
.WithQueryOptions(queryOpts)
.WithQueryTimeout(90 * 1000)
.WithSocketOptions(socketOpts);
All 4 nodes seems to be UN (Up & Normal) according to nodetool.
Both ConnectAsync() and Connect() method take almost the same time around 21s, even when cluster is already built and other sessions wotk properly.
I'm the developer of that backend webapi without direct access to production cassandra node servers. For local development I use single node cassandra cluster in docker and I experience session creation times around 200ms, which would be really nice to have in prodution environment.
What/how we should investigate/test to find out reason for such unexpected long times? It's almost like there is some 5s timeout awaited for each node, before Session is connected, but I was unable to find any hint in documentation how to proceed.
Even pointing me in right direction would be a great help.
Thanks, Tom.