Take the 2-minute tour ×

I'm using c# driver for Cassandra with multi-threads processing. At first, I tried to create a connection and execute command and then close the connection after done the work. But it's seem not to work for me, sometimes it's got an exception that No hosts available.

So, I changed to working with static connection. it's seem to work as well. But when thread is working too fast, it's broken again. I've to put some Thread.Sleep for 1 second then it works.

And with this static solution, I tried to use Asynchronous process, BeginExecute and it's not work for me as well, exception No Hosts Available.

So, anyone has better ideas or better implementation on multi-threads processing working with Cassandra c# driver, it would be appreciate if you can share.

Thank you in advance.

Cheers, Kin

share|improve this question
and it would be highly appreciated if you post some code –  Ehsan Aug 27 '13 at 12:56
which C# client??? Datastax C# driver or FluentCassandra. By default Cassandra Client is concurrent. Default limit is 64. –  abhi Aug 27 '13 at 20:18
It's Datastax C# driver. –  n4kin Aug 28 '13 at 7:05
add comment

2 Answers

CassandraSession can only have one connection at a time. It probably isn't thread safe now that I think about it. But the Connection Pool is thread safe, so if you use that you will always have a high availability connection

share|improve this answer
add comment
  1. Make sure your setup is satisfying the connection requirements

  2. The C# driver should definitely work in a multi-threading environment (1 cluster object, 1 session object/keyspace)

  3. It's difficult to say why you are seeing the NoHostAvailable exception without seeing any code.

share|improve this answer
1 cluster object, 1 session object/keyspace That mean this 1 cluster object, 1 session object will serve all thread which updating/selecting the same keyspace, right? –  n4kin Sep 3 '13 at 9:37
add comment

Your Answer


