I am using dev cassandra cluster (4 nodes, each has 4 cores, 6GB RAM, 30-40GB of storage (NVME/SSD) on differents SANs).
The code used for a connection (.net core 3.1) and is DI via Singleton
_cluster = Cluster.Builder()
.AddContactPoints(cassandraHost.ToString().Split(','))
// .WithLoadBalancingPolicy(new RoundRobinPolicy())
.WithPoolingOptions(new PoolingOptions().SetHeartBeatInterval(50000))
.WithReconnectionPolicy(new ConstantReconnectionPolicy(1000))
.Build()
;
_sessions = new ConcurrentDictionary<string, ISession>();
and to get a session:
if (!_sessions.ContainsKey(keyspaceName))
{
// var session = _cluster.Connect(keyspaceName);
_sessions.GetOrAdd(keyspaceName, _cluster.Connect(keyspaceName));
//var session = ;
}
//_sessions.GetOrAdd(keyspaceName, key => new Lazy<ISession>(() =>
// _cluster.Connect(key)));
var result = _sessions[keyspaceName];
return result;
Error that I see after 3-30 minutes:
Cassandra.NoHostAvailableException: All hosts tried for query failed (tried 10.30.200.4:9042; 10.30.200.2:9042; ...), see Errors property for more info
Interesting twist, same code works fine in production, but cannot make it work on development.
In terms of load, there is read every 0.2s (~ 1500 records), and around ~ 1000 inserts per second (dev).
Can't figure out why on my dev machine the code is crashing after random X minutes.
The nodes are accessible at the time of the app crash are working fine (as soon as I restart the app it will start working again just fine).
I am trying to crack this now maybe for a week and still can't figure that out :/
Thanks in advance for any direction.
Here is the log (Serilog => Sentry).
assandra.NoHostAvailableException: All hosts tried for query failed (tried
10.30.200.1:9042: OperationTimedOutException 'The host 10.30.200.1:9042 did
not reply before timeout 12000ms')
Module "Cassandra.Requests.RequestHandler", in GetNextValidHost
Module "Cassandra.Requests.RequestExecution", in Start
Module "Cassandra.Requests.RequestExecution", in RetryExecution
Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", in Throw
Module "System.Runtime.CompilerServices.TaskAwaiter", in
HandleNonSuccessAndDebuggerNotification
Module "System.Runtime.CompilerServices.TaskAwaiter`1", in GetResult