Reputation: 21
We are migrating from Netflix Astyanax to Datastax driver - the details are given below
Drivers Used:
astyanax-cassandra (by Netflix) ; version 1.56.37
datastax-driver-core; version 3.3.2
Java version: jdk 1.8
Servlet Container: Jetty 9.x
Cassandra version: 2.0.9
sample functional code:
From UUID list it filters and fetches the data from cassandra db using an in clause.
public boolean isColumnIdExists(List<UUID> attrList) {
boolean IdExists = true;
try {
Statement SEARCH_CQL = null;
{
// Build the statement with in clause using either of these
QueryBuilder api or
Prepared statment or
netflix api
//
}
final ResultSet resultSet = CassandraConnectUtil.getSession().execute(SEARCH_CQL);
for (Row row : asIterable(resultSet.iterator())) {
if (row.getTimestamp("deletedbytimestamp") == null) {
IdExists = true;
break;
}
}
} catch (Exception ex) {
throw new Exception("Exception", ex);
}
return IdExists;
}
When the above piece of code is executed the response time of fetching the results take approx around 25ms using Netflix Astyanax driver while the Datastax driver responds in around 500ms. There is a wide difference in fetch time of the different drivers. Is there a way to improve the performance in the aforementioned datastax version.
Upvotes: 0
Views: 127
Reputation: 7365
We don't know what is happening in getSession
, but is it possible it's connecting a session the first time it's called?
Make sure you're following best practices of initializing a session at application startup, and using a single instance for the lifetime of the application.
Upvotes: 1