It seems several pairs of Cluster and Session instances obviously rises the memories usages in my case, I don't know why this happened.

9 views
Skip to first unread message

Martin Zang

unread,
May 28, 2015, 9:16:04 AM5/28/15
to java-dri...@lists.datastax.com
Hi,
   We are constructing one client application for monitoring purpose since we have more than 10 Cassandra Datacenters located different countries.
   We want to make sure each Datacenter got the latest replication data in time. Thus we built an application based on latest java driver (2.1.5) like this.

   We concurrently initiated several Cluster and Session instances at the beginning of the process.
   After each connection is ready,
  1>. We use one connection to insert one record on the test table;
  2>. Then triggered several query request based on the rest sessions, each connected to a different Cassandra Datacenters.
  3>. After each query got the insert record. ( We only query the replication from local DC, using LOCAL_ONE).
     We check the time costed among these steps.


   We met an severe issue, that is: this process cost more than 1G memories if we input 10 hosts into this java routine.
What's worse, occasionally, the routine run into a never-stop state without no output information, and we have to kill the process.
   On tracing, we found that is a jvm 'Full GC' loop.

   How would this happen? How would only 10 pairs of Cluster and Session instances corrupt this simple routine?
   Or is this a bug, or we didn't using your API or Options properly?

   Thanks advance for any feedbacks.
   yours sincerely
Martin.
May 28th





Olivier Michallat

unread,
Jun 2, 2015, 5:55:57 AM6/2/15
to java-dri...@lists.datastax.com
Cluster is a heavyweight object holding internal resources (thread pools, etc.). It is not expected that you will create more than one for a given Cassandra cluster in your application.

I would also advise to limit the number of Session objects, since it holds internal connection pools to each host, which will get duplicated if you have multiple Sessions. If you need to interact with multiple keyspaces, create your Session with connect() (no keyspace name), and prefix your table names with the keyspace name in queries. 

--

Olivier Michallat

Driver & tools engineer, DataStax


To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.

Reply all
Reply to author
Forward
0 new messages