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

More-efficient ExecutorService for improved throughput

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Fix Version/s: 2.1 rc1
    • Component/s: None
    • Labels:

      Description

      Currently all our execution stages dequeue tasks one at a time. This can result in contention between producers and consumers (although we do our best to minimize this by using LinkedBlockingQueue).

      One approach to mitigating this would be to make consumer threads do more work in "bulk" instead of just one task per dequeue. (Producer threads tend to be single-task oriented by nature, so I don't see an equivalent opportunity there.)

      BlockingQueue has a drainTo(collection, int) method that would be perfect for this. However, no ExecutorService in the jdk supports using drainTo, nor could I google one.

      What I would like to do here is create just such a beast and wire it into (at least) the write and read stages. (Other possible candidates for such an optimization, such as the CommitLog and OutboundTCPConnection, are not ExecutorService-based and will need to be one-offs.)

      AbstractExecutorService may be useful. The implementations of ICommitLogExecutorService may also be useful. (Despite the name these are not actual ExecutorServices, although they share the most important properties of one.)

        Attachments

        1. 4718-v1.patch
          23 kB
          Jason Brown
        2. austin_diskbound_read.svg
          12 kB
          Benedict
        3. aws_read.svg
          8 kB
          Benedict
        4. aws.svg
          9 kB
          Benedict
        5. backpressure-stress.out.txt
          13 kB
          Jason Brown
        6. baq vs trunk.png
          44 kB
          Ryan McGuire
        7. belliotsmith_branches-stress.out.txt
          10 kB
          Jason Brown
        8. E100M_summary_key_s.svg
          8 kB
          Benedict
        9. E10M_summary_key_s.svg
          7 kB
          Benedict
        10. E600M_summary_key_s.svg
          8 kB
          Benedict
        11. jason_read_latency.svg
          11 kB
          Benedict
        12. jason_read.svg
          8 kB
          Benedict
        13. jason_run1.svg
          7 kB
          Benedict
        14. jason_run2.svg
          7 kB
          Benedict
        15. jason_run3.svg
          7 kB
          Benedict
        16. jason_write.svg
          8 kB
          Benedict
        17. op costs of various queues.ods
          28 kB
          Benedict
        18. PerThreadQueue.java
          3 kB
          Vijay
        19. stress_2014May15.txt
          11 kB
          Jason Brown
        20. stress_2014May16.txt
          10 kB
          Jason Brown
        21. stress op rate with various queues.ods
          37 kB
          Benedict
        22. v1-stress.out
          11 kB
          Jason Brown

          Issue Links

            Activity

              People

              • Assignee:
                benedict Benedict
                Reporter:
                jbellis Jonathan Ellis
                Reviewer:
                Jason Brown
              • Votes:
                2 Vote for this issue
                Watchers:
                33 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: