Coder
Coder

Reputation: 3262

Is Tracing On in cassandra the right choice to track the timetaken in Cassandra

When I try to execute the query on 500000 entries in a table, I could see that it is completed in 1200ms, But when I try to execute the query using TRACING ON enabled, I can see it is showing a long time in the Tracing log say 1850 ms.

So I would like to confirm whether the TRACING ON feature in Cassandra is a right choice for tracking time taken for executing queries?

Upvotes: 0

Views: 1990

Answers (2)

Chris Lohfink
Chris Lohfink

Reputation: 16410

There are metrics that will give you the amount of time spent on queries, you can most easily view it with nodetool proxyhistograms (doc) or grabbing directly from JMX. TRACING ON is for debugging why a request is slow. Its important to note that this is very expensive (and possibly adds time to query, although most tracing is async) and should be avoided outside of debugging issues.

You can also use nodetool settraceprobability to globally record some % of the queries, which you can then look at and maybe process with some tooling the events and sessions table in the system_traces keyspace.

Upvotes: 3

Alex M981
Alex M981

Reputation: 2374

Per documentation https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlshTracing.html

Enables and disables tracing for transactions on all nodes in the cluster. Use tracing to troubleshoot performance problems. Detailed transaction information related Cassandra internal operations is captured in the system_traces keyspace. When a query runs a session id displays in the query results and an entry with the high-level details such as session id and client, and session length, is written to the system_traces.session table.

So it should be used for troubleshooting performance and hence measuring time taken.

The tracing information consists of the activity, the timestamp at which the activity occurred, the source of the activity and the time elapsed since the start of the request (source_elapsed). source_elapsed is in microseconds.

Upvotes: 2

Related Questions