[ 
https://issues.apache.org/jira/browse/CASSANDRA-12403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15411168#comment-15411168
 ] 

Stefania commented on CASSANDRA-12403:
--------------------------------------

Thank you for the patch. I think this is definitely something that operators 
will find very useful.

CASSANDRA-7392 introduced a poor man's "slow query log" for queries that timed 
out, the code is in 
[{{MonitoringTask}}|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/monitoring/MonitoringTask.java#L144]
 in the 
[db.monitoring|https://github.com/apache/cassandra/tree/trunk/src/java/org/apache/cassandra/db/monitoring]
 package. This is done replica side rather than coordinator side. 

We may want to build on that rather than log slow queries coordinator side. If 
we log coordinator side, it may be that some queries took a long time because a 
replica was overloaded. Replica side we can instead measure the accurate query 
time. Each read command is already monitored, we basically just need to add a 
new state to {{Monitorable}}, and notify {{MonitoringTask}} when this state is 
triggered.

I would continue logging in aggregate and at debug level, like it is currently 
done for queries that timed out. In {{MonitoringTask}}, we would basically 
first log slow queries, if any, then queries that timed out, if any. We can do 
this with two separate queues or by generalizing (and renaming) 
{{FailedOperation}}.


> Slow query detecting
> --------------------
>
>                 Key: CASSANDRA-12403
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12403
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Shogo Hoshii
>            Assignee: Shogo Hoshii
>         Attachments: sample.log, slow_query.patch
>
>
> Hello,
> In cassandra production environment, users sometimes build anti-pattern 
> tables and throw queries in inefficient manners.
> So I would like to suggest a feature that enables to log slow query.
> The feature can help cassandra operators to identify bad query patterns.
> Then operators can give advices about queries and data model to users who 
> don't know cassandra so much.
> This ticket is related to CASSANDRA-6226, and I focus on detecting bad query 
> patterns, not aborting them.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to