DataStax Academy FAQ

DataStax Academy migrated to a new learning management system (LMS) in July 2020. We are also moving to a new Cassandra Certification process so there are changes to exam bookings, voucher system and issuing of certificates.

Check out the Academy FAQ pages for answers to your questions:


question

pranali.khanna101994_189965 avatar image
pranali.khanna101994_189965 asked ·

What does "lagging behind" mean with leveled compaction strategy?

I am following upon the course for admin on datastax academy. while going through , I found that leveled comapction switches to STCS at level 0 when compaction is behind ?


what does that mean ?

compactionlcs
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

"Lagging behind" in level 0 in the context of LeveledCompactionStrategy means that a node has not been able to keep up with the required tasks to compact the SSTables and it has fallen behind.

When there are more than 32 SSTables in level 0 because LCS has not been able to keep up with the required compaction tasks, the LeveledManifest.java class will temporarily switch to STCS:

    private static final int MAX_COMPACTING_L0 = 32;
    private CompactionCandidate getSTCSInL0CompactionCandidate()
    {
        if (!DatabaseDescriptor.getDisableSTCSInL0() && getLevel(0).size() > MAX_COMPACTING_L0)
        {
            List<SSTableReader> mostInteresting = getSSTablesForSTCS(getLevel(0));
            if (!mostInteresting.isEmpty())
            {
                logger.debug("L0 is too far behind, performing size-tiering there first");
                return new CompactionCandidate(mostInteresting, 0, Long.MAX_VALUE);
            }
        }

        return null;
    }

This is done to quickly reduce the number of SSTables in L0. If you recall, the goal of LCS is to coalesce the partition fragments so that the least amount of SSTables need to be read to satisfy a request. This is problematic when there are too many SSTables in level 0. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.