Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-11571

Optimize the overlapping lookup, by calculating all the bounds in advance.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 3.6
    • Local/Compaction
    • None

    Description

      When L0 sstable backs up (because of repair or other reasons), I find that a lot of CPU is using to construct the Bounds.

      "CompactionExecutor:223" #1557 daemon prio=1 os_prio=4 tid=0x00007f88f401d800 nid=0x2303ab runnable [0x00007f824d735000]
         java.lang.Thread.State: RUNNABLE
              at org.apache.cassandra.dht.AbstractBounds.strictlyWrapsAround(AbstractBounds.java:86)
              at org.apache.cassandra.dht.Bounds.<init>(Bounds.java:44)
              at org.apache.cassandra.db.compaction.LeveledManifest.overlapping(LeveledManifest.java:533)
              at org.apache.cassandra.db.compaction.LeveledManifest.overlapping(LeveledManifest.java:520)
              at org.apache.cassandra.db.compaction.LeveledManifest.getCandidatesFor(LeveledManifest.java:595)
              at org.apache.cassandra.db.compaction.LeveledManifest.getCompactionCandidates(LeveledManifest.java:349)
              - locked <0x00007f8e11e67900> (a org.apache.cassandra.db.compaction.LeveledManifest)
              at org.apache.cassandra.db.compaction.LeveledCompactionStrategy.getNextBackgroundTask(LeveledCompactionStrategy.java:97)
              - locked <0x00007f8e11b1d780> (a org.apache.cassandra.db.compaction.LeveledCompactionStrategy)
              at org.apache.cassandra.db.compaction.WrappingCompactionStrategy.getNextBackgroundTask(WrappingCompactionStrategy.java:78)
              - locked <0x00007f8e110931a0> (a org.apache.cassandra.db.compaction.WrappingCompactionStrategy)
              at org.apache.cassandra.db.compaction.CompactionManager$BackgroundCompactionCandidate.run(CompactionManager.java:250)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at java.lang.Thread.run(Thread.java:745)
      

      From the code, we may construct the bounds multiply times, my patch optimizes it by calculating it in advance.

      Attachments

        Activity

          People

            dikanggu Dikang Gu
            dikanggu Dikang Gu
            Dikang Gu
            Marcus Eriksson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: