0
votes

I'm developing an application using java. The objective is to simulate multiple users connection to Cassandra (concurrent connections), all of them connected to same cluster.

My questions is: Should I implement multiple sessions where each session simulate a user. or only one session for the whole application.? Also how to implement multiple sessions if possible.?

Its appreciated if there is a reference or examples.

2
What do you want to measure - how multiple users create a load via same app. Or multiple users create a load as different apps?Alex Ott
I want to measure how multiple users create a load on Cassandra DB. whether from same app or not. the app I'm developing is only to simulate multiple users connection and perform some cql .Sholi

2 Answers

0
votes

You should always consider using a single session with a connection pool for concurrent requests. you can build a retry mechanism if the session goes bad. having said that you can technically create redundant sessions, the driver would allow it.

0
votes

Ideally, you should use only one Cluster/Session object per application, as each Session object creates a pool of connections to every node of the cluster + a control connection to get notifications about schema & topology changes, etc., and having too many connections would add an additional load to the nodes. As described in the documentation, single network connection could carry on multiple requests simultaneously, and you can increase the number of the in-flight requests if you need, but it's not recommended to set them too high, as the high number of in-flight requests is a sign that nodes aren't able to execute queries so fast - this could happen if you're running queries that use ALLOW FILTERING, or fetching too much data.

You can find more information in the DataStax's guide "Developing applications with DataStax drivers".