You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Paulo Motta (Jira)" <ji...@apache.org> on 2022/03/15 14:02:00 UTC

[jira] [Commented] (CASSANDRA-17440) Report compacted bytes metric periodically

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

Paulo Motta commented on CASSANDRA-17440:
-----------------------------------------

I think the best place to implement this is in [ActiveCompactions|https://github.com/apache/cassandra/blob/bf96367f4d55692017e144980cf17963e31df127/src/java/org/apache/cassandra/db/compaction/ActiveCompactions.java].

Instead of updating compaction progress [only at the end|https://github.com/apache/cassandra/blob/bf96367f4d55692017e144980cf17963e31df127/src/java/org/apache/cassandra/db/compaction/ActiveCompactions.java#L48], we would schedule a periodic reporter task for each active compaction and stop the task when compaction is completed.

Something along these lines:
{code:java}
class ActiveCompactions {

void beginCompactions(CompactionInfo.Holder ci)
{
    future = schedule(() -> reportInfo(ci), getProperty("cassandra.compacted_bytes_reporter_period", 1), TimeUnit.MINUTES)
}

void reportInfo(CompactionInfo.Holder ci)
{
    CompactionInfo info = ci.getCompactionInfo();
    long compactedBytes = computeDelta(info);
    CompactionManager.instance.getMetrics().bytesCompacted.inc(compactedBytes);
}

void endCompaction(CompactionInfo.Holder ci)
{
    reportInfo(ci):
    future.cancel();
}

}
{code}
Please let me know what do you think of this approach.

> Report compacted bytes metric periodically
> ------------------------------------------
>
>                 Key: CASSANDRA-17440
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17440
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Local/Compaction
>            Reporter: Paulo Motta
>            Priority: Normal
>
> Currently the compacted bytes metrics are incremented only at the end of the compaction, which can take a long time to update for long running compactions.
> We should periodically (ie. every 1 minute, configurable) update the compacted bytes metric to improve compaction throughput observability.
> This is issue is analogous of CASSANDRA-16325 but for compaction instead of streaming.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org