If you are using Hector library to access Cassandra DB, it’s really easy to find out how much time a mutation or read query took to get executed.
All mutation operations made through Mutator – whether single or batched – return a MutationResult object, that can provide you with the following information after the query is executed:
- getExecutionTimeMicro() – time in microseconds it took to execute the query.
- getHostUsed() – on which host in the Cassandra ring, the query was executed
Similary for read operations, all flavors of Query return a QueryResult object that again provides the same info as above.
Useful and consistent, isn’t it?