0

When I use nodetool compactionstats, I can see Active compaction remaining time. But the value is not correct, it's much slower than actual time.

E.g., 1 second of it may be equal to 1 minute of real time.

What's the purpose of this timer if it's not correct? Am I missing something?

2 Answers 2

0

The remaining compaction time is calculated using this algorithm (source CompactionStats.java):

    String remainingTime = "n/a";
    if (compactionThroughput != 0)
    {
        long remainingTimeInSecs = remainingBytes / (1024L * 1024L * compactionThroughput);
        remainingTime = format("%dh%02dm%02ds", remainingTimeInSecs / 3600, (remainingTimeInSecs % 3600) / 60, (remainingTimeInSecs % 60));
    }
    out.printf("%25s%10s%n", "Active compaction remaining time : ", remainingTime);

or in simple terms, remaining bytes divided by the compaction throughput:

    remainingBytes / compactionThroughput

where the compaction throughput is equal to compaction_throughput_mb_per_sec (default is 64 MB/s).

However in practice, the throughput of a compaction thread is never the same because it depends on a lot of moving parts including (a) how busy the disk is, (b) how much resources like CPU and RAM are available, (c) how many compactors are configured.

The compaction_throughput_mb_per_sec is the maximum total throughput for all the compaction threads so the calculation for the remaining time is for the best case scenario where there is only one compaction thread running and it has all the resources it needs to complete the task.

The result is not the actual remaining time. It is provided to give you an indication for the best case. Cheers!

0

Yeah, that's how much time is remaining on the compaction assuming that Cassandra could dedicate 100% of the available system resources to it.

But you are correct, in that it is not an accurate, real-time estimation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.